2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
var Object = require ('./object');
|
|
|
|
var Expr = require ('./expr');
|
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
/**
|
|
|
|
* The equivalent of a SQL statement.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-09-26 09:28:47 +00:00
|
|
|
module.exports = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Object
|
2015-01-23 13:09:30 +00:00
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
where:
|
|
|
|
{
|
2016-09-26 09:28:47 +00:00
|
|
|
type: Expr
|
2015-01-23 13:09:30 +00:00
|
|
|
,value: null
|
2017-11-13 16:36:30 +00:00
|
|
|
},
|
|
|
|
limit:
|
|
|
|
{
|
|
|
|
type: Number
|
|
|
|
,value: null
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
,target: []
|
|
|
|
|
|
|
|
,addTarget: function (target)
|
|
|
|
{
|
|
|
|
this.target.push (target);
|
|
|
|
}
|
|
|
|
|
2017-11-13 16:36:30 +00:00
|
|
|
,renderTarget: function (params)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2017-11-13 16:36:30 +00:00
|
|
|
if (this.target.length > 0)
|
|
|
|
return this.renderListWs (this.target, params, ', ');
|
2015-01-23 13:09:30 +00:00
|
|
|
else
|
2017-11-13 16:36:30 +00:00
|
|
|
return 'DUAL';
|
|
|
|
}
|
|
|
|
|
|
|
|
,renderLimit: function ()
|
|
|
|
{
|
|
|
|
if (this.limit != null)
|
|
|
|
return 'LIMIT '+ parseInt (this.limit);
|
|
|
|
else
|
|
|
|
return '';
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
});
|