[CONJS-21] add bulk insert method Created: 2018-03-13  Updated: 2018-11-15  Resolved: 2018-11-15

Status: Closed
Project: MariaDB Connector/node.js
Component/s: API
Affects Version/s: None
Fix Version/s: 2.0.1-beta

Type: Task Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

add bulk insert method

API :

connection.queryBulk(sql, values) -> Promise

sql: string | JSON SQL string or JSON object to supersede default connection options. When using JSON object, object must have a "sql" key. For instance, { dateStrings: true, sql: 'SELECT now()' }
values: array of array, or in case of having one parameter per row, a single array.

Returns a promise that :

resolves with a JSON object or with an Error.

For instance, when using an SQL string:

connection
  .queryBulk("INSERT INTO myTable(col1, col2) values (?, ?)", [[1, 'john'], [2, 'jack']])
  .then(rows => {
	console.log(rows); 
  })
  .catch(err => {
	//handle error
  });



 Comments   
Comment by Diego Dupin [ 2018-11-07 ]

reopening since there can be race condition resulting in "out of order packet sequence"

Generated at Thu Feb 08 03:22:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.