-
Notifications
You must be signed in to change notification settings - Fork 82
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
Insert array to db #155
Comments
Well, you can pretty much just use a loop: final artists = ['The Beatles', 'Led Zeppelin', 'The Who', 'Nirvana'];
final stmt = db.prepare('INSERT INTO artists (name) VALUES (?)');
try {
for (final artist in artists) {
stmt.execute([artist]);
}
} finally {
stmt.dispose();
} Is that what you were looking for? |
yes but when i loop to insert data the application will be Freeze for the loop insert |
How much data are you inserting? This library is synchronous, so it will block while the operation is happening. You might be able to speed things up by running |
The output of the sql string must be this execute should receive a list of data: "creatSql.valuesList"
and make a loading progress, to signal that there is a process in progress for your user
|
Hello may i know How to insert array to db?
// Prepare a statement to run it multiple times:
final stmt = db.prepare('INSERT INTO artists (name) VALUES (?)');
stmt
..execute(['The Beatles'])
..execute(['Led Zeppelin'])
..execute(['The Who'])
..execute(['Nirvana']);
// Dispose a statement when you don't need it anymore to clean up resources.
stmt.dispose();
i see the example but i don't how to loop insert
The text was updated successfully, but these errors were encountered: