node-mariasql
node-mariasql copied to clipboard
Example code for executing 1000 queries in a single batch for a prepared statement
I have an insert statement which looks something like this:
INSERT INTO mytable SET A=?, B=?;
Now I want to insert 1000 rows into mytable in a single connection. Can I do something like this?
prepareBatch(['a1', 'b1']); prepareBatch(['a2', 'b2']); prepareBatch(['a3', 'b3']); ... prepareBatch(['a1000', 'b1000']); executeBatch();
If this is possible, can you please show some example code? Thanks.
Perhaps you can read readme from last example. Note: prepared function only available on that coonetion session
I have read the readme thoroughly, and the last example seems to run only one query in a batch. Any more detailed example will be greatly appreciated.