hedera-web/js/sql/update.js

31 lines
499 B
JavaScript

var Dml = require ('./dml');
/**
* The equivalent of a SQL update.
*/
module.exports = new Class
({
Extends: Dml
,render: function (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;
}
});