
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(target) {
		this.target.push(target);
	}

	,renderTarget(params) {
		if (this.target.length > 0)
			return ' '+ this.renderListWs(this.target, params, ', ');
		else
			return ' DUAL';
	}
	
	,renderLimit() {
		if (this.limit != null)
			return ' LIMIT '+ parseInt(this.limit);
		else
			return '';
	}
});
