Commit 230674ef by Konstantin Käfer

make sure the callback function is called when preparing fails before parameters can be bound

parent 9a0b6f75
......@@ -13,7 +13,11 @@ Database.prototype.prepare = function(sql) {
return new Statement(this, sql, params[0]);
}
else {
var statement = new Statement(this, sql);
var statement = new Statement(this, sql, function(err) {
if (err && typeof params[params.length - 1] === 'function') {
params[params.length - 1](err);
}
});
return statement.bind.apply(statement, params);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment