2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
var Stmt = require ('./stmt');
|
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
/**
|
|
|
|
* The equivalent of a SQL delete.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-09-26 09:28:47 +00:00
|
|
|
module.exports = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Stmt
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,render: function (batch)
|
|
|
|
{
|
|
|
|
var sql = 'DELETE FROM ' + this.renderTarget (batch);
|
|
|
|
|
|
|
|
if (this.where)
|
|
|
|
sql += ' WHERE ' + this.where.render (batch);
|
|
|
|
|
|
|
|
sql += ' LIMIT 1'; // Only for security.
|
|
|
|
|
|
|
|
return sql;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|