hedera-web/js/sql/update.js

29 lines
480 B
JavaScript

var Dml = require('./dml');
/**
* The equivalent of a SQL update.
*/
module.exports = new Class({
Extends: Dml
,render(params) {
var sql = 'UPDATE'
+ this.renderTarget(params)
+ ' SET ';
this.field.forEach(function(field, i) {
if (i > 0)
sql += ', ';
sql += field.render(params)
+ ' = '
+ this.expr[i].render(params);
}, this);
sql += this.renderIfSet(this.where, 'WHERE', params)
+ this.renderLimit(params);
return sql;
}
});