ronin-code-sql 2.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +4 -0
- data/.editorconfig +11 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.gitignore +11 -0
- data/.mailmap +1 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.yardopts +1 -0
- data/COPYING.txt +165 -0
- data/ChangeLog.md +104 -0
- data/Gemfile +28 -0
- data/README.md +212 -0
- data/Rakefile +30 -0
- data/gemspec.yml +25 -0
- data/lib/ronin/code/sql/binary_expr.rb +53 -0
- data/lib/ronin/code/sql/clause.rb +74 -0
- data/lib/ronin/code/sql/clauses.rb +310 -0
- data/lib/ronin/code/sql/emittable.rb +88 -0
- data/lib/ronin/code/sql/emitter.rb +406 -0
- data/lib/ronin/code/sql/field.rb +110 -0
- data/lib/ronin/code/sql/fields.rb +82 -0
- data/lib/ronin/code/sql/function.rb +53 -0
- data/lib/ronin/code/sql/functions.rb +1265 -0
- data/lib/ronin/code/sql/injection.rb +168 -0
- data/lib/ronin/code/sql/injection_expr.rb +113 -0
- data/lib/ronin/code/sql/literal.rb +40 -0
- data/lib/ronin/code/sql/literals.rb +83 -0
- data/lib/ronin/code/sql/operators.rb +384 -0
- data/lib/ronin/code/sql/statement.rb +72 -0
- data/lib/ronin/code/sql/statement_list.rb +112 -0
- data/lib/ronin/code/sql/statements.rb +117 -0
- data/lib/ronin/code/sql/unary_expr.rb +38 -0
- data/lib/ronin/code/sql/version.rb +28 -0
- data/lib/ronin/code/sql.rb +96 -0
- data/ronin-code-sql.gemspec +62 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/sql/binary_expr_examples.rb +25 -0
- data/spec/sql/binary_expr_spec.rb +5 -0
- data/spec/sql/clause_examples.rb +43 -0
- data/spec/sql/clause_spec.rb +31 -0
- data/spec/sql/clauses_spec.rb +47 -0
- data/spec/sql/emittable_spec.rb +41 -0
- data/spec/sql/emitter_spec.rb +533 -0
- data/spec/sql/field_spec.rb +103 -0
- data/spec/sql/fields_spec.rb +40 -0
- data/spec/sql/function_examples.rb +30 -0
- data/spec/sql/function_spec.rb +25 -0
- data/spec/sql/functions_spec.rb +113 -0
- data/spec/sql/injection_expr_spec.rb +98 -0
- data/spec/sql/injection_spec.rb +172 -0
- data/spec/sql/literal_spec.rb +5 -0
- data/spec/sql/literals_spec.rb +46 -0
- data/spec/sql/operators_spec.rb +44 -0
- data/spec/sql/statement_examples.rb +39 -0
- data/spec/sql/statement_list_spec.rb +48 -0
- data/spec/sql/statement_spec.rb +38 -0
- data/spec/sql/statements_spec.rb +22 -0
- data/spec/sql/unary_expr_examples.rb +20 -0
- data/spec/sql/unary_expr_spec.rb +5 -0
- data/spec/sql_spec.rb +18 -0
- metadata +157 -0
@@ -0,0 +1,1265 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-code-sql - A Ruby DSL for crafting SQL Injections.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-code-sql is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# ronin-code-sql is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with ronin-code-sql. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/code/sql/function'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Code
|
25
|
+
module SQL
|
26
|
+
#
|
27
|
+
# Methods for creating common SQL {Function Functions}.
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
#
|
31
|
+
module Functions
|
32
|
+
#
|
33
|
+
# @!group Aggregate Functions
|
34
|
+
#
|
35
|
+
|
36
|
+
#
|
37
|
+
# The `COUNT` function.
|
38
|
+
#
|
39
|
+
# @param [Field, Symbol] field
|
40
|
+
# The field to aggregate.
|
41
|
+
#
|
42
|
+
# @return [Function]
|
43
|
+
# The new function.
|
44
|
+
#
|
45
|
+
def count(field=:*)
|
46
|
+
Function.new(:COUNT,field)
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# The `MAX` function.
|
51
|
+
#
|
52
|
+
# @param [Field, Symbol] field
|
53
|
+
# The field to aggregate.
|
54
|
+
#
|
55
|
+
# @return [Function]
|
56
|
+
# The new function.
|
57
|
+
#
|
58
|
+
def max(field)
|
59
|
+
Function.new(:MAX,field)
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# The `MIN` function.
|
64
|
+
#
|
65
|
+
# @param [Field, Symbol] field
|
66
|
+
# The field to aggregate.
|
67
|
+
#
|
68
|
+
# @return [Function]
|
69
|
+
# The new function.
|
70
|
+
#
|
71
|
+
def min(field)
|
72
|
+
Function.new(:MIN,field)
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# The `AVG` function.
|
77
|
+
#
|
78
|
+
# @param [Field, Symbol] field
|
79
|
+
# The field to aggregate.
|
80
|
+
#
|
81
|
+
# @return [Function]
|
82
|
+
# The new function.
|
83
|
+
#
|
84
|
+
def avg(field)
|
85
|
+
Function.new(:AVG,field)
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# The `SUM` function.
|
90
|
+
#
|
91
|
+
# @param [Field, Symbol] field
|
92
|
+
# The field to aggregate.
|
93
|
+
#
|
94
|
+
# @return [Function]
|
95
|
+
# The new function.
|
96
|
+
#
|
97
|
+
def sum(field)
|
98
|
+
Function.new(:SUM,field)
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# The `SQRT` function.
|
103
|
+
#
|
104
|
+
# @param [Field, Symbol] field
|
105
|
+
# The field to aggregate.
|
106
|
+
#
|
107
|
+
# @return [Function]
|
108
|
+
# The new function.
|
109
|
+
#
|
110
|
+
def sqrt(field)
|
111
|
+
Function.new(:SQRT,field)
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# The `RAND` function.
|
116
|
+
#
|
117
|
+
# @param [Field, Symbol] field
|
118
|
+
# The field to aggregate.
|
119
|
+
#
|
120
|
+
# @return [Function]
|
121
|
+
# The new function.
|
122
|
+
#
|
123
|
+
def rand(field)
|
124
|
+
Function.new(:RAND,field)
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# @!group Numeric Functions
|
129
|
+
#
|
130
|
+
|
131
|
+
#
|
132
|
+
# The `ABS` function.
|
133
|
+
#
|
134
|
+
# @param [Field, Function, Symbol, Numeric] x
|
135
|
+
#
|
136
|
+
# @return [Function]
|
137
|
+
# The new function.
|
138
|
+
#
|
139
|
+
def abs(x)
|
140
|
+
Function.new(:ABS,x)
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# The `ACOS` function.
|
145
|
+
#
|
146
|
+
# @param [Field, Function, Symbol, Numeric] x
|
147
|
+
#
|
148
|
+
# @return [Function]
|
149
|
+
# The new function.
|
150
|
+
#
|
151
|
+
def acos(x)
|
152
|
+
Function.new(:ACOS,x)
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# The `ASIN` function.
|
157
|
+
#
|
158
|
+
# @param [Field, Function, Symbol, Numeric] x
|
159
|
+
#
|
160
|
+
# @return [Function]
|
161
|
+
# The new function.
|
162
|
+
#
|
163
|
+
def asin(x)
|
164
|
+
Function.new(:ASIN,x)
|
165
|
+
end
|
166
|
+
|
167
|
+
#
|
168
|
+
# The `ATAN` function.
|
169
|
+
#
|
170
|
+
# @param [Field, Function, Symbol, Numeric] x
|
171
|
+
#
|
172
|
+
# @return [Function]
|
173
|
+
# The new function.
|
174
|
+
#
|
175
|
+
def atan(x)
|
176
|
+
Function.new(:ATAN,x)
|
177
|
+
end
|
178
|
+
|
179
|
+
#
|
180
|
+
# The `ATAN2` function.
|
181
|
+
#
|
182
|
+
# @param [Field, Function, Symbol, Numeric] x
|
183
|
+
#
|
184
|
+
# @param [Field, Function, Symbol, Numeric] y
|
185
|
+
#
|
186
|
+
# @return [Function]
|
187
|
+
# The new function.
|
188
|
+
#
|
189
|
+
def atan2(y,x)
|
190
|
+
Function.new(:ATAN2,y,x)
|
191
|
+
end
|
192
|
+
|
193
|
+
#
|
194
|
+
# The `BIT_AND` function.
|
195
|
+
#
|
196
|
+
# @param [Field, Function, Symbol, Numeric] x
|
197
|
+
#
|
198
|
+
# @return [Function]
|
199
|
+
# The new function.
|
200
|
+
#
|
201
|
+
def bit_and(x)
|
202
|
+
Function.new(:BIT_AND,x)
|
203
|
+
end
|
204
|
+
|
205
|
+
#
|
206
|
+
# The `BIT_COUNT` function.
|
207
|
+
#
|
208
|
+
# @param [Field, Function, Symbol, Numeric] x
|
209
|
+
#
|
210
|
+
# @return [Function]
|
211
|
+
# The new function.
|
212
|
+
#
|
213
|
+
def bit_count(x)
|
214
|
+
Function.new(:BIT_COUNT,x)
|
215
|
+
end
|
216
|
+
|
217
|
+
#
|
218
|
+
# The `BIT_OR` function.
|
219
|
+
#
|
220
|
+
# @param [Field, Function, Symbol, Numeric] x
|
221
|
+
#
|
222
|
+
# @return [Function]
|
223
|
+
# The new function.
|
224
|
+
#
|
225
|
+
def bit_or(x)
|
226
|
+
Function.new(:BIT_OR,x)
|
227
|
+
end
|
228
|
+
|
229
|
+
#
|
230
|
+
# The `CEIL` function.
|
231
|
+
#
|
232
|
+
# @param [Field, Function, Symbol, Numeric] x
|
233
|
+
#
|
234
|
+
# @return [Function]
|
235
|
+
# The new function.
|
236
|
+
#
|
237
|
+
def ceil(x)
|
238
|
+
Function.new(:CEIL,x)
|
239
|
+
end
|
240
|
+
|
241
|
+
#
|
242
|
+
# The `CEILING` function.
|
243
|
+
#
|
244
|
+
# @param [Field, Function, Symbol, Numeric] x
|
245
|
+
#
|
246
|
+
# @return [Function]
|
247
|
+
# The new function.
|
248
|
+
#
|
249
|
+
def ceiling(x)
|
250
|
+
Function.new(:CEILING,x)
|
251
|
+
end
|
252
|
+
|
253
|
+
#
|
254
|
+
# The `COS` function.
|
255
|
+
#
|
256
|
+
# @param [Field, Function, Symbol, Numeric] x
|
257
|
+
#
|
258
|
+
# @return [Function]
|
259
|
+
# The new function.
|
260
|
+
#
|
261
|
+
def cos(x)
|
262
|
+
Function.new(:COS,x)
|
263
|
+
end
|
264
|
+
|
265
|
+
#
|
266
|
+
# The `COT` function.
|
267
|
+
#
|
268
|
+
# @param [Field, Function, Symbol, Numeric] x
|
269
|
+
#
|
270
|
+
# @return [Function]
|
271
|
+
# The new function.
|
272
|
+
#
|
273
|
+
def cot(x)
|
274
|
+
Function.new(:COT,x)
|
275
|
+
end
|
276
|
+
|
277
|
+
#
|
278
|
+
# The `DEGREES` function.
|
279
|
+
#
|
280
|
+
# @param [Field, Function, Symbol, Numeric] x
|
281
|
+
#
|
282
|
+
# @return [Function]
|
283
|
+
# The new function.
|
284
|
+
#
|
285
|
+
def degrees(x)
|
286
|
+
Function.new(:DEGREES,x)
|
287
|
+
end
|
288
|
+
|
289
|
+
#
|
290
|
+
# The `EXP` function.
|
291
|
+
#
|
292
|
+
# @param [Field, Function, Symbol, Numeric] x
|
293
|
+
#
|
294
|
+
# @return [Function]
|
295
|
+
# The new function.
|
296
|
+
#
|
297
|
+
def exp(x)
|
298
|
+
Function.new(:EXP,x)
|
299
|
+
end
|
300
|
+
|
301
|
+
#
|
302
|
+
# The `FLOOR` function.
|
303
|
+
#
|
304
|
+
# @param [Field, Function, Symbol, Numeric] x
|
305
|
+
#
|
306
|
+
# @return [Function]
|
307
|
+
# The new function.
|
308
|
+
#
|
309
|
+
def floor(x)
|
310
|
+
Function.new(:FLOOR,x)
|
311
|
+
end
|
312
|
+
|
313
|
+
#
|
314
|
+
# The `FORMAT` function.
|
315
|
+
#
|
316
|
+
# @param [Field, Function, Symbol, String, Numeric] value
|
317
|
+
#
|
318
|
+
# @param [Field, Function, Symbol, String] pattern
|
319
|
+
#
|
320
|
+
# @return [Function]
|
321
|
+
# The new function.
|
322
|
+
#
|
323
|
+
def format(value,pattern)
|
324
|
+
Function.new(:FORMAT,value,pattern)
|
325
|
+
end
|
326
|
+
|
327
|
+
#
|
328
|
+
# The `GREATEST` function.
|
329
|
+
#
|
330
|
+
# @param [Array<Field, Function, Symbol, Numeric>] values
|
331
|
+
#
|
332
|
+
# @return [Function]
|
333
|
+
# The new function.
|
334
|
+
#
|
335
|
+
def greatest(*values)
|
336
|
+
Function.new(:GREATEST,*values)
|
337
|
+
end
|
338
|
+
|
339
|
+
#
|
340
|
+
# The `INTERVAL` function.
|
341
|
+
#
|
342
|
+
# @param [Array<Field, Function, Symbol, Numeric>] values
|
343
|
+
#
|
344
|
+
# @return [Function]
|
345
|
+
# The new function.
|
346
|
+
#
|
347
|
+
def interval(*values)
|
348
|
+
Function.new(:INTERVAL,*values)
|
349
|
+
end
|
350
|
+
|
351
|
+
#
|
352
|
+
# The `LEAST` function.
|
353
|
+
#
|
354
|
+
# @param [Array<Field, Function, Symbol, Numeric>] values
|
355
|
+
#
|
356
|
+
# @return [Function]
|
357
|
+
# The new function.
|
358
|
+
#
|
359
|
+
def least(*values)
|
360
|
+
Function.new(:LEAST,*values)
|
361
|
+
end
|
362
|
+
|
363
|
+
#
|
364
|
+
# The `LOG` function.
|
365
|
+
#
|
366
|
+
# @param [Field, Function, Symbol, Numeric, nil] b
|
367
|
+
#
|
368
|
+
# @param [Field, Function, Symbol, Numeric] x
|
369
|
+
#
|
370
|
+
# @return [Function]
|
371
|
+
# The new function.
|
372
|
+
#
|
373
|
+
def log(b=nil,x)
|
374
|
+
if b then Function.new(:LOG,b,x)
|
375
|
+
else Function.new(:LOG,x)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
#
|
380
|
+
# The `LOG10` function.
|
381
|
+
#
|
382
|
+
# @param [Field, Function, Symbol, Numeric] x
|
383
|
+
#
|
384
|
+
# @return [Function]
|
385
|
+
# The new function.
|
386
|
+
#
|
387
|
+
def log10(x)
|
388
|
+
Function.new(:LOG10,x)
|
389
|
+
end
|
390
|
+
|
391
|
+
#
|
392
|
+
# The `MOD` function.
|
393
|
+
#
|
394
|
+
# @param [Field, Function, Symbol, Numeric] n
|
395
|
+
#
|
396
|
+
# @param [Field, Function, Symbol, Numeric] m
|
397
|
+
#
|
398
|
+
# @return [Function]
|
399
|
+
# The new function.
|
400
|
+
#
|
401
|
+
def mod(n,m)
|
402
|
+
Function.new(:MOD,n,m)
|
403
|
+
end
|
404
|
+
|
405
|
+
#
|
406
|
+
# The `PI` function.
|
407
|
+
#
|
408
|
+
# @return [Function]
|
409
|
+
# The new function.
|
410
|
+
#
|
411
|
+
def pi
|
412
|
+
Function.new(:PI)
|
413
|
+
end
|
414
|
+
|
415
|
+
#
|
416
|
+
# The `POW` function.
|
417
|
+
#
|
418
|
+
# @param [Field, Function, Symbol, Numeric] x
|
419
|
+
#
|
420
|
+
# @param [Field, Function, Symbol, Numeric] y
|
421
|
+
#
|
422
|
+
# @return [Function]
|
423
|
+
# The new function.
|
424
|
+
#
|
425
|
+
def pow(x,y)
|
426
|
+
Function.new(:POW,x,y)
|
427
|
+
end
|
428
|
+
|
429
|
+
#
|
430
|
+
# The `POWER` function.
|
431
|
+
#
|
432
|
+
# @param [Field, Function, Symbol, Numeric] x
|
433
|
+
#
|
434
|
+
# @param [Field, Function, Symbol, Numeric] y
|
435
|
+
#
|
436
|
+
# @return [Function]
|
437
|
+
# The new function.
|
438
|
+
#
|
439
|
+
def power(x,y)
|
440
|
+
Function.new(:POWER,x,y)
|
441
|
+
end
|
442
|
+
|
443
|
+
#
|
444
|
+
# The `RADIANS` function.
|
445
|
+
#
|
446
|
+
# @param [Field, Function, Symbol, Numeric] x
|
447
|
+
#
|
448
|
+
# @return [Function]
|
449
|
+
# The new function.
|
450
|
+
#
|
451
|
+
def radians(x)
|
452
|
+
Function.new(:RADIANS,x)
|
453
|
+
end
|
454
|
+
|
455
|
+
#
|
456
|
+
# The `RANDOM` function.
|
457
|
+
#
|
458
|
+
# @return [Function]
|
459
|
+
# The new function.
|
460
|
+
#
|
461
|
+
def random
|
462
|
+
Function.new(:RANDOM)
|
463
|
+
end
|
464
|
+
|
465
|
+
#
|
466
|
+
# The `ROUND` function.
|
467
|
+
#
|
468
|
+
# @param [Field, Function, Symbol, Numeric] x
|
469
|
+
#
|
470
|
+
# @param [Field, Function, Symbol, Numeric, nil] d
|
471
|
+
#
|
472
|
+
# @return [Function]
|
473
|
+
# The new function.
|
474
|
+
#
|
475
|
+
def round(x,d=nil)
|
476
|
+
if d then Function.new(:ROUND,x,d)
|
477
|
+
else Function.new(:ROUND,x)
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
481
|
+
#
|
482
|
+
# The `SIGN` function.
|
483
|
+
#
|
484
|
+
# @param [Field, Function, Symbol, Numeric] x
|
485
|
+
#
|
486
|
+
# @return [Function]
|
487
|
+
# The new function.
|
488
|
+
#
|
489
|
+
def sign(x)
|
490
|
+
Function.new(:SIGN,x)
|
491
|
+
end
|
492
|
+
|
493
|
+
#
|
494
|
+
# The `SIN` function.
|
495
|
+
#
|
496
|
+
# @param [Field, Function, Symbol, Numeric] x
|
497
|
+
#
|
498
|
+
# @return [Function]
|
499
|
+
# The new function.
|
500
|
+
#
|
501
|
+
def sin(x)
|
502
|
+
Function.new(:SIN,x)
|
503
|
+
end
|
504
|
+
|
505
|
+
#
|
506
|
+
# The `SQRT` function.
|
507
|
+
#
|
508
|
+
# @param [Field, Function, Symbol, Numeric] x
|
509
|
+
#
|
510
|
+
# @return [Function]
|
511
|
+
# The new function.
|
512
|
+
#
|
513
|
+
def sqrt(x)
|
514
|
+
Function.new(:SQRT,x)
|
515
|
+
end
|
516
|
+
|
517
|
+
#
|
518
|
+
# The `STD` function.
|
519
|
+
#
|
520
|
+
# @param [Field, Symbol] field
|
521
|
+
#
|
522
|
+
# @return [Function]
|
523
|
+
# The new function.
|
524
|
+
#
|
525
|
+
def std(field)
|
526
|
+
Function.new(:STD,field)
|
527
|
+
end
|
528
|
+
|
529
|
+
#
|
530
|
+
# The `STDDEV` function.
|
531
|
+
#
|
532
|
+
# @param [Field, Symbol] field
|
533
|
+
#
|
534
|
+
# @return [Function]
|
535
|
+
# The new function.
|
536
|
+
#
|
537
|
+
def stddev(field)
|
538
|
+
Function.new(:STDDEV,field)
|
539
|
+
end
|
540
|
+
|
541
|
+
#
|
542
|
+
# The `TAN` function.
|
543
|
+
#
|
544
|
+
# @param [Field, Function, Symbol, Numeric] x
|
545
|
+
#
|
546
|
+
# @return [Function]
|
547
|
+
# The new function.
|
548
|
+
#
|
549
|
+
def tan(x)
|
550
|
+
Function.new(:TAN,x)
|
551
|
+
end
|
552
|
+
|
553
|
+
#
|
554
|
+
# The `TRUNCATE` function.
|
555
|
+
#
|
556
|
+
# @param [Field, Function, Symbol, Numeric] x
|
557
|
+
#
|
558
|
+
# @param [Field, Function, Symbol, Numeric] d
|
559
|
+
#
|
560
|
+
# @return [Function]
|
561
|
+
# The new function.
|
562
|
+
#
|
563
|
+
def truncate(x,d)
|
564
|
+
Function.new(:TRUNCATE,x,d)
|
565
|
+
end
|
566
|
+
|
567
|
+
#
|
568
|
+
# @!group String Functions
|
569
|
+
#
|
570
|
+
|
571
|
+
#
|
572
|
+
# The `ASCII` function.
|
573
|
+
#
|
574
|
+
# @param [Field, Function, Symbol, String] string
|
575
|
+
#
|
576
|
+
# @return [Function]
|
577
|
+
# The new function.
|
578
|
+
#
|
579
|
+
def ascii(string)
|
580
|
+
Function.new(:ASCII,string)
|
581
|
+
end
|
582
|
+
|
583
|
+
#
|
584
|
+
# The `BIN` function.
|
585
|
+
#
|
586
|
+
# @param [Field, Function, Symbol, Numeric] n
|
587
|
+
#
|
588
|
+
# @return [Function]
|
589
|
+
# The new function.
|
590
|
+
#
|
591
|
+
def bin(n)
|
592
|
+
Function.new(:BIN,n)
|
593
|
+
end
|
594
|
+
|
595
|
+
#
|
596
|
+
# The `BIT_LENGTH` function.
|
597
|
+
#
|
598
|
+
# @param [Field, Function, Symbol, String] string
|
599
|
+
#
|
600
|
+
# @return [Function]
|
601
|
+
# The new function.
|
602
|
+
#
|
603
|
+
def bit_length(string)
|
604
|
+
Function.new(:BIT_LENGTH,string)
|
605
|
+
end
|
606
|
+
|
607
|
+
#
|
608
|
+
# The `CHAR` function.
|
609
|
+
#
|
610
|
+
# @param [Array<Numeric>] bytes
|
611
|
+
#
|
612
|
+
# @return [Function]
|
613
|
+
# The new function.
|
614
|
+
#
|
615
|
+
def char(*bytes)
|
616
|
+
Function.new(:CHAR,*bytes)
|
617
|
+
end
|
618
|
+
|
619
|
+
#
|
620
|
+
# The `CHAR_LENGTH` function.
|
621
|
+
#
|
622
|
+
# @param [Field, Function, Symbol, String] string
|
623
|
+
#
|
624
|
+
# @return [Function]
|
625
|
+
# The new function.
|
626
|
+
#
|
627
|
+
def char_length(string)
|
628
|
+
Function.new(:CHAR_LENGTH,string)
|
629
|
+
end
|
630
|
+
|
631
|
+
#
|
632
|
+
# The `CHARACTER_LENGTH` function.
|
633
|
+
#
|
634
|
+
# @param [Field, Function, Symbol, String] string
|
635
|
+
#
|
636
|
+
# @return [Function]
|
637
|
+
# The new function.
|
638
|
+
#
|
639
|
+
def character_length(string)
|
640
|
+
Function.new(:CHARACTER_LENGTH,string)
|
641
|
+
end
|
642
|
+
|
643
|
+
#
|
644
|
+
# The `CONCAT` function.
|
645
|
+
#
|
646
|
+
# @param [Array<Field, Function, Symbol, String>] strings
|
647
|
+
#
|
648
|
+
# @return [Function]
|
649
|
+
# The new function.
|
650
|
+
#
|
651
|
+
def concat(*strings)
|
652
|
+
Function.new(:CONCAT,*strings)
|
653
|
+
end
|
654
|
+
|
655
|
+
#
|
656
|
+
# The `CONCAT_WS` function.
|
657
|
+
#
|
658
|
+
# @param [Field, Function, Symbol, String] separator
|
659
|
+
#
|
660
|
+
# @param [Array<Field, Function, Symbol, String>] strings
|
661
|
+
#
|
662
|
+
# @return [Function]
|
663
|
+
# The new function.
|
664
|
+
#
|
665
|
+
def concat_ws(separator,*strings)
|
666
|
+
Function.new(:CONCAT_WS,separator,*strings)
|
667
|
+
end
|
668
|
+
|
669
|
+
#
|
670
|
+
# The `CONV` function.
|
671
|
+
#
|
672
|
+
# @param [Field, Function, Symbol, Numeric] number
|
673
|
+
#
|
674
|
+
# @param [Field, Function, Symbol, Numeric] from_base
|
675
|
+
#
|
676
|
+
# @param [Field, Function, Symbol, Numeric] to_base
|
677
|
+
#
|
678
|
+
# @return [Function]
|
679
|
+
# The new function.
|
680
|
+
#
|
681
|
+
def conv(number,from_base,to_base)
|
682
|
+
Function.new(:CONV,number,from_base,to_base)
|
683
|
+
end
|
684
|
+
|
685
|
+
#
|
686
|
+
# The `ELT` function.
|
687
|
+
#
|
688
|
+
# @param [Field, Function, Symbol, Numeric] index
|
689
|
+
#
|
690
|
+
# @param [Array<Field, Function, Symbol, String>] strings
|
691
|
+
#
|
692
|
+
# @return [Function]
|
693
|
+
# The new function.
|
694
|
+
#
|
695
|
+
def elt(index,*strings)
|
696
|
+
Function.new(:ELT,index,*strings)
|
697
|
+
end
|
698
|
+
|
699
|
+
#
|
700
|
+
# The `EXPORT_SET` function.
|
701
|
+
#
|
702
|
+
# @param [Field, Function, Symbol, Numeric] bits
|
703
|
+
#
|
704
|
+
# @param [Field, Function, Symbol, String] on
|
705
|
+
#
|
706
|
+
# @param [Field, Function, Symbol, String] off
|
707
|
+
#
|
708
|
+
# @param [Field, Function, Symbol, String, nil] separator
|
709
|
+
#
|
710
|
+
# @param [Field, Function, Symbol, Numeric, nil] number_of_bits
|
711
|
+
#
|
712
|
+
# @return [Function]
|
713
|
+
# The new function.
|
714
|
+
#
|
715
|
+
def export_set(bits,on,off,separator=nil,number_of_bits=nil)
|
716
|
+
if (separator && number_of_bits)
|
717
|
+
Function.new(:EXPORT_SET,bits,on,off,separator,number_of_bits)
|
718
|
+
elsif separator
|
719
|
+
Function.new(:EXPORT_SET,bits,on,off,separator)
|
720
|
+
else
|
721
|
+
Function.new(:EXPORT_SET,bits,on,off)
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
#
|
726
|
+
# The `FIELD` function.
|
727
|
+
#
|
728
|
+
# @param [Array<Field, Function, Symbol, String>] strings
|
729
|
+
#
|
730
|
+
# @return [Function]
|
731
|
+
# The new function.
|
732
|
+
#
|
733
|
+
def field(*strings)
|
734
|
+
Function.new(:FIELD,*strings)
|
735
|
+
end
|
736
|
+
|
737
|
+
#
|
738
|
+
# The `FIND_IN_SET` function.
|
739
|
+
#
|
740
|
+
# @param [Field, Function, Symbol, String] string
|
741
|
+
#
|
742
|
+
# @param [Array<Field, Function, Symbol, String>] set
|
743
|
+
#
|
744
|
+
# @return [Function]
|
745
|
+
# The new function.
|
746
|
+
#
|
747
|
+
def find_in_set(string,set)
|
748
|
+
Function.new(:FIND_IN_SET,string,set)
|
749
|
+
end
|
750
|
+
|
751
|
+
#
|
752
|
+
# The `GLOB` function.
|
753
|
+
#
|
754
|
+
# @param [Field, Function, Symbol, String] pattern
|
755
|
+
#
|
756
|
+
# @param [Field, Function, Symbol, String] string
|
757
|
+
#
|
758
|
+
# @return [Function]
|
759
|
+
# The new function.
|
760
|
+
#
|
761
|
+
def glob(pattern,string)
|
762
|
+
Function.new(:GLOB,pattern,string)
|
763
|
+
end
|
764
|
+
|
765
|
+
#
|
766
|
+
# The `HEX` function.
|
767
|
+
#
|
768
|
+
# @param [Field, Function, Symbol, Numeric, String] value
|
769
|
+
#
|
770
|
+
# @return [Function]
|
771
|
+
# The new function.
|
772
|
+
#
|
773
|
+
def hex(value)
|
774
|
+
Function.new(:HEX,value)
|
775
|
+
end
|
776
|
+
|
777
|
+
#
|
778
|
+
# The `INSERT` function.
|
779
|
+
#
|
780
|
+
# @param [Field, Function, Symbol, String] string
|
781
|
+
#
|
782
|
+
# @param [Field, Function, Symbol, Numeric] position
|
783
|
+
#
|
784
|
+
# @param [Field, Function, Symbol, Numeric] length
|
785
|
+
#
|
786
|
+
# @param [Field, Function, Symbol, String] new_string
|
787
|
+
#
|
788
|
+
# @return [Function]
|
789
|
+
# The new function.
|
790
|
+
#
|
791
|
+
def insert(string,position,length,new_string)
|
792
|
+
Function.new(:INSERT,string,position,length,new_string)
|
793
|
+
end
|
794
|
+
|
795
|
+
#
|
796
|
+
# The `INSTR` function.
|
797
|
+
#
|
798
|
+
# @param [Field, Function, Symbol, String] string
|
799
|
+
#
|
800
|
+
# @param [Field, Function, Symbol, String] sub_string
|
801
|
+
#
|
802
|
+
# @return [Function]
|
803
|
+
# The new function.
|
804
|
+
#
|
805
|
+
def instr(string,sub_string)
|
806
|
+
Function.new(:INSTR,string,sub_string)
|
807
|
+
end
|
808
|
+
|
809
|
+
#
|
810
|
+
# The `LCASE` function.
|
811
|
+
#
|
812
|
+
# @param [Field, Function, Symbol, String] string
|
813
|
+
#
|
814
|
+
# @return [Function]
|
815
|
+
# The new function.
|
816
|
+
#
|
817
|
+
def lcase(string)
|
818
|
+
Function.new(:LCASE,string)
|
819
|
+
end
|
820
|
+
|
821
|
+
#
|
822
|
+
# The `LEFT` function.
|
823
|
+
#
|
824
|
+
# @param [Field, Function, Symbol, String] string
|
825
|
+
#
|
826
|
+
# @param [Field, Function, Symbol, Numeric] length
|
827
|
+
#
|
828
|
+
# @return [Function]
|
829
|
+
# The new function.
|
830
|
+
#
|
831
|
+
def left(string,length)
|
832
|
+
Function.new(:LEFT,string,length)
|
833
|
+
end
|
834
|
+
|
835
|
+
#
|
836
|
+
# The `LENGTH` function.
|
837
|
+
#
|
838
|
+
# @param [Field, Function, Symbol, String] string
|
839
|
+
#
|
840
|
+
# @return [Function]
|
841
|
+
# The new function.
|
842
|
+
#
|
843
|
+
def length(string)
|
844
|
+
Function.new(:LENGTH,string)
|
845
|
+
end
|
846
|
+
|
847
|
+
#
|
848
|
+
# The `LIKE` function.
|
849
|
+
#
|
850
|
+
# @return [Function]
|
851
|
+
# The new function.
|
852
|
+
#
|
853
|
+
def like(x,y,options=nil)
|
854
|
+
if options then Function.new(:LIKE,x,y,options)
|
855
|
+
else Function.new(:LIKE,x,y)
|
856
|
+
end
|
857
|
+
end
|
858
|
+
|
859
|
+
#
|
860
|
+
# The `LOAD_FILE` function.
|
861
|
+
#
|
862
|
+
# @param [Field, Function, Symbol, String] file_name
|
863
|
+
#
|
864
|
+
# @return [Function]
|
865
|
+
# The new function.
|
866
|
+
#
|
867
|
+
def load_file(file_name)
|
868
|
+
Function.new(:LOAD_FILE,file_name)
|
869
|
+
end
|
870
|
+
|
871
|
+
#
|
872
|
+
# The `LOCATE` function.
|
873
|
+
#
|
874
|
+
# @param [Field, Function, Symbol, String] substring
|
875
|
+
#
|
876
|
+
# @param [Field, Function, Symbol, String] string
|
877
|
+
#
|
878
|
+
# @param [Field, Function, Symbol, Numeric, nil] pos
|
879
|
+
#
|
880
|
+
# @return [Function]
|
881
|
+
# The new function.
|
882
|
+
#
|
883
|
+
def locate(substring,string,pos=nil)
|
884
|
+
if pos then Function.new(:LOCATE,substring,string,pos)
|
885
|
+
else Function.new(:LOCATE,substring,string)
|
886
|
+
end
|
887
|
+
end
|
888
|
+
|
889
|
+
#
|
890
|
+
# The `LOWER` function.
|
891
|
+
#
|
892
|
+
# @param [Field, Function, Symbol, String] string
|
893
|
+
#
|
894
|
+
# @return [Function]
|
895
|
+
# The new function.
|
896
|
+
#
|
897
|
+
def lower(string)
|
898
|
+
Function.new(:LOWER,string)
|
899
|
+
end
|
900
|
+
|
901
|
+
#
|
902
|
+
# The `LPAD` function.
|
903
|
+
#
|
904
|
+
# @param [Field, Function, Symbol, String] string
|
905
|
+
#
|
906
|
+
# @param [Field, Function, Symbol, Numeric] length
|
907
|
+
#
|
908
|
+
# @param [Field, Function, Symbol, String] pad_string
|
909
|
+
#
|
910
|
+
# @return [Function]
|
911
|
+
# The new function.
|
912
|
+
#
|
913
|
+
def lpad(string,length,pad_string)
|
914
|
+
Function.new(:LPAD,string,length,pad_string)
|
915
|
+
end
|
916
|
+
|
917
|
+
#
|
918
|
+
# The `LTRIM` function.
|
919
|
+
#
|
920
|
+
# @param [Field, Function, Symbol, String] string
|
921
|
+
#
|
922
|
+
# @return [Function]
|
923
|
+
# The new function.
|
924
|
+
#
|
925
|
+
def ltrim(string)
|
926
|
+
Function.new(:LTRIM,string)
|
927
|
+
end
|
928
|
+
|
929
|
+
#
|
930
|
+
# The `MAKE_SET` function.
|
931
|
+
#
|
932
|
+
# @param [Field, Function, Symbol, Numeric] bits
|
933
|
+
#
|
934
|
+
# @param [Array<Field, Function, Symbol, String>] strings
|
935
|
+
#
|
936
|
+
# @return [Function]
|
937
|
+
# The new function.
|
938
|
+
#
|
939
|
+
def make_set(bits,*strings)
|
940
|
+
Function.new(:MAKE_SET,bits,*strings)
|
941
|
+
end
|
942
|
+
|
943
|
+
#
|
944
|
+
# The `MID` function.
|
945
|
+
#
|
946
|
+
# @param [Field, Function, Symbol, String] string
|
947
|
+
#
|
948
|
+
# @param [Field, Function, Symbol, Numeric] position
|
949
|
+
#
|
950
|
+
# @param [Field, Function, Symbol, Numeric] length
|
951
|
+
#
|
952
|
+
# @return [Function]
|
953
|
+
# The new function.
|
954
|
+
#
|
955
|
+
def mid(string,position,length)
|
956
|
+
Function.new(:MID,string,position,length)
|
957
|
+
end
|
958
|
+
|
959
|
+
#
|
960
|
+
# The `OCT` function.
|
961
|
+
#
|
962
|
+
# @param [Field, Function, Symbol, Numeric] number
|
963
|
+
#
|
964
|
+
# @return [Function]
|
965
|
+
# The new function.
|
966
|
+
#
|
967
|
+
def oct(number)
|
968
|
+
Function.new(:OCT,number)
|
969
|
+
end
|
970
|
+
|
971
|
+
#
|
972
|
+
# The `OCTET_LENGTH` function.
|
973
|
+
#
|
974
|
+
# @param [Field, Function, Symbol, String] string
|
975
|
+
#
|
976
|
+
# @return [Function]
|
977
|
+
# The new function.
|
978
|
+
#
|
979
|
+
def octet_length(string)
|
980
|
+
Function.new(:OCTET_LENGTH,string)
|
981
|
+
end
|
982
|
+
|
983
|
+
#
|
984
|
+
# The `ORD` function.
|
985
|
+
#
|
986
|
+
# @param [Field, Function, Symbol, String] string
|
987
|
+
#
|
988
|
+
# @return [Function]
|
989
|
+
# The new function.
|
990
|
+
#
|
991
|
+
def ord(string)
|
992
|
+
Function.new(:ORD,string)
|
993
|
+
end
|
994
|
+
|
995
|
+
#
|
996
|
+
# The `POSITION` function.
|
997
|
+
#
|
998
|
+
# @param [BinaryExpr] expr
|
999
|
+
#
|
1000
|
+
# @return [Function]
|
1001
|
+
# The new function.
|
1002
|
+
#
|
1003
|
+
def position(expr)
|
1004
|
+
Function.new(:POSITION,expr)
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
#
|
1008
|
+
# The `QUOTE` function.
|
1009
|
+
#
|
1010
|
+
# @param [Field, Function, Symbol, String] string
|
1011
|
+
#
|
1012
|
+
# @return [Function]
|
1013
|
+
# The new function.
|
1014
|
+
#
|
1015
|
+
def quote(string)
|
1016
|
+
Function.new(:QUOTE,string)
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
#
|
1020
|
+
# The `REPEAT` function.
|
1021
|
+
#
|
1022
|
+
# @param [Field, Function, Symbol, String] string
|
1023
|
+
#
|
1024
|
+
# @param [Field, Function, Symbol, Numeric] count
|
1025
|
+
#
|
1026
|
+
# @return [Function]
|
1027
|
+
# The new function.
|
1028
|
+
#
|
1029
|
+
def repeat(string,count)
|
1030
|
+
Function.new(:REPEAT,string,count)
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
#
|
1034
|
+
# The `REPLACE` function.
|
1035
|
+
#
|
1036
|
+
# @param [Field, Function, Symbol, String] string
|
1037
|
+
#
|
1038
|
+
# @param [Field, Function, Symbol, String] from_string
|
1039
|
+
#
|
1040
|
+
# @param [Field, Function, Symbol, String] to_string
|
1041
|
+
#
|
1042
|
+
# @return [Function]
|
1043
|
+
# The new function.
|
1044
|
+
#
|
1045
|
+
def replace(string,from_string,to_string)
|
1046
|
+
Function.new(:REPLACE,string,from_string,to_string)
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
#
|
1050
|
+
# The `REVERSE` function.
|
1051
|
+
#
|
1052
|
+
# @param [Field, Function, Symbol, String] string
|
1053
|
+
# The input String to reverse.
|
1054
|
+
#
|
1055
|
+
# @return [Function]
|
1056
|
+
# The new function.
|
1057
|
+
#
|
1058
|
+
def reverse(string)
|
1059
|
+
Function.new(:REVERSE,string)
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
#
|
1063
|
+
# The `RIGHT` function.
|
1064
|
+
#
|
1065
|
+
# @param [Field, Function, Symbol, String] string
|
1066
|
+
# The input String to extract from.
|
1067
|
+
#
|
1068
|
+
# @param [Integer] length
|
1069
|
+
# The desired number of characters to extract.
|
1070
|
+
#
|
1071
|
+
# @return [Function]
|
1072
|
+
# The new function.
|
1073
|
+
#
|
1074
|
+
def right(string,length)
|
1075
|
+
Function.new(:RIGHT,string,length)
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
#
|
1079
|
+
# The `RPAD` function.
|
1080
|
+
#
|
1081
|
+
# @param [Field, Function, Symbol, String] string
|
1082
|
+
# The original String to pad.
|
1083
|
+
#
|
1084
|
+
# @param [Integer] length
|
1085
|
+
# The desired length of the String.
|
1086
|
+
#
|
1087
|
+
# @param [Field, Function, Symbol, String] pad_string
|
1088
|
+
# The String to pad with.
|
1089
|
+
#
|
1090
|
+
# @return [Function]
|
1091
|
+
# The new function.
|
1092
|
+
#
|
1093
|
+
def rpad(string,length,pad_string)
|
1094
|
+
Function.new(:RPAD,string,length,pad_string)
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
#
|
1098
|
+
# The `RTRIM` function.
|
1099
|
+
#
|
1100
|
+
# @param [Field, Function, Symbol, String] string
|
1101
|
+
# The original String to trim.
|
1102
|
+
#
|
1103
|
+
# @return [Function]
|
1104
|
+
# The new function.
|
1105
|
+
#
|
1106
|
+
def rtrim(string)
|
1107
|
+
Function.new(:RTRIM,string)
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
#
|
1111
|
+
# The `SOUNDEX` function.
|
1112
|
+
#
|
1113
|
+
# @param [Field, Function, Symbol, String] string
|
1114
|
+
# The input string.
|
1115
|
+
#
|
1116
|
+
# @return [Function]
|
1117
|
+
# The new function.
|
1118
|
+
#
|
1119
|
+
def soundex(string)
|
1120
|
+
Function.new(:SOUNDEX,string)
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
#
|
1124
|
+
# The `SPACE` function.
|
1125
|
+
#
|
1126
|
+
# @param [Field, Function, Symbol, Numeric] number
|
1127
|
+
#
|
1128
|
+
# @return [Function]
|
1129
|
+
# The new function.
|
1130
|
+
#
|
1131
|
+
def space(number)
|
1132
|
+
Function.new(:SPACE,number)
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
#
|
1136
|
+
# The `STRCMP` function.
|
1137
|
+
#
|
1138
|
+
# @param [Field, Function, Symbol, String] string1
|
1139
|
+
#
|
1140
|
+
# @param [Field, Function, Symbol, String] string2
|
1141
|
+
#
|
1142
|
+
# @return [Function]
|
1143
|
+
# The new function.
|
1144
|
+
#
|
1145
|
+
def strcmp(string1,string2)
|
1146
|
+
Function.new(:STRCMP,string1,string2)
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
#
|
1150
|
+
# The `SUBSTRING` function.
|
1151
|
+
#
|
1152
|
+
# @param [Field, Function, Symbol, String] string
|
1153
|
+
# The original string.
|
1154
|
+
#
|
1155
|
+
# @param [Integer] position
|
1156
|
+
# The beginning index of the substring.
|
1157
|
+
#
|
1158
|
+
# @param [Integer, nil] length
|
1159
|
+
# The desired length of the substring.
|
1160
|
+
#
|
1161
|
+
# @return [Function]
|
1162
|
+
# The new function.
|
1163
|
+
#
|
1164
|
+
def substring(string,position,length=nil)
|
1165
|
+
if length then Function.new(:SUBSTRING,string,position,length)
|
1166
|
+
else Function.new(:SUBSTRING,string,position)
|
1167
|
+
end
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
#
|
1171
|
+
# The `SUBSTRING_INDEX` function.
|
1172
|
+
#
|
1173
|
+
# @param [Field, Function, Symbol, String] string
|
1174
|
+
# The string to search within.
|
1175
|
+
#
|
1176
|
+
# @param [Field, Function, Symbol, String] deliminator
|
1177
|
+
# The deliminator string to search for.
|
1178
|
+
#
|
1179
|
+
# @param [Integer] count
|
1180
|
+
# The number of times to search for the deliminator.
|
1181
|
+
#
|
1182
|
+
# @return [Function]
|
1183
|
+
# The new function.
|
1184
|
+
#
|
1185
|
+
def substring_index(string,deliminator,count)
|
1186
|
+
Function.new(:SUBSTRING_INDEX,string,deliminator,count)
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
#
|
1190
|
+
# The `TRIM` function.
|
1191
|
+
#
|
1192
|
+
# @param [String, Hash{Symbol => Object}] string_or_options
|
1193
|
+
#
|
1194
|
+
# @option string_or_options [Field, Function, Symbol, String] :both
|
1195
|
+
#
|
1196
|
+
# @option string_or_options [Field, Function, Symbol, String] :leading
|
1197
|
+
#
|
1198
|
+
# @option string_or_options [Field, Function, Symbol, String] :trailing
|
1199
|
+
#
|
1200
|
+
# @option string_or_options [Field, Function, Symbol, String] :from
|
1201
|
+
#
|
1202
|
+
# @return [Function]
|
1203
|
+
# The new function.
|
1204
|
+
#
|
1205
|
+
def trim(string_or_options)
|
1206
|
+
Function.new(:TRIM,string_or_options)
|
1207
|
+
end
|
1208
|
+
|
1209
|
+
#
|
1210
|
+
# The `UCASE` function.
|
1211
|
+
#
|
1212
|
+
# @param [Field, Function, Symbol, String] string
|
1213
|
+
# The string argument for `UCASE`.
|
1214
|
+
#
|
1215
|
+
# @return [Function]
|
1216
|
+
# The new function.
|
1217
|
+
#
|
1218
|
+
def ucase(string)
|
1219
|
+
Function.new(:UCASE,string)
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
#
|
1223
|
+
# The `UNHEX` function.
|
1224
|
+
#
|
1225
|
+
# @param [Field, Function, Symbol, String] string
|
1226
|
+
# The string argument for `UNHEX`.
|
1227
|
+
#
|
1228
|
+
# @return [Function]
|
1229
|
+
# The new function.
|
1230
|
+
#
|
1231
|
+
def unhex(string)
|
1232
|
+
Function.new(:UNHEX,string)
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
#
|
1236
|
+
# The `UPPER` function.
|
1237
|
+
#
|
1238
|
+
# @param [Field, Function, Symbol, String] string
|
1239
|
+
# The string argument for `UPPER`.
|
1240
|
+
#
|
1241
|
+
# @return [Function]
|
1242
|
+
# The new function.
|
1243
|
+
#
|
1244
|
+
def upper(string)
|
1245
|
+
Function.new(:UPPER,string)
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
#
|
1249
|
+
# The `SLEEP` function.
|
1250
|
+
#
|
1251
|
+
# @param [Numeric] secs
|
1252
|
+
# The number of seconds to sleep for.
|
1253
|
+
#
|
1254
|
+
# @return [Function]
|
1255
|
+
# The new function.
|
1256
|
+
#
|
1257
|
+
# @since 1.2.0
|
1258
|
+
#
|
1259
|
+
def sleep(secs)
|
1260
|
+
Function.new(:SLEEP,secs)
|
1261
|
+
end
|
1262
|
+
end
|
1263
|
+
end
|
1264
|
+
end
|
1265
|
+
end
|