hedera-web/js/sql/filter.js

51 lines
772 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
var Operation = require ('./operation');
/**
* The equivalent of a SQL operation.
**/
2016-09-26 09:28:47 +00:00
module.exports = new Class
({
2016-09-26 09:28:47 +00:00
Extends: Operation
,Tag: 'sql-filter'
,Properties:
{
alwaysReady:
{
type: Boolean
}
}
,isReady: function ()
{
if (this.alwaysReady)
return true;
var e = this.exprs.getArray ();
for (var i = 0; i < e.length; i++)
2015-11-19 13:57:23 +00:00
if (e[i].isReady () && e[i].primary)
return true;
return false;
}
,render: function (batch)
{
var isReady = false;
2016-09-26 09:28:47 +00:00
var newOp = new Operation ({type: this.type});
var e = this.exprs.getArray ();
for (var i = 0; i < e.length; i++)
if (e[i].isReady ())
{
newOp.exprs.add (e[i]);
isReady = true;
}
if (!isReady)
return 'TRUE';
return newOp.render (batch);
}
});