-
Notifications
You must be signed in to change notification settings - Fork 75
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
Database disk image is malformed, #193
Comments
Are you continuing to use the existing database natively? If so, does that also report errors about malformed database images? I think this might be a concurrency issue, but we're compiling sqlite with thread-safe options so it should be fine. I wonder if the native side might be using the database without thread safety, but it seems unlikely when using the default Android APIs. |
what do you mean for " I wonder if the native side might be using the database without thread safety" sorry ı couldn't understand |
I don't think this is the source of the problem, but if two threads are using the same sqlite3 database and that database hasn't been configured to be used with thread safety (an option in sqlite3), that might corrupt the database. But again, this is unlikely the problem here. Do you have a way to check whether you're also getting the malformed database errors natively, or are you only accessing the database in Dart now? |
just accessting database in dart |
have the similar issue |
@Den-creator Could you also describe your setup in a bit more detail (e.g. does this only happen on some platforms/operating systems, are you opening multiple connections to the same database file (even in different threads), did you notice anything else that seems to cause this problem or make it more likely)? At the moment I don't really have enough information to investigate this, so everything helps. |
@simolus3 flutter app, drift: ^2.16.0, flutter: 3.19.3, Android 12, Pixel 3, one connection to data base, looks like it has happened after upgrade to flutter 3.16.9, but maybe it is coincidence.
|
Hi, I've been able to reproduce this by using a sqlite db created by the Sequel gem: https://github.com/jeremyevans/sequel Use the db file created like this:
You'll get the malformed error. |
I couldn't reproduce the error. I have this
With that, your snippet (well, with a import 'package:sqlite3/sqlite3.dart';
void main() {
final dbtest = sqlite3.open('/tmp/test/blog.db');
print(dbtest.select('select * from items'));
} |
I found the issue. It had to do with the left over -mal -shm files. Those have to be deleted. |
Hello,
I'm using sqlite in my android app.When doing multi insert ı use ;
I use existing database in sqlite3
final _db = .sqlite3.open(fileDb.path);
var stmt = _db.prepare(...)
stmt.dispose();
like that but sometimes its throws error "while executing statement, database disk image is malformed"
The text was updated successfully, but these errors were encountered: