node-sqlite3
node-sqlite3 copied to clipboard
Question about serialize
I want a create table query to run first, then the others can run in any order.
Is this the correct format?
db.serialize(function(){
db.run('CREATE TABLE test;');
});
db.run('INSERT INTO test ...');
db.run('INSERT INTO test ...');
Thanks!
Yes. Serializing the create query will run it exclusively and the other queries will wait for it to finish before starting.