Non-fatal Exception: java.lang.Exception: Invalid argument(s): Failed to load dynamic library (dlopen failed: library "/data/data/app.cheon.app/lib/libsqlite3.so" not found) at ._defaultOpen(load_library.dart:49) at OpenDynamicLibrary.openSqlite(load_library.dart:99) at .new(bindings.dart:122) at .bindings(bindings.dart:266) at .new(database.dart:52) at .new(database.dart:37) at _VmDelegate.open(vm_database.dart:39) at DelegatedDatabase.ensureOpen.<fn>(engines.dart:244) at BasicLock.synchronized(basic_lock.dart:34)
Hi again, I am having issues running a function creation test on Macos. Taken from the example, my testcase is:
final db = sqlite3.openInMemory(); db.createFunction( functionName: 'dart_version', argumentCount: const AllowedArgumentCount(0), function: (args) => Platform.version, deterministic: true, directOnly: false, ); var version = db.select('SELECT dart_version()'); print(version.first); db.dispose();
When it reaches the select statement, it just exits. I get no exception.
According to the docs, on macos it should work out of the box, right?
Thanks for any hint.
@moovida I hit the function problem too, but unfortunately I couldn't find out the exact cause. I think it's some security measure, but I don't get why it worked before. You can view the exact crash in the Console app, but so far I couldn't find out what causes it to crash now (and not before).
It complaining about
open_v3 not existing sounds like you have an older version. If you use version
0.1.4 of the
sqlite3 package, it should fallback to
open_v2 if needed.
The only place where we try to use
open_v3 is here, and we should catch that error. The
open_v3 is actually a typo and it should be
prepare_v3, but that shouldn't have an impact.
sqlite3 ship a custom sqlite version on mac. If you're using Flutter, you can try to change your mac podspec to build sqlite and change the open behavior on mac to using
There is also an issue with using moor_ffi 0.7.0 (the last I was able to create functions in and the last not needing a flutter sdk). The dependency now pulls a never moor and sqlite3 anyways:
|-- moor_ffi 0.7.0 | |-- collection 1.14.13 | |-- ffi 0.1.3 | |-- meta 1.2.2 | '-- moor 3.3.1 | |-- convert 2.1.1 | | |-- charcode... | | '-- typed_data... | |-- sqlite3 0.1.4 | | |-- collection... | | |-- ffi... | | '-- meta...
In the meanwhile your message arrived. So the macos issue might be due to my local native sqlite3 libs?
For moor I want users to migrate from the
moor_ffi package to the
moor/ffilibrary in the main
moor package. This simplifies development since the parts unrelated to moor can work in the
sqlite3 package and everything else lives in the main
moor package. The reason
moor_ffi now depends on Flutter is because we can no longer include native buildscripts in a package without depending on Flutter, so that was necessary to not break the majority of moor users. I don't like this either, but I think the current approach should work well for non-Flutter apps as well.
I can confirm that it now also happens with moor_ffi 0.7.0 and moor 3.2.0
Sorry, what exactly? The
open_v3 issue or not being able to call custom functions? Custom functions work on Linux, I think they should work on Android too. I've opened simolus3/sqlite3.dart#6 to track this for mac.
Expressionis something that will evaluate to an
intwhen run on the database. If you add it to a
select, you can read the int value from a row. There's an example here.