2016-09-26 09:28:47 +00:00
|
|
|
|
2022-05-26 06:08:31 +00:00
|
|
|
var Stmt = require('./stmt');
|
2016-09-26 09:28:47 +00:00
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
/**
|
|
|
|
* The equivalent of a SQL delete.
|
2022-05-26 06:08:31 +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
|
|
|
|
2022-05-26 06:08:31 +00:00
|
|
|
,render: function(batch) {
|
|
|
|
var sql = 'DELETE FROM ' + this.renderTarget(batch);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
if (this.where)
|
2022-05-26 06:08:31 +00:00
|
|
|
sql += ' WHERE ' + this.where.render(batch);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
sql += ' LIMIT 1'; // Only for security.
|
|
|
|
|
|
|
|
return sql;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|