简体   繁体   中英

Pass values in an array to redshift parameterized query

let query ='INSERT INTO tablename (id, test1, test2, test3, test4, test5) VALUES ($1,$2,$3,$4,$5,$6)' let params='id, test1, test2, test3,test4, test5'; client.parameterizedQuery(query, params, function (err, result) { if (err) reject(err) else { resolve('INSERTED Batch'); } });

Its is triggering the query with these parameters.

Your params is a string. But you should pass a list of items.

let params=['id', 'test1', 'test2', 'test3', 'test4', 'test5'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM