Closed hoslo closed 1 year ago
Yeah, it should possible to use sqlite
as well as any Rust crates. I wonder why it's blocking at that point, isn't there any panic going on at unwrap()
?
Yeah, it should possible to use
sqlite
as well as any Rust crates. I wonder why it's blocking at that point, isn't there any panic going on atunwrap()
?
It is possible to use sqlite in memory, but not if you use files
const DB_URL: &str = "sqlite:test.db";
That's strange. It should just work as well as all other Rust crates. I'll take a look later when I have time :|
Hmm, this doesn't look like an issue with RIF.
Could you try these and tell me if the problem persists?
P.S. File operations won't work if you run or build the app for the web.
Hmm, this doesn't look like an issue with RIF.
Could you try these and tell me if the problem persists?
- https://stackoverflow.com/questions/72763578/how-to-create-a-sqlite-database-with-rust-sqlx
- How to create the SQLite database on application startup if it does not already exist? launchbadge/sqlx#1114
P.S. File operations won't work if you run or build the app for the web.
The above two methods can automatically create sqlite files in rust binary programs, but flutter can not, I'm not sure if trying rust in flutter can we manipulate files directly in rust code (native)?
If I understood correctly, that those two methods can automatically create sqlite files in 'Application folder', is this right? Or is it that sqlite
files are embeeded in .dll
, .a
, .so
binary files?
Could you provide some more information like...:
If I understood correctly, that those two methods can automatically create sqlite files in 'Application folder', is this right? Or is it that
sqlite
files are embeeded in.dll
,.a
,.so
binary files?Could you provide some more information like...:
- Which OS are you developing on?
- Which OS are you targeting?
- Do you have error messages from the CLI?
- Is it some kind of permission problem?
I'm developing on macos (m1 chip), targeting the iphone emulator, and I don't see task error messages from the cli, except that each request fails after a timeout
I see 🤔 do you mind showing me your code, perhaps by sharing your repository address?
One of the reasons could be the app sandbox policy of iOS. Can you try running your app on macOS and share the result?
I see 🤔 do you mind showing me your code, perhaps by sharing your repository address?
One of the reasons could be the app sandbox policy of iOS. Can you try running your app on macOS and share the result?
you can look at this repo https://github.com/hoslo/tally
Sorry to say this, but I might be busy for a while, so if you happen to find a solution, please share the idea here or in a new pull request. If I become free again, I will dive into this soon. Thank you for your patience :)
It does work on Windows, other platforms coming soon
It also runs well on macOS
This was an interesting issue, though it wasn't related to RIF.
Now I understand why it was not working on iOS. The Rust thread panic
ked because you didn't have the permission to store test.db
beside the executable binary. In iOS, you are only allowed to access specific folders of the app itself. Also, you didn't add ?mode=wrc
to the end of the sqlite path to create one if not present.
To understand what sandboxing is in iOS apps, take a look at this post:
I was able to fix your app to make it work on iOS. Take a look at my fork: https://github.com/hoslo/tally/compare/master...temeddix:tally:master
sqlite is not working