Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop support #42

Closed
iampopal opened this issue May 19, 2021 · 16 comments
Closed

Desktop support #42

iampopal opened this issue May 19, 2021 · 16 comments

Comments

@iampopal
Copy link

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.

@davidmartos96
Copy link
Owner

@iampopal You can use sqlcipher with sqflite_common_ffi. Check out this: #28 (comment)

I don't have plans to support it via this package because this is just a wrapper of the native iOS and Android libraries.

@alextekartik
Copy link

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.

@davidmartos96
Copy link
Owner

@alextekartik The only place is that issue thread. You can copy the snippet, I don't mind.

@davidmartos96 davidmartos96 changed the title Need support for windows Desktop support May 19, 2021
@iampopal
Copy link
Author

iampopal commented Jun 3, 2021

@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

@iampopal
Copy link
Author

iampopal commented Jun 3, 2021

I have download sqlcipher.dll file from
https://www.dll4free.com/sqlcipher.dll.html
website for windows

@iampopal
Copy link
Author

iampopal commented Jun 3, 2021

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');
  }

@davidmartos96
Copy link
Owner

@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)

@davidmartos96
Copy link
Owner

@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
Copy link
Author

iampopal commented Jun 3, 2021

@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
Copy link
Author

iampopal commented Jun 3, 2021

@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.

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

@davidmartos96
Copy link
Owner

@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.

@iampopal
Copy link
Author

iampopal commented Jun 3, 2021

@davidmartos96 I am getting this error

Asynchronous error
Invalid argument(s): Failed to load dynamic library 'absolutePathTo\sqlcipher.dll': 193

when using absolute path

@iampopal
Copy link
Author

iampopal commented Jun 3, 2021

absolutePathTo
Is long path of my Windows pc to the file

@davidmartos96
Copy link
Owner

@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/

@iampopal
Copy link
Author

iampopal commented Jun 3, 2021

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

@davidmartos96
Copy link
Owner

@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.

Repository owner locked and limited conversation to collaborators Jun 3, 2021
@davidmartos96 davidmartos96 pinned this issue Jun 3, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants