2016-09-26 09:28:47 +00:00
|
|
|
|
2022-06-06 08:53:59 +00:00
|
|
|
var Expr = require('./expr');
|
|
|
|
var ListHolder = require('./list-holder');
|
2016-09-26 09:28:47 +00:00
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
/**
|
|
|
|
* The equivalent of a SQL function.
|
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: Expr
|
2022-05-30 01:30:33 +00:00
|
|
|
,Tag: 'sql-function'
|
|
|
|
,Implements: ListHolder
|
2022-06-06 08:53:59 +00:00
|
|
|
,Properties: {
|
2022-05-30 01:30:33 +00:00
|
|
|
/**
|
|
|
|
* The function name.
|
|
|
|
*/
|
2022-06-06 08:53:59 +00:00
|
|
|
name: {
|
2015-01-23 13:09:30 +00:00
|
|
|
type: String
|
|
|
|
,value: null
|
|
|
|
},
|
2022-05-30 01:30:33 +00:00
|
|
|
/**
|
|
|
|
* The function schema.
|
|
|
|
*/
|
2022-06-06 08:53:59 +00:00
|
|
|
schema: {
|
2015-03-19 19:36:11 +00:00
|
|
|
type: String
|
|
|
|
,value: null
|
|
|
|
},
|
2022-05-30 01:30:33 +00:00
|
|
|
/**
|
|
|
|
* The function parameters.
|
|
|
|
*/
|
2022-06-06 08:53:59 +00:00
|
|
|
params: {
|
2022-05-30 01:30:33 +00:00
|
|
|
type: Array
|
2022-11-16 01:46:44 +00:00
|
|
|
,set(x) {
|
2022-05-30 01:30:33 +00:00
|
|
|
this.list = x;
|
|
|
|
}
|
2022-11-16 01:46:44 +00:00
|
|
|
,get() {
|
2022-05-30 01:30:33 +00:00
|
|
|
return this.list;
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
,render(params) {
|
2022-06-06 08:53:59 +00:00
|
|
|
return this.renderPreIdent(this.schema)
|
|
|
|
+ this.renderIdent(this.name)
|
2022-05-30 01:30:33 +00:00
|
|
|
+ '('
|
2022-06-06 08:53:59 +00:00
|
|
|
+ this.renderListWs(this.list, params, ', ')
|
2022-05-30 01:30:33 +00:00
|
|
|
+ ')';
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|