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

34 lines
517 B
JavaScript
Raw Normal View History

/**
* The equivalent of a SQL select.
**/
Sql.Select = new Class
({
Extends: Sql.Stmt
,expr: []
,addField: function (fieldName)
{
this.expr.push (new Sql.Field ({name: fieldName}));
}
,render: function (batch)
{
var sql = 'SELECT '
for (var i = 0; i < this.expr.length; i++)
{
if (i > 0)
sql += ', ';
sql += this.expr[i].render(batch);
}
sql += ' FROM ' + this.renderTarget (batch);
if (this.where)
sql += ' WHERE ' + this.where.render (batch);
return sql;
}
});