0
1
Fork 0
hedera-web-mindshore/js/sql/select.js

26 lines
459 B
JavaScript

var Stmt = require('./stmt');
var Field = require('./field');
/**
* The equivalent of a SQL select.
*/
module.exports = new Class({
Extends: Stmt
,expr: []
,addField(fieldName) {
this.expr.push(new Field({name: fieldName}));
}
,render(params) {
return 'SELECT '
+ this.renderListWs(this.expr, params, ', ')
+ ' FROM'
+ this.renderTarget(params)
+ this.renderIfSet(this.where, 'WHERE', params)
+ this.renderLimit(params);
}
});