0
1
Fork 0
hedera-web-mindshore/js/sql/update.js

31 lines
499 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
var Dml = require ('./dml');
/**
* The equivalent of a SQL update.
2022-05-26 06:08:31 +00:00
*/
2016-09-26 09:28:47 +00:00
module.exports = new Class
({
2016-09-26 09:28:47 +00:00
Extends: Dml
2022-05-30 01:30:33 +00:00
,render: function (params)
{
2022-05-30 01:30:33 +00:00
var sql = 'UPDATE'
+ this.renderTarget (params)
+ ' SET ';
2022-05-30 01:30:33 +00:00
this.field.forEach (function (field, i) {
if (i > 0)
sql += ', ';
2022-05-30 01:30:33 +00:00
sql += field.render (params)
+ ' = '
+ this.expr[i].render(params);
}, this);
2022-05-30 01:30:33 +00:00
sql += this.renderIfSet (this.where, 'WHERE', params)
+ this.renderLimit(params);
return sql;
}
});