forked from google/lovefield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery.js
223 lines (171 loc) · 4.89 KB
/
query.js
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/**
* @license
* Copyright 2014 The Lovefield Project Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
goog.provide('lf.query.Builder');
goog.provide('lf.query.Delete');
goog.provide('lf.query.Insert');
goog.provide('lf.query.Select');
goog.provide('lf.query.Update');
goog.forwardDeclare('lf.Binder');
goog.forwardDeclare('lf.Order');
goog.forwardDeclare('lf.Type');
/** @interface */
lf.query.Builder = function() {};
/**
* Executes the query, all errors will be passed to the reject function.
* The resolve function may receive parameters as results of execution, for
* example, select queries will return results.
* @return {!IThenable}
*/
lf.query.Builder.prototype.exec;
/**
* Returns string representation of query execution plan. Similar to EXPLAIN
* in most SQL engines.
* @return {string}
*/
lf.query.Builder.prototype.explain;
/**
* Bind values to parameterized queries. Callers are responsible to make sure
* the types of values match those specified in the query.
* @param {!Array<*>} values
* @return {!lf.query.Builder}
*/
lf.query.Builder.prototype.bind;
/**
* @param {boolean=} opt_stripValueInfo Strip value, default to false. This is
* used to remove all PII.
* @return {string}
*/
lf.query.Builder.prototype.toSql;
/**
* Query Builder which constructs a SELECT query. The builder is stateful.
* All member functions, except orderBy(), can only be called once. Otherwise
* an exception will be thrown.
* @extends {lf.query.Builder}
* @interface
*/
lf.query.Select = function() {};
/**
* Specifies the source of the SELECT query.
* @param {...!lf.schema.Table} var_args Tables used as source of this SELECT.
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.from;
/**
* Defines search condition of the SELECT query.
* @param {!lf.Predicate} predicate
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.where;
/**
* Explicit inner join target table with specified search condition.
* @param {!lf.schema.Table} table
* @param {!lf.Predicate} predicate
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.innerJoin;
/**
* Explicit left outer join target table with specified search condition.
* @param {!lf.schema.Table} table
* @param {!lf.Predicate} predicate
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.leftOuterJoin;
/**
* Limits the number of rows returned in select results. If there are fewer rows
* than limit, all rows will be returned.
* @param {number|!lf.Binder} numberOfRows
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.limit;
/**
* Skips the number of rows returned in select results from the beginning. If
* there are fewer rows than skip, no row will be returned.
* @param {number|!lf.Binder} numberOfRows
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.skip;
/**
* Specify sorting order of returned results.
* @param {!lf.schema.Column} column
* @param {lf.Order=} opt_order
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.orderBy;
/**
* Specify grouping of returned results.
* @param {...!lf.schema.Column} var_args
* @return {!lf.query.Select}
* @throws {!lf.Exception}
*/
lf.query.Select.prototype.groupBy;
/**
* @extends {lf.query.Builder}
* @interface
*/
lf.query.Insert = function() {};
/**
* @param {!lf.schema.Table} table
* @return {!lf.query.Insert}
*/
lf.query.Insert.prototype.into;
/**
* @param {!Array<!lf.Row>|!lf.Binder|!Array<!lf.Binder>} rows
* @return {!lf.query.Insert}
* @throws {DOMException}
*/
lf.query.Insert.prototype.values;
/**
* @extends {lf.query.Builder}
* @interface
*/
lf.query.Update = function() {};
/**
* @param {!lf.schema.Column} column
* @param {*} value
* @return {!lf.query.Update}
* @throws {DOMException}
*/
lf.query.Update.prototype.set;
/**
* @param {!lf.Predicate} predicate
* @return {!lf.query.Update}
* @throws {DOMException}
*/
lf.query.Update.prototype.where;
/**
* @extends {lf.query.Builder}
* @interface
*/
lf.query.Delete = function() {};
/**
* @param {!lf.schema.Table} table
* @return {!lf.query.Delete}
*/
lf.query.Delete.prototype.from;
/**
* @param {!lf.Predicate} predicate
* @return {!lf.query.Delete}
* @throws {DOMException}
*/
lf.query.Delete.prototype.where;