forked from verdnatura/hedera-web
33 lines
528 B
JavaScript
33 lines
528 B
JavaScript
|
|
var Dml = require ('./dml');
|
|
|
|
/**
|
|
* The equivalent of a SQL update.
|
|
**/
|
|
module.exports = new Class
|
|
({
|
|
Extends: Dml
|
|
|
|
,render: function (batch)
|
|
{
|
|
var sql;
|
|
var n;
|
|
|
|
sql = 'UPDATE ' + this.renderTarget (batch) + ' SET ';
|
|
|
|
for (n = 0; n < this.field.length; n++)
|
|
{
|
|
if (n > 0)
|
|
sql += ', ';
|
|
sql += this.field[n].render () + ' = ' + this.expr[n].render(batch);
|
|
}
|
|
|
|
if (this.where)
|
|
sql += ' WHERE ' + this.where.render (batch);
|
|
|
|
sql += ' LIMIT 1'; // Only for security.
|
|
|
|
return sql;
|
|
}
|
|
});
|