-
Notifications
You must be signed in to change notification settings - Fork 35
/
ModuleConfig.cfc
75 lines (67 loc) · 3.27 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
component {
this.title = "qb";
this.author = "Eric Peterson";
this.webURL = "https://github.com/coldbox-modules/qb";
this.description = "A query builder for the rest of us";
this.cfmapping = "qb";
function configure() {
settings = {
"defaultGrammar": "AutoDiscover@qb",
"defaultReturnFormat": "array",
"preventDuplicateJoins": false,
"strictDateDetection": true,
"numericSQLType": "CF_SQL_NUMERIC",
"integerSQLType": "CF_SQL_INTEGER",
"decimalSQLType": "CF_SQL_DECIMAL",
"autoAddScale": true,
"autoDeriveNumericType": true,
"defaultOptions": {},
"sqlCommenter": {
"enabled": false,
"commenters": [
{ "class": "FrameworkCommenter@qb", "properties": {} },
{ "class": "RouteInfoCommenter@qb", "properties": {} },
{ "class": "DBInfoCommenter@qb", "properties": {} }
]
},
"shouldMaxRowsOverrideToAll": function( maxRows ) {
return maxRows <= 0;
}
};
interceptorSettings = { "customInterceptionPoints": "preQBExecute,postQBExecute" };
}
function onLoad() {
// Fill out the sqlCommenter commenters array in case users
// forget to define it when overriding in their `config/ColdBox.cfc`
if ( !settings.sqlCommenter.keyExists( "commenters" ) ) {
param settings.sqlCommenter.commenters = [
{ "class": "FrameworkCommenter@qb", "properties": {} },
{ "class": "RouteInfoCommenter@qb", "properties": {} },
{ "class": "DBInfoCommenter@qb", "properties": {} }
];
}
binder
.map( alias = "QueryUtils@qb", force = true )
.to( "qb.models.Query.QueryUtils" )
.initArg( name = "strictDateDetection", value = settings.strictDateDetection )
.initArg( name = "numericSQLType", value = settings.numericSQLType )
.initArg( name = "autoAddScale", value = settings.autoAddScale )
.initArg( name = "autoDeriveNumericType", value = settings.autoDeriveNumericType )
.initArg( name = "integerSQLType", value = settings.integerSQLType )
.initArg( name = "decimalSQLType", value = settings.decimalSQLType );
binder
.map( alias = "QueryBuilder@qb", force = true )
.to( "qb.models.Query.QueryBuilder" )
.initArg( name = "grammar", ref = settings.defaultGrammar )
.initArg( name = "utils", ref = "QueryUtils@qb" )
.initArg( name = "preventDuplicateJoins", value = settings.preventDuplicateJoins )
.initArg( name = "returnFormat", value = settings.defaultReturnFormat )
.initArg( name = "defaultOptions", value = settings.defaultOptions )
.initArg( name = "sqlCommenter", ref = "ColdBoxSQLCommenter@qb" )
.initArg( name = "shouldMaxRowsOverrideToAll", value = settings.shouldMaxRowsOverrideToAll );
binder
.map( alias = "SchemaBuilder@qb", force = true )
.to( "qb.models.Schema.SchemaBuilder" )
.initArg( name = "grammar", ref = settings.defaultGrammar );
}
}