Closed iampopal closed 3 years ago
@iampopal You can use sqlcipher with sqflite_common_ffi. Check out this: https://github.com/davidmartos96/sqflite_sqlcipher/issues/28#issuecomment-733636725
I don't have plans to support it via this package because this is just a wrapper of the native iOS and Android libraries.
Thanks @davidmartos96 nice trick I was not aware of. Your comment could definitely make it into the doc. I would link to it if you have it somewhere or copy/paste it in sqflte_common_ffi if you don't mind.
@alextekartik The only place is that issue thread. You can copy the snippet, I don't mind.
@davidmartos96 Thank you for the comment, but I am not able to load sqlcipher.dll file in windows
Asynchronous error Invalid argument(s): Failed to load dynamic library 'pathTo\sqlcipher.dll': 193
I have download sqlcipher.dll file from https://www.dll4free.com/sqlcipher.dll.html website for windows
This is the code for loading sqlcipher.dll
static DynamicLibrary sqlcipherOpen() {
if (Platform.isLinux || Platform.isAndroid) {
return DynamicLibrary.open('libsqlcipher.so');
}
if (Platform.isMacOS || Platform.isIOS) {
return DynamicLibrary.open('/usr/lib/libsqlcipher.dylib');
}
if (Platform.isWindows) {
return DynamicLibrary.open(join(
'pathTo',
'sqlcipher.dll'));
}
throw UnsupportedError(
'moor_ffi does not support ${Platform.operatingSystem} yet');
}
@iampopal I wouldn't download any dll from those kind of websites, watch out for that. I'd recommend that you follow the compilation instructions and do it yourself. You can check the following thread, in particular this comment. It could help you out regarding compilation on Windows https://github.com/davidmartos96/sqflite_sqlcipher/issues/20#issuecomment-697051979
@iampopal Also double check the path of the dll when loading it from Dart
The following join('pathTo', 'sqlcipher.dll')
generates pathTo/sqlcipher.dll
which I don't think it will be a path on your machine.
@iampopal I wouldn't download any dll from those kind of websites, watch out for that. I'd recommend that you follow the compilation instructions and do it yourself. You can check the following thread, in particular this comment. It could help you out regarding compilation on Windows #20 (comment)
Thank you for your quick replay, i will watch it.
@iampopal Also double check the path of the dll when loading it from Dart The following
join('pathTo', 'sqlcipher.dll')
generatespathTo/sqlcipher.dll
which I don't think it will be a path on your machine.
pathTo is the full path the file folder and it's totally correct. the issue is I am not able to find the correct version of sqlciper.dll
@iampopal You can try using an absolute path for loading it first. I know from experience that loading with a relative path may be different depending on how you run the app. So maybe it's simply that the relative path is incorrect. After you know the DLL is correct you can investigate the relative path.
@davidmartos96 I am getting this error
Asynchronous error Invalid argument(s): Failed to load dynamic library 'absolutePathTo\sqlcipher.dll': 193
when using absolute path
absolutePathTo Is long path of my Windows pc to the file
@iampopal If you are using the downloaded dll I wouldn't have my hopes up. Try with the compilation steps from https://github.com/daybson/sqlite_cipher_windows This is the Community version of SQLCipher, so one needs the compile the libraries himself. If you need Commercial support or precompiled libraries you should look into the official website https://www.zetetic.net/sqlcipher/
I have reviewed this folder and looked for sqlciper.dll but didn't found the sqlciper.dll file which used my many examples to load sqlcipher.dll
https://github.com/daybson/sqlite_cipher_windows/tree/master/sqlite%20cipher%20compiled/sqlcipher
@iampopal It's probably the one called sqlite.dll
. But if you need the latest version you would need to compile it yourself. I don't know the version that was used by the author of the repo back then.
I am using https://pub.dev/packages/sqflite_common_ffi currently as windows database, can we have suport of this package in windows operating system.