forked from verdnatura/hedera-web
39 lines
543 B
JavaScript
39 lines
543 B
JavaScript
|
|
var Dml = require ('./dml');
|
|
|
|
/**
|
|
* The equivalent of a SQL insert.
|
|
**/
|
|
module.exports = new Class
|
|
({
|
|
Extends: Dml
|
|
|
|
,render: function (batch)
|
|
{
|
|
var sql;
|
|
var n;
|
|
|
|
sql = 'INSERT INTO ' + this.renderTarget (batch) + ' (';
|
|
|
|
for (n = 0; n < this.field.length; n++)
|
|
{
|
|
if (n > 0)
|
|
sql += ', ';
|
|
sql += this.field[n].render (batch);
|
|
}
|
|
|
|
sql += ') VALUES (';
|
|
|
|
for (n = 0; n < this.field.length; n++)
|
|
{
|
|
if (n > 0)
|
|
sql += ', ';
|
|
sql += this.expr[n].render(batch);
|
|
}
|
|
|
|
sql += ')';
|
|
|
|
return sql;
|
|
}
|
|
})
|