var Operation = require('./operation'); /** * The equivalent of a SQL operation. */ module.exports = new Class({ 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++) if (e[i].isReady() && e[i].primary) return true; return false; } ,render: function(batch) { var isReady = false; 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); } });