forked from verdnatura/hedera-web
43 lines
660 B
JavaScript
Executable File
43 lines
660 B
JavaScript
Executable File
/**
|
|
* The equivalent of a SQL multi statement.
|
|
**/
|
|
Sql.MultiStmt = new Class
|
|
({
|
|
Extends: Sql.Stmt
|
|
|
|
,stmts: []
|
|
|
|
,addStmt: function (stmt)
|
|
{
|
|
stmt.on ('changed', this.stmtChanged.bind (this));
|
|
return this.stmts.push (stmt);
|
|
}
|
|
|
|
,stmtChanged: function ()
|
|
{
|
|
this.signalEmit ('changed');
|
|
}
|
|
|
|
,isReady: function ()
|
|
{
|
|
if (this.stmts.length == 0)
|
|
return false;
|
|
|
|
for (var i = 0; i < this.stmts.length; i++)
|
|
if (!this.stmts[i].isReady ())
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
,render: function (batch)
|
|
{
|
|
var sql = '';
|
|
|
|
for (var i = 0; i < this.stmts.length; i++)
|
|
sql += this.stmts[i].render (batch) + '; ';
|
|
|
|
return sql;
|
|
}
|
|
});
|