hedera-web/js/sql/select.js

26 lines
459 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
2022-06-06 08:53:59 +00:00
var Stmt = require('./stmt');
var Field = require('./field');
2016-09-26 09:28:47 +00:00
/**
* The equivalent of a SQL select.
2022-05-26 06:08:31 +00:00
*/
2022-06-06 08:53:59 +00:00
module.exports = new Class({
2016-09-26 09:28:47 +00:00
Extends: Stmt
,expr: []
2022-11-16 01:46:44 +00:00
,addField(fieldName) {
2022-06-06 08:53:59 +00:00
this.expr.push(new Field({name: fieldName}));
}
2022-11-16 01:46:44 +00:00
,render(params) {
2022-05-30 01:30:33 +00:00
return 'SELECT '
2022-06-06 08:53:59 +00:00
+ this.renderListWs(this.expr, params, ', ')
2022-05-30 01:30:33 +00:00
+ ' FROM'
2022-06-06 08:53:59 +00:00
+ this.renderTarget(params)
+ this.renderIfSet(this.where, 'WHERE', params)
+ this.renderLimit(params);
}
});