36 lines
512 B
JavaScript
Executable File
36 lines
512 B
JavaScript
Executable File
/**
|
|
* The equivalent of a SQL insert.
|
|
**/
|
|
Sql.Insert = new Class
|
|
({
|
|
Extends: Sql.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;
|
|
}
|
|
})
|