23 lines
346 B
JavaScript
23 lines
346 B
JavaScript
|
|
var Stmt = require('./stmt');
|
|
|
|
/**
|
|
* The equivalent of a SQL delete.
|
|
*/
|
|
module.exports = new Class
|
|
({
|
|
Extends: Stmt
|
|
|
|
,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;
|
|
}
|
|
});
|
|
|