@dvo/batch-query
v1.0.8
Published
A small tool that formats a query and an array or parameters into a batch query.
Downloads
4
Readme
@dvo/batch-query
This tool is meant to merge a mySQL query and a data array into a formatted query that does what it needs in batch. For example, the query
let query =
'REPLACE INTO common_surnames
(america, spain, korea)
VALUES
(?,?,Kim)'
could be combined with data like
let data = [
['Johnson', 'Gutierrez'],
['Lee', 'Pança'],
['McDonald', 'Plata']
]
when called with batchQuery( query, data )
to produce the results
let formattedQuery =
'REPLACE INTO common_surnames
(america, spain, korea)
VALUES
(Johnson,Gutierrez,Kim),
(Lee,Pança,Kim),
(McDonald,Plata,Kim)'