You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(Object.keys(values).length>1&&sql.toLowerCase().indexOf('select ')>-1&&(query.split(' ? ').length-1)==1){sql=sql.replace('?',Object.keys(values).map((i)=>{return`${i}='${values[i]}'`;}).join(' AND '));values=0;}
when i put some values for SELECT sql query, i get error !
so this add "and " between the parameters.
1)If SELECT sql query
2)If there are over 2 values (Because one works great)
3)If just one ? symbol (support in full query)
example
SELECT * FROM `customers` WHERE ?,{id:12345} =SELECT * FROM `customers` WHERE id='12345' //WORK
SELECT * FROM `customers` WHERE ?,{id:12345,pass:'pass'} =SELECT * FROM `customers` WHERE id='12345'**,** pass='pass',
error! so need replace the comma in "AND". like
SELECT * FROM `customers` WHERE ?,{id:12345,pass:'pass'} =SELECT * FROM `customers` WHERE id='12345' AND pass='pass',
SELECT * FROM `customers` WHERE id=? OR pass=?,{id:12345,pass:'pass'} =SELECT * FROM `customers` WHERE id='12345' OR pass='pass', //WORK (keep the old integration)
The text was updated successfully, but these errors were encountered:
Hi @devorel your use-case is beyond this module. You would likely be interested in the various SQL query-builder modules on npm like https://hiddentao.github.io/squel/ . This module is just for escaping values, not for fully building queries.
sqlstring/lib/SqlString.js
Line 80 in d3cd69a
when i put some values for SELECT sql query, i get error !
so this add "and " between the parameters.
1)If SELECT sql query
2)If there are over 2 values (Because one works great)
3)If just one ? symbol (support in full query)
example
The text was updated successfully, but these errors were encountered: