41 lines
631 B
JavaScript
41 lines
631 B
JavaScript
|
|
var Object = require('./object');
|
|
var Expr = require('./expr');
|
|
|
|
/**
|
|
* The equivalent of a SQL statement.
|
|
*/
|
|
module.exports = new Class({
|
|
Extends: Object
|
|
,Properties: {
|
|
where: {
|
|
type: Expr
|
|
,value: null
|
|
},
|
|
limit: {
|
|
type: Number
|
|
,value: null
|
|
}
|
|
}
|
|
|
|
,target: []
|
|
|
|
,addTarget: function(target) {
|
|
this.target.push(target);
|
|
}
|
|
|
|
,renderTarget: function(params) {
|
|
if (this.target.length > 0)
|
|
return ' '+ this.renderListWs(this.target, params, ', ');
|
|
else
|
|
return ' DUAL';
|
|
}
|
|
|
|
,renderLimit: function() {
|
|
if (this.limit != null)
|
|
return ' LIMIT '+ parseInt(this.limit);
|
|
else
|
|
return '';
|
|
}
|
|
});
|