jayralencar / sqlite-sync.js

Node module to sqlite sync and async
MIT License
78 stars 30 forks source link

Prepared statements don't work #5

Closed lsndr closed 7 years ago

lsndr commented 8 years ago

I tried to run this code

//ctx.message.text = 'dog';
//ctx.meta.user.id = 1;

db.run('DELETE FROM `vocabulary` WHERE `word` = ? AND `user_id` = ?', [ctx.message.text, ctx.meta.user.id], function (result) {
                console.log(result);
            });

But I get next error in console: {error: [Error: no such column: dog]}

jayralencar commented 8 years ago

Use quotes: '?'

lsndr commented 8 years ago

But it still doesn't solve the problem. If "ctx.message.text" will be contaiing symbol ' db.run throws sql syntax error.