Line data Source code
1 : /*
2 : * SPDX-License-Identifier: MPL-2.0
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * Copyright 2024 MonetDB Foundation;
9 : * Copyright August 2008 - 2023 MonetDB B.V.;
10 : * Copyright 1997 - July 2008 CWI.
11 : */
12 :
13 : /* In this file we implement three new types with supporting code.
14 : * The types are:
15 : *
16 : * - daytime - representing a time-of-day between 00:00:00 (included)
17 : * and 24:00:00 (not included);
18 : * - date - representing a date between the year -4712 and 170050;
19 : * - timestamp - a combination of date and daytime, representing an
20 : * exact point in time.
21 : *
22 : * Dates, both in the date and the timestamp types, are represented in
23 : * the so-called proleptic Gregorian calendar, that is to say, the
24 : * Gregorian calendar (which is in common use today) is extended
25 : * backwards. See e.g.
26 : * <https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar>.
27 : *
28 : * Times, both in the daytime and the timestamp types, are recorded
29 : * with microsecond precision.
30 : *
31 : * Times and timestamps are all in UTC. Conversion from the system
32 : * time zone where appropriate is done automatically.
33 : */
34 :
35 : #include "monetdb_config.h"
36 : #include "mtime.h"
37 : #include "mal_client.h"
38 :
39 :
40 : #ifndef HAVE_STRPTIME
41 : extern char *strptime(const char *, const char *, struct tm *);
42 : extern char *strptime2(const char *, const char *, struct tm *, int *);
43 : #endif
44 :
45 : /* interfaces callable from MAL, not used from any C code */
46 :
47 : static str
48 22 : MTIMEcurrent_date(date *ret)
49 : {
50 22 : *ret = timestamp_date(timestamp_current());
51 22 : return MAL_SUCCEED;
52 : }
53 :
54 : static str
55 9 : MTIMEcurrent_time(daytime *ret)
56 : {
57 9 : *ret = timestamp_daytime(timestamp_current());
58 9 : return MAL_SUCCEED;
59 : }
60 :
61 : static str
62 66 : MTIMEcurrent_timestamp(timestamp *ret)
63 : {
64 66 : *ret = timestamp_current();
65 66 : return MAL_SUCCEED;
66 : }
67 :
68 : #define is_str_nil strNil
69 :
70 : #define MTIME_STR_BUFFER_LENGTH MAX(strlen(str_nil) + 1, 512)
71 :
72 :
73 : #define DEC_VAR_R(TYPE, ARG) TYPE *restrict ptr##ARG
74 :
75 : #define DEC_VAR(TYPE, ARG) TYPE *ptr##ARG
76 :
77 : #define DEC_ITER(TYPE, ARG)
78 :
79 : #define DEC_BUFFER(OUTTYPE, RES, MALFUNC) \
80 : OUTTYPE RES = GDKmalloc(MTIME_STR_BUFFER_LENGTH); \
81 : if (!res) { \
82 : msg = createException(MAL, "batmtime." MALFUNC, SQLSTATE(HY013) MAL_MALLOC_FAIL); \
83 : goto bailout; \
84 : }
85 :
86 : #define DEC_INT(OUTTYPE, RES, MALFUNC) OUTTYPE RES = (OUTTYPE){0}
87 :
88 : #define INIT_VAROUT(ARG) ptr##ARG = Tloc(b##ARG, 0)
89 : #define INIT_VARIN(ARG) ptr##ARG = b##ARG##i.base
90 : #define INIT_ITERIN(ARG)
91 :
92 : #define APPEND_VAR(MALFUNC) ptrn[i] = res
93 :
94 : #define GET_NEXT_VAR(ARG, OFF) ptr##ARG[OFF]
95 :
96 : #define APPEND_STR(MALFUNC) \
97 : if (tfastins_nocheckVAR(bn, i, res) != GDK_SUCCEED) { \
98 : msg = createException(SQL, "batmtime." MALFUNC, SQLSTATE(HY013) MAL_MALLOC_FAIL); \
99 : break; \
100 : }
101 :
102 : #define GET_NEXT_ITER(ARG, OFF) BUNtvar(b##ARG##i, OFF)
103 :
104 : #define DEC_NOTHING(TYPE, ARG)
105 : #define INIT_NOTHING(ARG)
106 :
107 : #define FINISH_BUFFER_SINGLE(MALFUNC) \
108 : bailout: \
109 : *ret = NULL; \
110 : if (!msg && res && !(*ret = GDKstrdup(res))) \
111 : msg = createException(MAL, "batmtime." MALFUNC, SQLSTATE(HY013) MAL_MALLOC_FAIL); \
112 : GDKfree(res)
113 :
114 : #define FINISH_INT_SINGLE(MALFUNC) *ret = res
115 :
116 : #define FINISH_BUFFER_MULTI(RES) GDKfree(RES)
117 :
118 : #define CLEAR_NOTHING(RES)
119 :
120 :
121 : #define COPYFLAGS(n) do { bn->tsorted = b1i.sorted; bn->trevsorted = b1i.revsorted; } while (0)
122 : #define SETFLAGS(n) do { bn->tsorted = bn->trevsorted = n < 2; } while (0)
123 : #define func1(NAME, MALFUNC, INTYPE, OUTTYPE, \
124 : FUNC, SETFLAGS, FUNC_CALL, \
125 : DEC_SRC, DEC_OUTPUT, \
126 : INIT_SRC, INIT_OUTPUT, GET_NEXT_SRC) \
127 : static str \
128 : NAME(OUTTYPE *ret, const INTYPE *src) \
129 : { \
130 : str msg = MAL_SUCCEED; \
131 : do { \
132 : FUNC_CALL(FUNC, (*ret), *src); \
133 : } while (0); \
134 : return msg; \
135 : } \
136 : static str \
137 : NAME##_bulk(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
138 : { \
139 : str msg = MAL_SUCCEED; \
140 : BAT *b1 = NULL, *s = NULL, *bn = NULL; \
141 : struct canditer ci = {0}; \
142 : oid off; \
143 : bool nils = false; \
144 : bat *ret = getArgReference_bat(stk, pci, 0), \
145 : *bid = getArgReference_bat(stk, pci, 1), \
146 : *sid = pci->argc == 3 ? getArgReference_bat(stk, pci, 2) : NULL; \
147 : BATiter b1i; \
148 : DEC_SRC(INTYPE, 1); \
149 : DEC_OUTPUT(OUTTYPE, n); \
150 : \
151 : (void) cntxt; \
152 : (void) mb; \
153 : if ((b1 = BATdescriptor(*bid)) == NULL) { \
154 : msg = createException(MAL, "batmtime." MALFUNC, \
155 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
156 : goto bailout; \
157 : } \
158 : b1i = bat_iterator(b1); \
159 : if (sid && !is_bat_nil(*sid) && (s = BATdescriptor(*sid)) == NULL) { \
160 : msg = createException(MAL, "batmtime." MALFUNC, \
161 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
162 : goto bailout; \
163 : } \
164 : off = b1->hseqbase; \
165 : canditer_init(&ci, b1, s); \
166 : if ((bn = COLnew(ci.hseq, TYPE_##OUTTYPE, ci.ncand, TRANSIENT)) == NULL) { \
167 : msg = createException(MAL, "batmtime." MALFUNC, \
168 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
169 : goto bailout; \
170 : } \
171 : INIT_SRC(1); \
172 : INIT_OUTPUT(n); \
173 : if (ci.tpe == cand_dense) { \
174 : for (BUN i = 0; i < ci.ncand; i++) { \
175 : oid p = (canditer_next_dense(&ci) - off); \
176 : FUNC_CALL(FUNC, ptrn[i], GET_NEXT_SRC(1, p)); \
177 : nils |= is_##OUTTYPE##_nil(ptrn[i]); \
178 : } \
179 : } else { \
180 : for (BUN i = 0; i < ci.ncand; i++) { \
181 : oid p = (canditer_next(&ci) - off); \
182 : FUNC_CALL(FUNC, ptrn[i], GET_NEXT_SRC(1, p)); \
183 : nils |= is_##OUTTYPE##_nil(ptrn[i]); \
184 : } \
185 : } \
186 : BATsetcount(bn, ci.ncand); \
187 : bn->tnonil = !nils; \
188 : bn->tnil = nils; \
189 : bn->tkey = ci.ncand < 2; \
190 : SETFLAGS(ci.ncand); \
191 : bailout: \
192 : if (b1) { \
193 : bat_iterator_end(&b1i); \
194 : BBPunfix(b1->batCacheid); \
195 : } \
196 : BBPreclaim(s); \
197 : if (bn) { \
198 : if (msg) \
199 : BBPreclaim(bn); \
200 : else { \
201 : *ret = bn->batCacheid; \
202 : BBPkeepref(bn); \
203 : } \
204 : } \
205 : return msg; \
206 : }
207 :
208 : #define func1_noexcept(FUNC, RET, PARAM) RET = FUNC(PARAM)
209 : #define func1_except(FUNC, RET, PARAM) msg = FUNC(&RET, PARAM); if (msg) break
210 :
211 : #define func2(NAME, MALFUNC, \
212 : INTYPE1, INTYPE2, OUTTYPE, FUNC, FUNC_CALL, \
213 : DEC_SRC1, DEC_SRC2, DEC_OUTPUT, DEC_EXTRA, \
214 : INIT_SRC1, INIT_SRC2, INIT_OUTPUT, \
215 : GET_NEXT_SRC1, GET_NEXT_SRC2, \
216 : APPEND_NEXT, CLEAR_EXTRA_SINGLE, CLEAR_EXTRA_MULTI) \
217 : static str \
218 : NAME(OUTTYPE *ret, const INTYPE1 *v1, const INTYPE2 *v2) \
219 : { \
220 : str msg = MAL_SUCCEED; \
221 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
222 : \
223 : do { \
224 : FUNC_CALL(FUNC, res, *v1, *v2); \
225 : } while (0); \
226 : CLEAR_EXTRA_SINGLE(MALFUNC); \
227 : return msg; \
228 : } \
229 : static str \
230 : NAME##_bulk(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
231 : { \
232 : str msg = MAL_SUCCEED; \
233 : BAT *b1 = NULL, *b2 = NULL, *s1 = NULL, *s2 = NULL, *bn = NULL; \
234 : oid off1, off2; \
235 : struct canditer ci1 = {0}, ci2 = {0}; \
236 : bool nils = false; \
237 : bat *ret = getArgReference_bat(stk, pci, 0), \
238 : *bid1 = getArgReference_bat(stk, pci, 1), \
239 : *bid2 = getArgReference_bat(stk, pci, 2), \
240 : *sid1 = pci->argc == 5 ? getArgReference_bat(stk, pci, 3) : NULL, \
241 : *sid2 = pci->argc == 5 ? getArgReference_bat(stk, pci, 4) : NULL; \
242 : BATiter b1i, b2i = (BATiter){ .vh = NULL }; \
243 : DEC_SRC1(INTYPE1, 1); \
244 : DEC_SRC2(INTYPE2, 2); \
245 : DEC_OUTPUT(OUTTYPE, n); \
246 : \
247 : (void) cntxt; \
248 : (void) mb; \
249 : b1 = BATdescriptor(*bid1); \
250 : b2 = BATdescriptor(*bid2); \
251 : b1i = bat_iterator(b1); \
252 : b2i = bat_iterator(b2); \
253 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
254 : if (b1 == NULL || b2 == NULL) { \
255 : msg = createException(MAL, "batmtime." MALFUNC, \
256 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
257 : goto bailout; \
258 : } \
259 : if (sid1 && !is_bat_nil(*sid1) && (s1 = BATdescriptor(*sid1)) == NULL) { \
260 : msg = createException(MAL, "batmtime." MALFUNC, \
261 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
262 : goto bailout; \
263 : } \
264 : if (sid2 && !is_bat_nil(*sid2) && (s2 = BATdescriptor(*sid2)) == NULL) { \
265 : msg = createException(MAL, "batmtime." MALFUNC, \
266 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
267 : goto bailout; \
268 : } \
269 : canditer_init(&ci1, b1, s1); \
270 : canditer_init(&ci2, b2, s2); \
271 : if (ci2.ncand != ci1.ncand || ci1.hseq != ci2.hseq) { \
272 : msg = createException(MAL, "batmtime." MALFUNC, \
273 : "inputs not the same size"); \
274 : goto bailout; \
275 : } \
276 : if ((bn = COLnew(ci1.hseq, TYPE_##OUTTYPE, ci1.ncand, TRANSIENT)) == NULL) { \
277 : msg = createException(MAL, "batmtime." MALFUNC, \
278 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
279 : goto bailout; \
280 : } \
281 : off1 = b1->hseqbase; \
282 : off2 = b2->hseqbase; \
283 : INIT_SRC1(1); \
284 : INIT_SRC2(2); \
285 : INIT_OUTPUT(n); \
286 : if (ci1.tpe == cand_dense && ci2.tpe == cand_dense) { \
287 : for (BUN i = 0; i < ci1.ncand; i++) { \
288 : oid p1 = (canditer_next_dense(&ci1) - off1); \
289 : oid p2 = (canditer_next_dense(&ci2) - off2); \
290 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), GET_NEXT_SRC2(2, p2)); \
291 : APPEND_NEXT(MALFUNC); \
292 : nils |= is_##OUTTYPE##_nil(res); \
293 : } \
294 : } else { \
295 : for (BUN i = 0; i < ci1.ncand; i++) { \
296 : oid p1 = (canditer_next(&ci1) - off1); \
297 : oid p2 = (canditer_next(&ci2) - off2); \
298 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), GET_NEXT_SRC2(2, p2)); \
299 : APPEND_NEXT(MALFUNC); \
300 : nils |= is_##OUTTYPE##_nil(res); \
301 : } \
302 : } \
303 : BATsetcount(bn, ci1.ncand); \
304 : bn->tnonil = !nils; \
305 : bn->tnil = nils; \
306 : bn->tsorted = ci1.ncand < 2; \
307 : bn->trevsorted = ci1.ncand < 2; \
308 : bn->tkey = ci1.ncand < 2; \
309 : bailout: \
310 : CLEAR_EXTRA_MULTI(res); \
311 : bat_iterator_end(&b1i); \
312 : bat_iterator_end(&b2i); \
313 : BBPreclaim(b1); \
314 : BBPreclaim(b2); \
315 : BBPreclaim(s1); \
316 : BBPreclaim(s2); \
317 : if (bn) { \
318 : if (msg) \
319 : BBPreclaim(bn); \
320 : else { \
321 : *ret = bn->batCacheid; \
322 : BBPkeepref(bn); \
323 : } \
324 : } \
325 : return msg; \
326 : } \
327 : static str \
328 : NAME##_bulk_p1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
329 : { \
330 : str msg = MAL_SUCCEED; \
331 : BAT *b2 = NULL, *s2 = NULL, *bn = NULL; \
332 : oid off2; \
333 : struct canditer ci2 = {0}; \
334 : bool nils = false; \
335 : bat *ret = getArgReference_bat(stk, pci, 0), \
336 : *bid2 = getArgReference_bat(stk, pci, 2), \
337 : *sid2 = pci->argc == 4 ? getArgReference_bat(stk, pci, 3) : NULL; \
338 : const INTYPE1 src1 = *(INTYPE1*)getArgReference(stk, pci, 1); \
339 : BATiter b2i; \
340 : DEC_SRC2(INTYPE2, 2); \
341 : DEC_OUTPUT(OUTTYPE, n); \
342 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
343 : \
344 : (void) cntxt; \
345 : (void) mb; \
346 : if ((b2 = BATdescriptor(*bid2)) == NULL) { \
347 : throw(MAL, "batmtime." MALFUNC, \
348 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
349 : } \
350 : b2i = bat_iterator(b2); \
351 : if (sid2 && !is_bat_nil(*sid2) && (s2 = BATdescriptor(*sid2)) == NULL) { \
352 : msg = createException(MAL, "batmtime." MALFUNC, \
353 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
354 : goto bailout; \
355 : } \
356 : canditer_init(&ci2, b2, s2); \
357 : if ((bn = COLnew(ci2.hseq, TYPE_##OUTTYPE, ci2.ncand, TRANSIENT)) == NULL) { \
358 : msg = createException(MAL, "batmtime." MALFUNC, \
359 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
360 : goto bailout; \
361 : } \
362 : off2 = b2->hseqbase; \
363 : INIT_SRC2(2); \
364 : INIT_OUTPUT(n); \
365 : if (ci2.tpe == cand_dense) { \
366 : for (BUN i = 0; i < ci2.ncand; i++) { \
367 : oid p2 = (canditer_next_dense(&ci2) - off2); \
368 : FUNC_CALL(FUNC, res, src1, GET_NEXT_SRC2(2, p2)); \
369 : APPEND_NEXT(MALFUNC); \
370 : nils |= is_##OUTTYPE##_nil(res); \
371 : } \
372 : } else { \
373 : for (BUN i = 0; i < ci2.ncand; i++) { \
374 : oid p2 = (canditer_next(&ci2) - off2); \
375 : FUNC_CALL(FUNC, res, src1, GET_NEXT_SRC2(2, p2)); \
376 : APPEND_NEXT(MALFUNC); \
377 : nils |= is_##OUTTYPE##_nil(res); \
378 : } \
379 : } \
380 : BATsetcount(bn, ci2.ncand); \
381 : bn->tnonil = !nils; \
382 : bn->tnil = nils; \
383 : bn->tsorted = ci2.ncand < 2; \
384 : bn->trevsorted = ci2.ncand < 2; \
385 : bn->tkey = ci2.ncand < 2; \
386 : bailout: \
387 : CLEAR_EXTRA_MULTI(res); \
388 : if (b2) { \
389 : bat_iterator_end(&b2i); \
390 : BBPunfix(b2->batCacheid); \
391 : } \
392 : BBPreclaim(s2); \
393 : if (bn) { \
394 : if (msg) \
395 : BBPreclaim(bn); \
396 : else { \
397 : *ret = bn->batCacheid; \
398 : BBPkeepref(bn); \
399 : } \
400 : } \
401 : return msg; \
402 : } \
403 : static str \
404 : NAME##_bulk_p2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
405 : { \
406 : str msg = MAL_SUCCEED; \
407 : BAT *b1 = NULL, *s1 = NULL, *bn = NULL; \
408 : oid off1; \
409 : struct canditer ci1 = {0}; \
410 : bool nils = false; \
411 : bat *ret = getArgReference_bat(stk, pci, 0), \
412 : *bid1 = getArgReference_bat(stk, pci, 1), \
413 : *sid1 = pci->argc == 4 ? getArgReference_bat(stk, pci, 3) : NULL; \
414 : BATiter b1i; \
415 : DEC_SRC1(INTYPE1, 1); \
416 : const INTYPE2 src2 = *(INTYPE2*)getArgReference(stk, pci, 2); \
417 : DEC_OUTPUT(OUTTYPE, n); \
418 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
419 : \
420 : (void) cntxt; \
421 : (void) mb; \
422 : if ((b1 = BATdescriptor(*bid1)) == NULL) { \
423 : msg = createException(MAL, "batmtime." MALFUNC, \
424 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
425 : goto bailout; \
426 : } \
427 : b1i = bat_iterator(b1); \
428 : if (sid1 && !is_bat_nil(*sid1) && (s1 = BATdescriptor(*sid1)) == NULL) { \
429 : msg = createException(MAL, "batmtime." MALFUNC, \
430 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
431 : goto bailout; \
432 : } \
433 : canditer_init(&ci1, b1, s1); \
434 : if ((bn = COLnew(ci1.hseq, TYPE_##OUTTYPE, ci1.ncand, TRANSIENT)) == NULL) { \
435 : msg = createException(MAL, "batmtime." MALFUNC, \
436 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
437 : goto bailout; \
438 : } \
439 : off1 = b1->hseqbase; \
440 : INIT_SRC1(1); \
441 : INIT_OUTPUT(n); \
442 : if (ci1.tpe == cand_dense) { \
443 : for (BUN i = 0; i < ci1.ncand; i++) { \
444 : oid p1 = (canditer_next_dense(&ci1) - off1); \
445 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), src2); \
446 : APPEND_NEXT(MALFUNC); \
447 : nils |= is_##OUTTYPE##_nil(res); \
448 : } \
449 : } else { \
450 : for (BUN i = 0; i < ci1.ncand; i++) { \
451 : oid p1 = (canditer_next(&ci1) - off1); \
452 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), src2); \
453 : APPEND_NEXT(MALFUNC); \
454 : nils |= is_##OUTTYPE##_nil(res); \
455 : } \
456 : } \
457 : BATsetcount(bn, ci1.ncand); \
458 : bn->tnonil = !nils; \
459 : bn->tnil = nils; \
460 : bn->tsorted = ci1.ncand < 2; \
461 : bn->trevsorted = ci1.ncand < 2; \
462 : bn->tkey = ci1.ncand < 2; \
463 : bailout: \
464 : CLEAR_EXTRA_MULTI(res); \
465 : if (b1) { \
466 : bat_iterator_end(&b1i); \
467 : BBPunfix(b1->batCacheid); \
468 : } \
469 : BBPreclaim(s1); \
470 : if (bn) { \
471 : if (msg) \
472 : BBPreclaim(bn); \
473 : else { \
474 : *ret = bn->batCacheid; \
475 : BBPkeepref(bn); \
476 : } \
477 : } \
478 : return msg; \
479 : }
480 :
481 : #define func2_noexcept(FUNC, RET, PARAM1, PARAM2) RET = FUNC(PARAM1, PARAM2)
482 : #define func2_except(FUNC, RET, PARAM1, PARAM2) msg = FUNC(&RET, PARAM1, PARAM2); if (msg) break
483 :
484 : #define func3(NAME, MALFUNC, \
485 : INTYPE1, INTYPE2, OUTTYPE, FUNC, FUNC_CALL, \
486 : DEC_SRC1, DEC_SRC2, DEC_OUTPUT, DEC_EXTRA, \
487 : INIT_SRC1, INIT_SRC2, INIT_OUTPUT, \
488 : GET_NEXT_SRC1, GET_NEXT_SRC2, \
489 : APPEND_NEXT, CLEAR_EXTRA_SINGLE, CLEAR_EXTRA_MULTI) \
490 : static str \
491 : NAME(OUTTYPE *ret, const INTYPE1 *v1, const INTYPE2 *v2, const lng *extra) \
492 : { \
493 : str msg = MAL_SUCCEED; \
494 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
495 : \
496 : do { \
497 : FUNC_CALL(FUNC, res, *v1, *v2, *extra); \
498 : } while (0); \
499 : CLEAR_EXTRA_SINGLE(MALFUNC); \
500 : return msg; \
501 : } \
502 : static str \
503 : NAME##_bulk(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
504 : { \
505 : str msg = MAL_SUCCEED; \
506 : BAT *b1 = NULL, *b2 = NULL, *s1 = NULL, *s2 = NULL, *bn = NULL; \
507 : oid off1, off2; \
508 : struct canditer ci1 = {0}, ci2 = {0}; \
509 : bool nils = false; \
510 : bat *ret = getArgReference_bat(stk, pci, 0), \
511 : *bid1 = getArgReference_bat(stk, pci, 1), \
512 : *bid2 = getArgReference_bat(stk, pci, 2), \
513 : *sid1 = pci->argc == 6 ? getArgReference_bat(stk, pci, 3) : NULL, \
514 : *sid2 = pci->argc == 6 ? getArgReference_bat(stk, pci, 4) : NULL; \
515 : lng *extra = getArgReference_lng(stk, pci, pci->argc-1); \
516 : BATiter b1i, b2i = (BATiter){ .vh = NULL }; \
517 : DEC_SRC1(INTYPE1, 1); \
518 : DEC_SRC2(INTYPE2, 2); \
519 : DEC_OUTPUT(OUTTYPE, n); \
520 : \
521 : (void) cntxt; \
522 : (void) mb; \
523 : b1 = BATdescriptor(*bid1); \
524 : b2 = BATdescriptor(*bid2); \
525 : b1i = bat_iterator(b1); \
526 : b2i = bat_iterator(b2); \
527 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
528 : if (b1 == NULL || b2 == NULL) { \
529 : msg = createException(MAL, "batmtime." MALFUNC, \
530 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
531 : goto bailout; \
532 : } \
533 : if (sid1 && !is_bat_nil(*sid1) && (s1 = BATdescriptor(*sid1)) == NULL) { \
534 : msg = createException(MAL, "batmtime." MALFUNC, \
535 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
536 : goto bailout; \
537 : } \
538 : if (sid2 && !is_bat_nil(*sid2) && (s2 = BATdescriptor(*sid2)) == NULL) { \
539 : msg = createException(MAL, "batmtime." MALFUNC, \
540 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
541 : goto bailout; \
542 : } \
543 : canditer_init(&ci1, b1, s1); \
544 : canditer_init(&ci2, b2, s2); \
545 : if (ci2.ncand != ci1.ncand || ci1.hseq != ci2.hseq) { \
546 : msg = createException(MAL, "batmtime." MALFUNC, \
547 : "inputs not the same size"); \
548 : goto bailout; \
549 : } \
550 : if ((bn = COLnew(ci1.hseq, TYPE_##OUTTYPE, ci1.ncand, TRANSIENT)) == NULL) { \
551 : msg = createException(MAL, "batmtime." MALFUNC, \
552 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
553 : goto bailout; \
554 : } \
555 : off1 = b1->hseqbase; \
556 : off2 = b2->hseqbase; \
557 : INIT_SRC1(1); \
558 : INIT_SRC2(2); \
559 : INIT_OUTPUT(n); \
560 : if (ci1.tpe == cand_dense && ci2.tpe == cand_dense) { \
561 : for (BUN i = 0; i < ci1.ncand; i++) { \
562 : oid p1 = (canditer_next_dense(&ci1) - off1); \
563 : oid p2 = (canditer_next_dense(&ci2) - off2); \
564 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), GET_NEXT_SRC2(2, p2), *extra); \
565 : APPEND_NEXT(MALFUNC); \
566 : nils |= is_##OUTTYPE##_nil(res); \
567 : } \
568 : } else { \
569 : for (BUN i = 0; i < ci1.ncand; i++) { \
570 : oid p1 = (canditer_next(&ci1) - off1); \
571 : oid p2 = (canditer_next(&ci2) - off2); \
572 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), GET_NEXT_SRC2(2, p2), *extra); \
573 : APPEND_NEXT(MALFUNC); \
574 : nils |= is_##OUTTYPE##_nil(res); \
575 : } \
576 : } \
577 : BATsetcount(bn, ci1.ncand); \
578 : bn->tnonil = !nils; \
579 : bn->tnil = nils; \
580 : bn->tsorted = ci1.ncand < 2; \
581 : bn->trevsorted = ci1.ncand < 2; \
582 : bn->tkey = ci1.ncand < 2; \
583 : bailout: \
584 : CLEAR_EXTRA_MULTI(res); \
585 : bat_iterator_end(&b1i); \
586 : bat_iterator_end(&b2i); \
587 : BBPreclaim(b1); \
588 : BBPreclaim(b2); \
589 : BBPreclaim(s1); \
590 : BBPreclaim(s2); \
591 : if (bn) { \
592 : if (msg) \
593 : BBPreclaim(bn); \
594 : else { \
595 : *ret = bn->batCacheid; \
596 : BBPkeepref(bn); \
597 : } \
598 : } \
599 : return msg; \
600 : } \
601 : static str \
602 : NAME##_bulk_p1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
603 : { \
604 : str msg = MAL_SUCCEED; \
605 : BAT *b2 = NULL, *s2 = NULL, *bn = NULL; \
606 : oid off2; \
607 : struct canditer ci2 = {0}; \
608 : bool nils = false; \
609 : bat *ret = getArgReference_bat(stk, pci, 0), \
610 : *bid2 = getArgReference_bat(stk, pci, 2), \
611 : *sid2 = pci->argc == 5 ? getArgReference_bat(stk, pci, 4) : NULL; \
612 : lng *extra = getArgReference_lng(stk, pci, 3); \
613 : const INTYPE1 src1 = *(INTYPE1*)getArgReference(stk, pci, 1); \
614 : BATiter b2i; \
615 : DEC_SRC2(INTYPE2, 2); \
616 : DEC_OUTPUT(OUTTYPE, n); \
617 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
618 : \
619 : (void) cntxt; \
620 : (void) mb; \
621 : if ((b2 = BATdescriptor(*bid2)) == NULL) { \
622 : throw(MAL, "batmtime." MALFUNC, \
623 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
624 : } \
625 : b2i = bat_iterator(b2); \
626 : if (sid2 && !is_bat_nil(*sid2) && (s2 = BATdescriptor(*sid2)) == NULL) { \
627 : msg = createException(MAL, "batmtime." MALFUNC, \
628 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
629 : goto bailout; \
630 : } \
631 : canditer_init(&ci2, b2, s2); \
632 : if ((bn = COLnew(ci2.hseq, TYPE_##OUTTYPE, ci2.ncand, TRANSIENT)) == NULL) { \
633 : msg = createException(MAL, "batmtime." MALFUNC, \
634 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
635 : goto bailout; \
636 : } \
637 : off2 = b2->hseqbase; \
638 : INIT_SRC2(2); \
639 : INIT_OUTPUT(n); \
640 : if (ci2.tpe == cand_dense) { \
641 : for (BUN i = 0; i < ci2.ncand; i++) { \
642 : oid p2 = (canditer_next_dense(&ci2) - off2); \
643 : FUNC_CALL(FUNC, res, src1, GET_NEXT_SRC2(2, p2), *extra); \
644 : APPEND_NEXT(MALFUNC); \
645 : nils |= is_##OUTTYPE##_nil(res); \
646 : } \
647 : } else { \
648 : for (BUN i = 0; i < ci2.ncand; i++) { \
649 : oid p2 = (canditer_next(&ci2) - off2); \
650 : FUNC_CALL(FUNC, res, src1, GET_NEXT_SRC2(2, p2), *extra); \
651 : APPEND_NEXT(MALFUNC); \
652 : nils |= is_##OUTTYPE##_nil(res); \
653 : } \
654 : } \
655 : BATsetcount(bn, ci2.ncand); \
656 : bn->tnonil = !nils; \
657 : bn->tnil = nils; \
658 : bn->tsorted = ci2.ncand < 2; \
659 : bn->trevsorted = ci2.ncand < 2; \
660 : bn->tkey = ci2.ncand < 2; \
661 : bailout: \
662 : CLEAR_EXTRA_MULTI(res); \
663 : if (b2) { \
664 : bat_iterator_end(&b2i); \
665 : BBPunfix(b2->batCacheid); \
666 : } \
667 : BBPreclaim(s2); \
668 : if (bn) { \
669 : if (msg) \
670 : BBPreclaim(bn); \
671 : else { \
672 : *ret = bn->batCacheid; \
673 : BBPkeepref(bn); \
674 : } \
675 : } \
676 : return msg; \
677 : } \
678 : static str \
679 : NAME##_bulk_p2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
680 : { \
681 : str msg = MAL_SUCCEED; \
682 : BAT *b1 = NULL, *s1 = NULL, *bn = NULL; \
683 : oid off1; \
684 : struct canditer ci1 = {0}; \
685 : bool nils = false; \
686 : bat *ret = getArgReference_bat(stk, pci, 0), \
687 : *bid1 = getArgReference_bat(stk, pci, 1), \
688 : *sid1 = pci->argc == 5 ? getArgReference_bat(stk, pci, 4) : NULL; \
689 : lng *extra = getArgReference_lng(stk, pci, 3); \
690 : BATiter b1i; \
691 : DEC_SRC1(INTYPE1, 1); \
692 : const INTYPE2 src2 = *(INTYPE2*)getArgReference(stk, pci, 2); \
693 : DEC_OUTPUT(OUTTYPE, n); \
694 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
695 : \
696 : (void) cntxt; \
697 : (void) mb; \
698 : if ((b1 = BATdescriptor(*bid1)) == NULL) { \
699 : msg = createException(MAL, "batmtime." MALFUNC, \
700 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
701 : goto bailout; \
702 : } \
703 : b1i = bat_iterator(b1); \
704 : if (sid1 && !is_bat_nil(*sid1) && (s1 = BATdescriptor(*sid1)) == NULL) { \
705 : msg = createException(MAL, "batmtime." MALFUNC, \
706 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
707 : goto bailout; \
708 : } \
709 : canditer_init(&ci1, b1, s1); \
710 : if ((bn = COLnew(ci1.hseq, TYPE_##OUTTYPE, ci1.ncand, TRANSIENT)) == NULL) { \
711 : msg = createException(MAL, "batmtime." MALFUNC, \
712 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
713 : goto bailout; \
714 : } \
715 : off1 = b1->hseqbase; \
716 : INIT_SRC1(1); \
717 : INIT_OUTPUT(n); \
718 : if (ci1.tpe == cand_dense) { \
719 : for (BUN i = 0; i < ci1.ncand; i++) { \
720 : oid p1 = (canditer_next_dense(&ci1) - off1); \
721 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), src2, *extra); \
722 : APPEND_NEXT(MALFUNC); \
723 : nils |= is_##OUTTYPE##_nil(res); \
724 : } \
725 : } else { \
726 : for (BUN i = 0; i < ci1.ncand; i++) { \
727 : oid p1 = (canditer_next(&ci1) - off1); \
728 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), src2, *extra); \
729 : APPEND_NEXT(MALFUNC); \
730 : nils |= is_##OUTTYPE##_nil(res); \
731 : } \
732 : } \
733 : BATsetcount(bn, ci1.ncand); \
734 : bn->tnonil = !nils; \
735 : bn->tnil = nils; \
736 : bn->tsorted = ci1.ncand < 2; \
737 : bn->trevsorted = ci1.ncand < 2; \
738 : bn->tkey = ci1.ncand < 2; \
739 : bailout: \
740 : CLEAR_EXTRA_MULTI(res); \
741 : if (b1) { \
742 : bat_iterator_end(&b1i); \
743 : BBPunfix(b1->batCacheid); \
744 : } \
745 : BBPreclaim(s1); \
746 : if (bn) { \
747 : if (msg) \
748 : BBPreclaim(bn); \
749 : else { \
750 : *ret = bn->batCacheid; \
751 : BBPkeepref(bn); \
752 : } \
753 : } \
754 : return msg; \
755 : }
756 :
757 : #define func3_noexcept(FUNC, RET, PARAM1, PARAM2, E) RET = FUNC(PARAM1, PARAM2, E)
758 : #define func3_except(FUNC, RET, PARAM1, PARAM2, E) msg = FUNC(&RET, PARAM1, PARAM2, E); if (msg) break
759 :
760 75 : func2(MTIMEdate_diff, "diff",
761 : date, date, lng, date_diff_imp, func2_noexcept,
762 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
763 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
764 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
765 35 : func2(MTIMEdaytime_diff_msec, "diff",
766 : daytime, daytime, lng, daytime_diff, func2_noexcept,
767 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
768 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
769 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
770 28 : func2(MTIMEdate_sub_msec_interval, "date_sub_msec_interval",
771 : date, lng, date, date_sub_msec_interval, func2_except,
772 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
773 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
774 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
775 2260 : func2(MTIMEdate_add_msec_interval, "date_add_msec_interval",
776 : date, lng, date, date_add_msec_interval, func2_except,
777 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
778 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
779 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
780 471 : func2(MTIMEtimestamp_sub_msec_interval, "timestamp_sub_msec_interval",
781 : timestamp, lng, timestamp, timestamp_sub_msec_interval, func2_except,
782 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
783 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
784 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
785 636 : func2(MTIMEtimestamp_add_msec_interval, "timestamp_add_msec_interval",
786 : timestamp, lng, timestamp, timestamp_add_msec_interval, func2_except,
787 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
788 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
789 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
790 2 : func2(MTIMEodbc_timestamp_add_msec_interval_time,
791 : "odbc_timestamp_add_msec_time", daytime, lng, timestamp,
792 : odbc_timestamp_add_msec_interval_time, func2_except, DEC_VAR_R, DEC_VAR_R,
793 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
794 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
795 0 : func2(MTIMEodbc_timestamp_add_month_interval_time,
796 : "odbc_timestamp_add_month_time", daytime, int, timestamp,
797 : odbc_timestamp_add_month_interval_time, func2_except, DEC_VAR_R,
798 : DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT,
799 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
800 2 : func2(MTIMEodbc_timestamp_add_msec_interval_date,
801 : "odbc_timestamp_add_msec_date", date, lng, timestamp,
802 : odbc_timestamp_add_msec_interval_date, func2_except, DEC_VAR_R, DEC_VAR_R,
803 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
804 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
805 6 : func2(MTIMEtimestamp_sub_month_interval, "timestamp_sub_month_interval",
806 : timestamp, int, timestamp, timestamp_sub_month_interval, func2_except,
807 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN,
808 : INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE,
809 : CLEAR_NOTHING)
810 8 : func2(MTIMEtimestamp_add_month_interval, "timestamp_add_month_interval",
811 : timestamp, int, timestamp, timestamp_add_month_interval, func2_except,
812 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN,
813 : INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE,
814 : CLEAR_NOTHING)
815 28 : func2(MTIMEtime_sub_msec_interval, "time_sub_msec_interval", daytime, lng,
816 : daytime, time_sub_msec_interval, func2_noexcept, DEC_VAR_R, DEC_VAR_R,
817 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
818 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
819 31 : func2(MTIMEtime_add_msec_interval, "time_add_msec_interval", daytime, lng,
820 : daytime, time_add_msec_interval, func2_noexcept, DEC_VAR_R, DEC_VAR_R,
821 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
822 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
823 7 : func2(MTIMEdate_submonths, "date_sub_month_interval", date, int, date, date_submonths,
824 : func2_except, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN,
825 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
826 : FINISH_INT_SINGLE, CLEAR_NOTHING)
827 15 : func2(MTIMEdate_addmonths, "addmonths", date, int, date, date_addmonths,
828 : func2_except, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN,
829 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
830 : FINISH_INT_SINGLE, CLEAR_NOTHING)
831 27 : func1(MTIMEdate_extract_century, "century", date, int, date_century,
832 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
833 : GET_NEXT_VAR)
834 8 : func1(MTIMEdate_extract_decade, "decade", date, int, date_decade,
835 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
836 : GET_NEXT_VAR)
837 1607492 : func1(MTIMEdate_extract_year, "year", date, int, date_year, COPYFLAGS,
838 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
839 : GET_NEXT_VAR)
840 36 : func1(MTIMEdate_extract_quarter, "quarter", date, bte, date_quarter,
841 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
842 : GET_NEXT_VAR)
843 1400210 : func1(MTIMEdate_extract_month, "month", date, bte, date_month, SETFLAGS,
844 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
845 : GET_NEXT_VAR)
846 1700109 : func1(MTIMEdate_extract_day, "day", date, bte, date_day, SETFLAGS,
847 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
848 : GET_NEXT_VAR)
849 40 : func1(MTIMEdate_extract_dayofyear, "dayofyear", date, sht, date_dayofyear,
850 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
851 : GET_NEXT_VAR)
852 147 : func1(MTIMEdate_extract_weekofyear, "weekofyear", date, bte,
853 : date_weekofyear, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
854 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
855 1 : func1(MTIMEdate_extract_usweekofyear, "usweekofyear", date, bte,
856 : date_usweekofyear, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
857 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
858 44 : func1(MTIMEdate_extract_dayofweek, "dayofweek", date, bte, date_dayofweek,
859 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
860 : GET_NEXT_VAR)
861 17 : func1(MTIMEdate_extract_epoch_ms, "epoch_ms", date, lng,
862 : date_to_msec_since_epoch, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
863 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
864 1700049 : func1(MTIMEdaytime_extract_hours, "hours", daytime, bte, daytime_hour,
865 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
866 : GET_NEXT_VAR)
867 1600052 : func1(MTIMEdaytime_extract_minutes, "minutes", daytime, bte,
868 : daytime_min, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN,
869 : INIT_VAROUT, GET_NEXT_VAR)
870 1400044 : func1(MTIMEdaytime_extract_sql_seconds, "sql_seconds", daytime, int,
871 : daytime_sec_usec, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
872 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
873 9 : func1(MTIMEdaytime_extract_epoch_ms, "epoch_ms", daytime, lng,
874 : daytime_to_msec_since_epoch, COPYFLAGS, func1_noexcept, DEC_VAR_R,
875 : DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
876 187 : func2(MTIMEtimestamp_diff_msec, "diff", timestamp, timestamp, lng, TSDIFF,
877 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
878 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
879 : FINISH_INT_SINGLE, CLEAR_NOTHING)
880 19 : func1(MTIMEtimestamp_century, "century", timestamp, int,
881 : timestamp_century, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
882 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
883 0 : func1(MTIMEtimestamp_decade, "decade", timestamp, int,
884 : timestamp_decade, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
885 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
886 1700080 : func1(MTIMEtimestamp_year, "year", timestamp, int, timestamp_year,
887 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
888 : GET_NEXT_VAR)
889 40 : func1(MTIMEtimestamp_quarter, "quarter", timestamp, bte,
890 : timestamp_quarter, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
891 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
892 1300551 : func1(MTIMEtimestamp_month, "month", timestamp, bte, timestamp_month,
893 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
894 : GET_NEXT_VAR)
895 1600058 : func1(MTIMEtimestamp_day, "day", timestamp, bte, timestamp_day,
896 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
897 : GET_NEXT_VAR)
898 1600128 : func1(MTIMEtimestamp_hours, "hours", timestamp, bte, timestamp_hours,
899 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
900 : GET_NEXT_VAR)
901 1800128 : func1(MTIMEtimestamp_minutes, "minutes", timestamp, bte,
902 : timestamp_minutes, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
903 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
904 1500144 : func1(MTIMEtimestamp_sql_seconds, "sql_seconds", timestamp, int,
905 : timestamp_extract_usecond, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
906 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
907 19 : func1(MTIMEtimestamp_extract_epoch_ms, "epoch_ms", timestamp, lng,
908 : timestamp_to_msec_since_epoch, COPYFLAGS, func1_noexcept, DEC_VAR_R,
909 : DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
910 1 : func1(MTIMEsql_year, "year", int, int, sql_year, COPYFLAGS, func1_noexcept,
911 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
912 0 : func1(MTIMEsql_month, "month", int, int, sql_month, SETFLAGS,
913 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
914 : GET_NEXT_VAR)
915 5 : func1(MTIMEsql_day, "day", lng, lng, sql_day, COPYFLAGS, func1_noexcept,
916 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
917 2 : func1(MTIMEsql_hours, "hours", lng, int, sql_hours, SETFLAGS,
918 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
919 : GET_NEXT_VAR)
920 5 : func1(MTIMEsql_minutes, "minutes", lng, int, sql_minutes, SETFLAGS,
921 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
922 : GET_NEXT_VAR)
923 3 : func1(MTIMEsql_seconds, "seconds", lng, int, sql_seconds, SETFLAGS,
924 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
925 : GET_NEXT_VAR)
926 2 : func1(MTIMEmsec_extract_epoch_ms, "epoch_ms", lng, lng, msec_since_epoch,
927 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
928 : GET_NEXT_VAR)
929 : static inline str
930 19 : date_fromstr_func(date *ret, const char *s)
931 : {
932 19 : if (date_fromstr(s, &(size_t) { sizeof(date) }, &ret, false) < 0) {
933 9 : if (strNil(s))
934 9 : throw(MAL, "mtime.date_fromstr",
935 : SQLSTATE(42000) "Conversion of NULL string to date failed");
936 9 : throw(MAL, "mtime.date_fromstr",
937 : SQLSTATE(22007) "Conversion of string '%s' to date failed", s);
938 : }
939 10 : return MAL_SUCCEED;
940 : }
941 :
942 23 : func1(MTIMEdate_fromstr, "date", char * const, date,
943 : date_fromstr_func, SETFLAGS, func1_except,
944 : DEC_ITER, DEC_VAR_R, INIT_ITERIN, INIT_VAROUT, GET_NEXT_ITER)
945 : #define date_date(m) m
946 89 : func1(MTIMEdate_date, "date", date, date,
947 : date_date, COPYFLAGS, func1_noexcept,
948 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
949 189 : func1(MTIMEtimestamp_extract_date, "date", timestamp, date,
950 : timestamp_date, COPYFLAGS, func1_noexcept,
951 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
952 :
953 : static inline date
954 69 : timestamp_tz_date(timestamp ts, lng tz_msec)
955 : {
956 69 : ts = timestamp_add_usec(ts, tz_msec * LL_CONSTANT(1000));
957 69 : return timestamp_date(ts);
958 : }
959 :
960 80 : func2(MTIMEtimestamp_tz_extract_date, "date",
961 : timestamp, lng, date, timestamp_tz_date, func2_noexcept,
962 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
963 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
964 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
965 :
966 : static inline str
967 0 : timestamp_fromstr_func(timestamp *ret, const char *s)
968 : {
969 0 : if (timestamp_fromstr(s, &(size_t) { sizeof(timestamp) }, &ret, false) < 0)
970 0 : throw(MAL, "mtime.timestamp_fromstr", GDK_EXCEPTION);
971 0 : return MAL_SUCCEED;
972 : }
973 :
974 0 : func1(MTIMEtimestamp_fromstr, "timestamp", char * const, timestamp,
975 : timestamp_fromstr_func, SETFLAGS, func1_except,
976 : DEC_ITER, DEC_VAR_R, INIT_ITERIN, INIT_VAROUT, GET_NEXT_ITER)
977 : #define timestamp_timestamp(m) m
978 0 : func1(MTIMEtimestamp_timestamp, "timestamp", timestamp, timestamp,
979 : timestamp_timestamp, COPYFLAGS, func1_noexcept,
980 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
981 : #define mkts(dt) timestamp_create(dt, daytime_create(0, 0, 0, 0))
982 0 : func1(MTIMEtimestamp_fromdate, "timestamp", date, timestamp,
983 : mkts, COPYFLAGS, func1_noexcept,
984 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
985 : #define seconds_since_epoch(t) is_timestamp_nil(t) ? int_nil : (int) (timestamp_diff(t, unixepoch) / 1000000);
986 159 : func1(MTIMEseconds_since_epoch, "epoch", timestamp, int,
987 : seconds_since_epoch, COPYFLAGS, func1_noexcept,
988 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
989 : #define mktsfromsec(sec) (is_int_nil(sec) ? \
990 : timestamp_nil : \
991 : timestamp_add_usec(unixepoch, \
992 : (sec) * LL_CONSTANT(1000000)))
993 : #define mktsfrommsec(msec) (is_lng_nil(msec) ? \
994 : timestamp_nil : \
995 : timestamp_add_usec(unixepoch, \
996 : (msec) * LL_CONSTANT(1000)))
997 : /* TODO later I have to remove this call */
998 6 : func1(MTIMEtimestamp_fromsecond_epoch, "epoch", int,
999 : timestamp, mktsfromsec, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
1000 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
1001 0 : func1(MTIMEtimestamp_fromsecond, "timestamp", int, timestamp,
1002 : mktsfromsec, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN,
1003 : INIT_VAROUT, GET_NEXT_VAR)
1004 : /* TODO later I have to remove this call */
1005 56 : func1(MTIMEtimestamp_frommsec_epoch, "epoch", lng, timestamp,
1006 : mktsfrommsec, COPYFLAGS, func1_noexcept,
1007 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
1008 0 : func1(MTIMEtimestamp_frommsec, "timestamp", lng, timestamp,
1009 : mktsfrommsec, COPYFLAGS, func1_noexcept,
1010 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
1011 : static inline str
1012 3 : daytime_fromstr_func(daytime *ret, const char *s)
1013 : {
1014 3 : if (daytime_fromstr(s, &(size_t) { sizeof(daytime) }, &ret, false) < 0)
1015 0 : throw(MAL, "mtime.daytime_fromstr", GDK_EXCEPTION);
1016 3 : return MAL_SUCCEED;
1017 : }
1018 :
1019 3 : func1(MTIMEdaytime_fromstr, "daytime", char * const, daytime,
1020 : daytime_fromstr_func, SETFLAGS, func1_except,
1021 : DEC_ITER, DEC_VAR_R, INIT_ITERIN, INIT_VAROUT, GET_NEXT_ITER)
1022 : #define daytime_daytime(m) m
1023 0 : func1(MTIMEdaytime_daytime, "daytime", daytime, daytime,
1024 : daytime_daytime, COPYFLAGS, func1_noexcept,
1025 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
1026 : static inline str
1027 0 : daytime_fromseconds(daytime *ret, lng secs)
1028 : {
1029 0 : if (is_lng_nil(secs))
1030 0 : *ret = daytime_nil;
1031 0 : else if (secs < 0 || secs >= 24 * 60 * 60)
1032 0 : throw(MAL, "mtime.daytime_fromseconds",
1033 : SQLSTATE(42000) ILLEGAL_ARGUMENT);
1034 : else
1035 0 : *ret = (daytime) (secs * 1000000);
1036 : return MAL_SUCCEED;
1037 : }
1038 :
1039 0 : func1(MTIMEdaytime_fromseconds, "daytime", lng, daytime,
1040 : daytime_fromseconds, COPYFLAGS, func1_except,
1041 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
1042 0 : func1(MTIMEtimestamp_extract_daytime, "daytime", timestamp,
1043 : daytime, timestamp_daytime, SETFLAGS, func1_noexcept, DEC_VAR_R,
1044 : DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
1045 : /* return current system time zone offset in seconds East of Greenwich */
1046 : static int
1047 0 : local_timezone(int *isdstp)
1048 : {
1049 0 : int tzone = 0;
1050 0 : int isdst = -1;
1051 :
1052 : #if defined(_MSC_VER)
1053 : DYNAMIC_TIME_ZONE_INFORMATION tzinf;
1054 :
1055 : /* documentation says: UTC = localtime + Bias (in minutes),
1056 : * but experimentation during DST period says, UTC = localtime
1057 : * + Bias + DaylightBias, and presumably during non DST
1058 : * period, UTC = localtime + Bias */
1059 : switch (GetDynamicTimeZoneInformation(&tzinf)) {
1060 : case TIME_ZONE_ID_STANDARD: /* using standard time */
1061 : case TIME_ZONE_ID_UNKNOWN: /* no daylight saving time in this zone */
1062 : isdst = 0;
1063 : tzone = -(int) tzinf.Bias * 60;
1064 : break;
1065 : case TIME_ZONE_ID_DAYLIGHT: /* using daylight saving time */
1066 : isdst = 1;
1067 : tzone = -(int) (tzinf.Bias + tzinf.DaylightBias) * 60;
1068 : break;
1069 : default: /* aka TIME_ZONE_ID_INVALID */
1070 : /* call failed, we don't know the time zone */
1071 : tzone = 0;
1072 : break;
1073 : }
1074 : #elif defined(HAVE_TM_GMTOFF)
1075 0 : time_t t;
1076 0 : struct tm tm = (struct tm) { 0 };
1077 :
1078 0 : if ((t = time(NULL)) != (time_t) - 1 && localtime_r(&t, &tm)) {
1079 0 : tzone = (int) tm.tm_gmtoff;
1080 0 : isdst = tm.tm_isdst;
1081 : }
1082 : #else
1083 : time_t t;
1084 : struct tm tm = (struct tm) { 0 };
1085 :
1086 : if ((t = time(NULL)) != (time_t) - 1 && gmtime_r(&t, &tm)) {
1087 : timestamp lt, gt;
1088 : gt = timestamp_create(date_create(tm.tm_year + 1900,
1089 : tm.tm_mon + 1,
1090 : tm.tm_mday),
1091 : daytime_create(tm.tm_hour,
1092 : tm.tm_min,
1093 : tm.tm_sec == 60 ? 59 : tm.tm_sec,
1094 : 0));
1095 : if (localtime_r(&t, &tm)) {
1096 : isdst = tm.tm_isdst;
1097 : lt = timestamp_create(date_create(tm.tm_year + 1900,
1098 : tm.tm_mon + 1,
1099 : tm.tm_mday),
1100 : daytime_create(tm.tm_hour,
1101 : tm.tm_min,
1102 : tm.tm_sec == 60 ? 59 : tm.tm_sec, 0));
1103 : tzone = (int) (timestamp_diff(lt, gt) / 1000000);
1104 : }
1105 : }
1106 : #endif
1107 0 : if (isdstp)
1108 0 : *isdstp = isdst;
1109 0 : return tzone;
1110 : }
1111 :
1112 : static str
1113 0 : MTIMElocal_timezone_msec(lng *ret)
1114 : {
1115 0 : int tzone = local_timezone(NULL);
1116 0 : *ret = (lng) tzone *1000;
1117 0 : return MAL_SUCCEED;
1118 : }
1119 :
1120 : static str
1121 74 : timestamp_to_str_withtz(str *buf, const timestamp *d, const char *const *format, const char *type,
1122 : const char *malfunc, long gmtoff)
1123 : {
1124 74 : date dt;
1125 74 : daytime t;
1126 74 : struct tm tm;
1127 :
1128 74 : if (is_timestamp_nil(*d) || strNil(*format)) {
1129 4 : strcpy(*buf, str_nil);
1130 4 : return MAL_SUCCEED;
1131 : }
1132 70 : dt = timestamp_date(*d);
1133 70 : t = timestamp_daytime(*d);
1134 70 : tm = (struct tm) {
1135 70 : .tm_year = date_year(dt) - 1900,
1136 70 : .tm_mon = date_month(dt) - 1,
1137 70 : .tm_mday = date_day(dt),
1138 70 : .tm_wday = date_dayofweek(dt) % 7,
1139 70 : .tm_yday = date_dayofyear(dt) - 1,
1140 70 : .tm_hour = daytime_hour(t),
1141 70 : .tm_min = daytime_min(t),
1142 70 : .tm_sec = daytime_sec(t),
1143 : #if defined(HAVE_TM_GMTOFF)
1144 : .tm_gmtoff = gmtoff,
1145 : #endif
1146 : };
1147 70 : if (strftime(*buf, MTIME_STR_BUFFER_LENGTH, *format, &tm) == 0)
1148 0 : throw(MAL, malfunc, "cannot convert %s", type);
1149 : return MAL_SUCCEED;
1150 : }
1151 :
1152 : static str
1153 43 : timestamp_to_str(str *buf, const timestamp *d, const char *const *format, const char *type,
1154 : const char *malfunc)
1155 : {
1156 43 : return timestamp_to_str_withtz( buf, d, format, type, malfunc, 0);
1157 : }
1158 :
1159 : static str
1160 31 : timestamptz_to_str(str *buf, const timestamp *d, const char *const *format, const char *type,
1161 : const char *malfunc, long gmtoff)
1162 : {
1163 31 : timestamp t = *d;
1164 31 : t = timestamp_add_usec(t, gmtoff * LL_CONSTANT(1000000));
1165 31 : return timestamp_to_str_withtz( buf, &t, format, type, malfunc, gmtoff);
1166 : }
1167 :
1168 :
1169 : static str
1170 250 : str_to_timestamp(timestamp *ret, const char *const *s, const char *const *format, const long gmtoff, const char *type,
1171 : const char *malfunc)
1172 : {
1173 250 : struct tm tm = (struct tm) {
1174 : .tm_isdst = -1,
1175 : .tm_mday = 1,
1176 : #ifdef HAVE_TM_GMTOFF
1177 250 : .tm_gmtoff = (int) gmtoff,
1178 : #endif
1179 : };
1180 250 : int tz = (int) gmtoff;
1181 :
1182 500 : if (strNil(*s) || strNil(*format)) {
1183 0 : *ret = timestamp_nil;
1184 0 : return MAL_SUCCEED;
1185 : }
1186 : #ifdef HAVE_STRPTIME
1187 250 : if (strptime(*s, *format, &tm) == NULL)
1188 : #else
1189 : if (strptime2(*s, *format, &tm, &tz) == NULL)
1190 : #endif
1191 0 : throw(MAL, malfunc,
1192 : "format '%s', doesn't match %s '%s'", *format, type, *s);
1193 500 : *ret = timestamp_create(date_create(tm.tm_year + 1900,
1194 250 : tm.tm_mon + 1,
1195 : tm.tm_mday),
1196 : daytime_create(tm.tm_hour,
1197 : tm.tm_min,
1198 250 : tm.tm_sec == 60 ? 59 : tm.tm_sec,
1199 : 0));
1200 : #ifdef HAVE_TM_GMTOFF
1201 250 : tz = tm.tm_gmtoff;
1202 : #endif
1203 250 : *ret = timestamp_add_usec(*ret, -tz * LL_CONSTANT(1000000));
1204 250 : if (is_timestamp_nil(*ret))
1205 0 : throw(MAL, malfunc, "bad %s '%s'", type, *s);
1206 : return MAL_SUCCEED;
1207 : }
1208 :
1209 : static inline str
1210 208 : str_to_date(date *ret, const char *s, const char *format, lng tz_msec)
1211 : {
1212 208 : str msg = MAL_SUCCEED;
1213 208 : timestamp ts;
1214 208 : (void)tz_msec;
1215 208 : if ((msg = str_to_timestamp(&ts, &s, &format, /*tz_msec/1000*/0, "date",
1216 : "mtime.str_to_date")) != MAL_SUCCEED)
1217 : return msg;
1218 208 : *ret = timestamp_date(ts);
1219 208 : return MAL_SUCCEED;
1220 : }
1221 :
1222 219 : func3(MTIMEstr_to_date, "str_to_date",
1223 : char * const, char * const, date, str_to_date, func3_except,
1224 : DEC_ITER, DEC_ITER, DEC_VAR_R, DEC_INT,
1225 : INIT_ITERIN, INIT_ITERIN, INIT_VAROUT,
1226 : GET_NEXT_ITER, GET_NEXT_ITER,
1227 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1228 :
1229 : static inline str
1230 14 : str_to_time(daytime *ret, const char *s, const char *format, lng tz_msec)
1231 : {
1232 14 : str msg = MAL_SUCCEED;
1233 14 : timestamp ts;
1234 14 : if ((msg = str_to_timestamp(&ts, &s, &format, (long)(tz_msec/1000), "time",
1235 : "mtime.str_to_time")) != MAL_SUCCEED)
1236 : return msg;
1237 14 : *ret = timestamp_daytime(ts);
1238 14 : return MAL_SUCCEED;
1239 : }
1240 :
1241 24 : func3(MTIMEstr_to_time, "str_to_time",
1242 : char * const, char * const, daytime, str_to_time, func3_except,
1243 : DEC_ITER, DEC_ITER, DEC_VAR_R, DEC_INT,
1244 : INIT_ITERIN, INIT_ITERIN, INIT_VAROUT,
1245 : GET_NEXT_ITER, GET_NEXT_ITER,
1246 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1247 :
1248 : static inline str
1249 28 : str_to_timestamp_func(timestamp *ret, const char *s, const char *format, lng tz_msec)
1250 : {
1251 28 : return str_to_timestamp(ret, &s, &format, (long)(tz_msec/1000), "timestamp",
1252 : "mtime.str_to_timestamp");
1253 : }
1254 :
1255 38 : func3(MTIMEstr_to_timestamp, "str_to_timestamp",
1256 : char * const, char * const, timestamp, str_to_timestamp_func, func3_except,
1257 : DEC_ITER, DEC_ITER, DEC_VAR_R, DEC_INT,
1258 : INIT_ITERIN, INIT_ITERIN, INIT_VAROUT,
1259 : GET_NEXT_ITER, GET_NEXT_ITER,
1260 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1261 :
1262 : static inline str
1263 34 : date_to_str(str *ret, date d, const char *format)
1264 : {
1265 34 : timestamp ts = timestamp_create(d, timestamp_daytime(timestamp_current()));
1266 34 : return timestamp_to_str(ret, &ts, &format, "date", "mtime.date_to_str");
1267 : }
1268 :
1269 44 : func2(MTIMEdate_to_str, "date_to_str",
1270 : date, char * const, str, date_to_str, func2_except,
1271 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
1272 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
1273 : GET_NEXT_VAR, GET_NEXT_ITER,
1274 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
1275 :
1276 : static inline str
1277 0 : time_to_str(str *ret, daytime d, const char *format)
1278 : {
1279 0 : timestamp ts = timestamp_create(timestamp_date(timestamp_current()), d);
1280 0 : return timestamp_to_str(ret, &ts, &format, "time", "mtime.time_to_str");
1281 : }
1282 :
1283 0 : func2(MTIMEtime_to_str, "time_to_str",
1284 : daytime, char * const, str, time_to_str, func2_except,
1285 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
1286 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
1287 : GET_NEXT_VAR, GET_NEXT_ITER,
1288 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
1289 :
1290 : static inline str
1291 13 : timetz_to_str(str *ret, daytime d, const char *format, lng tz_msec)
1292 : {
1293 13 : timestamp ts = timestamp_create(timestamp_date(timestamp_current()), d);
1294 13 : return timestamptz_to_str(ret, &ts, &format, "time", "mtime.timetz_to_str", (long)(tz_msec/1000));
1295 : }
1296 26 : func3(MTIMEtimetz_to_str, "timetz_to_str",
1297 : daytime, char * const, str, timetz_to_str, func3_except,
1298 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
1299 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
1300 : GET_NEXT_VAR, GET_NEXT_ITER,
1301 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
1302 :
1303 : static inline str
1304 9 : timestamp_to_str_func(str *ret, timestamp d, const char *format)
1305 : {
1306 18 : return timestamp_to_str(ret, &d, &format, "timestamp", "mtime.timestamp_to_str");
1307 : }
1308 :
1309 15 : func2(MTIMEtimestamp_to_str, "timestamp_to_str",
1310 : timestamp, char * const, str, timestamp_to_str_func, func2_except,
1311 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
1312 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
1313 : GET_NEXT_VAR, GET_NEXT_ITER,
1314 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
1315 :
1316 : static inline str
1317 18 : timestamptz_to_str_func(str *ret, timestamp d, const char *format, lng tz_msec)
1318 : {
1319 18 : return timestamptz_to_str(ret, &d, &format, "timestamp", "mtime.timestamptz_to_str", (long)(tz_msec/1000));
1320 : }
1321 :
1322 33 : func3(MTIMEtimestamptz_to_str, "timestamptz_to_str",
1323 : timestamp, char * const, str, timestamptz_to_str_func, func3_except,
1324 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
1325 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
1326 : GET_NEXT_VAR, GET_NEXT_ITER,
1327 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
1328 :
1329 : static inline lng
1330 5 : timestampdiff_sec(timestamp t1, timestamp t2)
1331 : {
1332 5 : return TSDIFF(t1, t2) / 1000;
1333 : }
1334 :
1335 : static inline lng
1336 1 : timestampdiff_sec_date_timestamp(date d, timestamp ts)
1337 : {
1338 1 : return timestampdiff_sec(timestamp_fromdate(d), ts);
1339 : }
1340 :
1341 : static inline lng
1342 1 : timestampdiff_sec_timestamp_date(timestamp ts, date d)
1343 : {
1344 1 : return timestampdiff_sec(ts, timestamp_fromdate(d));
1345 : }
1346 :
1347 : static inline lng
1348 4 : timestampdiff_min(timestamp t1, timestamp t2)
1349 : {
1350 4 : return TSDIFF(t1, t2) / 1000 / 60;
1351 : }
1352 :
1353 : static inline lng
1354 1 : timestampdiff_min_date_timestamp(date d, timestamp ts)
1355 : {
1356 1 : return timestampdiff_min(timestamp_fromdate(d), ts);
1357 : }
1358 :
1359 : static inline lng
1360 1 : timestampdiff_min_timestamp_date(timestamp ts, date d)
1361 : {
1362 1 : return timestampdiff_min(ts, timestamp_fromdate(d));
1363 : }
1364 :
1365 : static inline lng
1366 4 : timestampdiff_hour(timestamp t1, timestamp t2)
1367 : {
1368 4 : return TSDIFF(t1, t2) / 1000 / 60 / 60;
1369 : }
1370 :
1371 : static inline lng
1372 1 : timestampdiff_hour_date_timestamp(date d, timestamp ts)
1373 : {
1374 1 : return timestampdiff_hour(timestamp_fromdate(d), ts);
1375 : }
1376 :
1377 : static inline lng
1378 1 : timestampdiff_hour_timestamp_date(timestamp ts, date d)
1379 : {
1380 1 : return timestampdiff_hour(ts, timestamp_fromdate(d));
1381 : }
1382 :
1383 : static inline int
1384 4 : timestampdiff_day(timestamp t1, timestamp t2)
1385 : {
1386 4 : return date_diff(timestamp_date(t1), timestamp_date(t2));
1387 : }
1388 :
1389 : static inline int
1390 1 : timestampdiff_day_time_timestamp(daytime t, timestamp ts)
1391 : {
1392 1 : date today = timestamp_date(timestamp_current());
1393 1 : return timestampdiff_day(timestamp_create(today, t), ts);
1394 : }
1395 :
1396 : static inline int
1397 1 : timestampdiff_day_timestamp_time(timestamp ts, daytime t)
1398 : {
1399 1 : date today = timestamp_date(timestamp_current());
1400 1 : return timestampdiff_day(ts, timestamp_create(today, t));
1401 : }
1402 :
1403 : static inline int
1404 4 : timestampdiff_week(timestamp t1, timestamp t2)
1405 : {
1406 4 : return date_diff(timestamp_date(t1), timestamp_date(t2)) / 7;
1407 : }
1408 :
1409 : static inline int
1410 0 : timestampdiff_week_time_timestamp(daytime t, timestamp ts)
1411 : {
1412 0 : date today = timestamp_date(timestamp_current());
1413 0 : return timestampdiff_week(timestamp_create(today, t), ts);
1414 : }
1415 :
1416 : static inline int
1417 2 : timestampdiff_week_timestamp_time(timestamp ts, daytime t)
1418 : {
1419 2 : date today = timestamp_date(timestamp_current());
1420 2 : return timestampdiff_week(ts, timestamp_create(today, t));
1421 : }
1422 :
1423 : static inline int
1424 5 : timestampdiff_month(timestamp t1, timestamp t2)
1425 : {
1426 5 : date d1 = timestamp_date(t1);
1427 5 : date d2 = timestamp_date(t2);
1428 5 : return ((date_year(d1) - date_year(d2)) * 12) + (date_month(d1) -
1429 5 : date_month(d2));
1430 : }
1431 :
1432 : static inline int
1433 1 : timestampdiff_month_time_timestamp(daytime t, timestamp ts)
1434 : {
1435 1 : date today = timestamp_date(timestamp_current());
1436 1 : return timestampdiff_month(timestamp_create(today, t), ts);
1437 : }
1438 :
1439 : static inline int
1440 1 : timestampdiff_month_timestamp_time(timestamp ts, daytime t)
1441 : {
1442 1 : date today = timestamp_date(timestamp_current());
1443 1 : return timestampdiff_month(ts, timestamp_create(today, t));
1444 : }
1445 :
1446 : static inline int
1447 5 : timestampdiff_quarter(timestamp t1, timestamp t2)
1448 : {
1449 5 : date d1 = timestamp_date(t1);
1450 5 : date d2 = timestamp_date(t2);
1451 5 : return ((date_year(d1) - date_year(d2)) * 4) + (date_quarter(d1) -
1452 5 : date_quarter(d2));
1453 : }
1454 :
1455 : static inline int
1456 1 : timestampdiff_quarter_time_timestamp(daytime t, timestamp ts)
1457 : {
1458 1 : date today = timestamp_date(timestamp_current());
1459 1 : return timestampdiff_quarter(timestamp_create(today, t), ts);
1460 : }
1461 :
1462 : static inline int
1463 1 : timestampdiff_quarter_timestamp_time(timestamp ts, daytime t)
1464 : {
1465 1 : date today = timestamp_date(timestamp_current());
1466 1 : return timestampdiff_quarter(ts, timestamp_create(today, t));
1467 : }
1468 :
1469 : static inline int
1470 4 : timestampdiff_year(timestamp t1, timestamp t2)
1471 : {
1472 4 : date d1 = timestamp_date(t1);
1473 4 : date d2 = timestamp_date(t2);
1474 4 : return date_year(d1) - date_year(d2);
1475 : }
1476 :
1477 : static inline int
1478 1 : timestampdiff_year_time_timestamp(daytime t, timestamp ts)
1479 : {
1480 1 : date today = timestamp_date(timestamp_current());
1481 1 : return timestampdiff_year(timestamp_create(today, t), ts);
1482 : }
1483 :
1484 : static inline int
1485 1 : timestampdiff_year_timestamp_time(timestamp ts, daytime t)
1486 : {
1487 1 : date today = timestamp_date(timestamp_current());
1488 1 : return timestampdiff_year(ts, timestamp_create(today, t));
1489 : }
1490 :
1491 : // odbc timestampdiff variants
1492 3 : func2(MTIMEtimestampdiff_sec, "timestampdiff_sec",
1493 : timestamp, timestamp, lng, timestampdiff_sec, func2_noexcept,
1494 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1495 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1496 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1497 1 : func2(MTIMEtimestampdiff_sec_d_ts, "timestampdiff_sec",
1498 : date, timestamp, lng, timestampdiff_sec_date_timestamp, func2_noexcept,
1499 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1500 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1501 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1502 1 : func2(MTIMEtimestampdiff_sec_ts_d, "timestampdiff_sec",
1503 : timestamp, date, lng, timestampdiff_sec_timestamp_date, func2_noexcept,
1504 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1505 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1506 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1507 2 : func2(MTIMEtimestampdiff_min, "timestampdiff_min",
1508 : timestamp, timestamp, lng, timestampdiff_min, func2_noexcept,
1509 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1510 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1511 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1512 1 : func2(MTIMEtimestampdiff_min_d_ts, "timestampdiff_min",
1513 : date, timestamp, lng, timestampdiff_min_date_timestamp, func2_noexcept,
1514 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1515 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1516 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1517 1 : func2(MTIMEtimestampdiff_min_ts_d, "timestampdiff_min",
1518 : timestamp, date, lng, timestampdiff_min_timestamp_date, func2_noexcept,
1519 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1520 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1521 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1522 2 : func2(MTIMEtimestampdiff_hour, "timestampdiff_hour",
1523 : timestamp, timestamp, lng, timestampdiff_hour, func2_noexcept,
1524 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1525 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1526 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1527 1 : func2(MTIMEtimestampdiff_hour_d_ts, "timestampdiff_hour",
1528 : date, timestamp, lng, timestampdiff_hour_date_timestamp, func2_noexcept,
1529 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1530 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1531 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1532 1 : func2(MTIMEtimestampdiff_hour_ts_d, "timestampdiff_hour",
1533 : timestamp, date, lng, timestampdiff_hour_timestamp_date, func2_noexcept,
1534 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1535 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1536 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1537 2 : func2(MTIMEtimestampdiff_day, "timestampdiff_day",
1538 : timestamp, timestamp, int, timestampdiff_day, func2_noexcept,
1539 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1540 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1541 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1542 2 : func2(MTIMEtimestampdiff_day_t_ts, "timestampdiff_day",
1543 : daytime, timestamp, int, timestampdiff_day_time_timestamp, func2_noexcept,
1544 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1545 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1546 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1547 3 : func2(MTIMEtimestampdiff_day_ts_t, "timestampdiff_day",
1548 : timestamp, daytime, int, timestampdiff_day_timestamp_time, func2_noexcept,
1549 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1550 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1551 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1552 2 : func2(MTIMEtimestampdiff_week, "timestampdiff_week",
1553 : timestamp, timestamp, int, timestampdiff_week, func2_noexcept,
1554 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1555 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1556 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1557 0 : func2(MTIMEtimestampdiff_week_t_ts, "timestampdiff_week",
1558 : daytime, timestamp, int, timestampdiff_week_time_timestamp,
1559 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1560 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1561 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1562 6 : func2(MTIMEtimestampdiff_week_ts_t, "timestampdiff_week", timestamp,
1563 : daytime, int, timestampdiff_week_timestamp_time, func2_noexcept, DEC_VAR,
1564 : DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1565 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1566 3 : func2(MTIMEtimestampdiff_month, "timestampdiff_month", timestamp, timestamp,
1567 : int, timestampdiff_month, func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R,
1568 : DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR,
1569 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1570 2 : func2(MTIMEtimestampdiff_month_t_ts, "timestampdiff_month",
1571 : daytime, timestamp, int, timestampdiff_month_time_timestamp,
1572 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1573 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1574 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1575 3 : func2(MTIMEtimestampdiff_month_ts_t, "timestampdiff_month",
1576 : timestamp, daytime, int, timestampdiff_month_timestamp_time,
1577 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1578 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1579 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1580 3 : func2(MTIMEtimestampdiff_quarter, "timestampdiff_quarter", timestamp, timestamp,
1581 : int, timestampdiff_quarter, func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R,
1582 : DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR,
1583 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1584 2 : func2(MTIMEtimestampdiff_quarter_t_ts, "timestampdiff_quarter",
1585 : daytime, timestamp, int, timestampdiff_quarter_time_timestamp,
1586 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1587 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1588 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1589 3 : func2(MTIMEtimestampdiff_quarter_ts_t, "timestampdiff_quarter",
1590 : timestamp, daytime, int, timestampdiff_quarter_timestamp_time,
1591 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1592 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1593 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1594 2 : func2(MTIMEtimestampdiff_year, "timestampdiff_year", timestamp, timestamp, int,
1595 : timestampdiff_year, func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1596 : INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR,
1597 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1598 2 : func2(MTIMEtimestampdiff_year_t_ts, "timestampdiff_year",
1599 : daytime, timestamp, int, timestampdiff_year_time_timestamp,
1600 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1601 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1602 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1603 3 : func2(MTIMEtimestampdiff_year_ts_t, "timestampdiff_year",
1604 : timestamp, daytime, int, timestampdiff_year_timestamp_time,
1605 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1606 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1607 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1608 :
1609 : #include "mel.h"
1610 : static mel_func mtime_init_funcs[] = {
1611 : command("mtime", "epoch", MTIMEseconds_since_epoch, false, "unix-time (epoch) support: seconds since epoch", args(1,2, arg("",int),arg("t",timestamp))),
1612 : pattern("batmtime", "epoch", MTIMEseconds_since_epoch_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1613 : pattern("batmtime", "epoch", MTIMEseconds_since_epoch_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1614 : command("mtime", "epoch", MTIMEtimestamp_fromsecond_epoch, false, "convert seconds since epoch into a timestamp", args(1,2, arg("",timestamp),arg("t",int))),
1615 : pattern("batmtime", "epoch", MTIMEtimestamp_fromsecond_epoch_bulk, false, "", args(1,2, batarg("",timestamp),batarg("t",int))),
1616 : pattern("batmtime", "epoch", MTIMEtimestamp_fromsecond_epoch_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",int),batarg("s",oid))),
1617 : command("mtime", "epoch", MTIMEtimestamp_frommsec_epoch, false, "convert milliseconds since epoch into a timestamp", args(1,2, arg("",timestamp),arg("t",lng))),
1618 : pattern("batmtime", "epoch", MTIMEtimestamp_frommsec_epoch_bulk, false, "", args(1,2, batarg("",timestamp),batarg("t",lng))),
1619 : pattern("batmtime", "epoch", MTIMEtimestamp_frommsec_epoch_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",lng),batarg("s",oid))),
1620 : command("mtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval, false, "", args(1,3, arg("",date),arg("t",date),arg("ms",lng))),
1621 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("ms",lng))),
1622 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("ms",lng))),
1623 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",date),arg("ms",lng))),
1624 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk, false, "", args(1,5, batarg("",date),batarg("t",date),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1625 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",date),batarg("ms",lng),batarg("s",oid))),
1626 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",date),arg("ms",lng),batarg("s",oid))),
1627 : command("mtime", "date_add_msec_interval", MTIMEdate_add_msec_interval, false, "", args(1,3, arg("",date),arg("t",date),arg("ms",lng))),
1628 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("ms",lng))),
1629 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("ms",lng))),
1630 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",date),arg("ms",lng))),
1631 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk, false, "", args(1,5, batarg("",date),batarg("t",date),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1632 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",date),batarg("ms",lng),batarg("s",oid))),
1633 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",date),arg("ms",lng),batarg("s",oid))),
1634 : command("mtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval, false, "", args(1,3, arg("",timestamp),arg("t",timestamp),arg("ms",lng))),
1635 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng))),
1636 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng))),
1637 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng))),
1638 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1639 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng),batarg("s",oid))),
1640 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng),batarg("s",oid))),
1641 : command("mtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval, false, "", args(1,3, arg("",timestamp),arg("t",timestamp),arg("ms",lng))),
1642 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng))),
1643 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng))),
1644 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng))),
1645 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1646 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng),batarg("s",oid))),
1647 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng),batarg("s",oid))),
1648 : command("mtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval, false, "Subtract months from a timestamp", args(1,3, arg("",timestamp),arg("t",timestamp),arg("s",int))),
1649 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",int))),
1650 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("s",int))),
1651 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("s",int))),
1652 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("s",int),batarg("s1",oid),batarg("s2",oid))),
1653 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("s",int),batarg("s",oid))),
1654 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("s",int),batarg("s",oid))),
1655 : // --
1656 : command("mtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval, false, "Add months to a timestamp", args(1,3, arg("",timestamp),arg("t",timestamp),arg("s",int))),
1657 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",int))),
1658 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("s",int))),
1659 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("s",int))),
1660 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("s",int),batarg("s1",oid),batarg("s2",oid))),
1661 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("s",int),batarg("s",oid))),
1662 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("s",int),batarg("s",oid))),
1663 : // odbc timestampadd corner cases
1664 : command("mtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time, false, "", args(1,3, arg("",timestamp),arg("t",daytime),arg("ms",lng))),
1665 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),batarg("ms",lng))),
1666 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",daytime),batarg("ms",lng))),
1667 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),arg("ms",lng))),
1668 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",daytime),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1669 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",daytime),batarg("ms",lng),batarg("s",oid))),
1670 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",daytime),arg("ms",lng),batarg("s",oid))),
1671 : // --
1672 : command("mtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time, false, "Add months to a time", args(1,3, arg("",timestamp),arg("t",daytime),arg("s",int))),
1673 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),batarg("s",int))),
1674 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",daytime),batarg("s",int))),
1675 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),arg("s",int))),
1676 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",daytime),batarg("s",int),batarg("s1",oid),batarg("s2",oid))),
1677 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",daytime),batarg("s",int),batarg("s",oid))),
1678 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",daytime),arg("s",int),batarg("s",oid))),
1679 : // --
1680 : command("mtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date, false, "", args(1,3, arg("",timestamp),arg("d",date),arg("ms",lng))),
1681 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk, false, "", args(1,3, batarg("",timestamp),batarg("d",date),batarg("ms",lng))),
1682 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("d",date),batarg("ms",lng))),
1683 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("d",date),arg("ms",lng))),
1684 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk, false, "", args(1,5, batarg("",timestamp),batarg("d",date),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1685 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("d",date),batarg("ms",lng),batarg("s",oid))),
1686 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("d",date),arg("ms",lng),batarg("s",oid))),
1687 : // end odbc timestampadd corner cases
1688 : command("mtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval, false, "Subtract seconds from a time", args(1,3, arg("",daytime),arg("t",daytime),arg("ms",lng))),
1689 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),batarg("ms",lng))),
1690 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p1, false, "", args(1,3, batarg("",daytime),arg("t",daytime),batarg("ms",lng))),
1691 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p2, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),arg("ms",lng))),
1692 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk, false, "", args(1,5, batarg("",daytime),batarg("t",daytime),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1693 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("t",daytime),batarg("ms",lng),batarg("s",oid))),
1694 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("t",daytime),arg("ms",lng),batarg("s",oid))),
1695 : command("mtime", "time_add_msec_interval", MTIMEtime_add_msec_interval, false, "Add seconds to a time", args(1,3, arg("",daytime),arg("t",daytime),arg("ms",lng))),
1696 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),batarg("ms",lng))),
1697 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",daytime),arg("t",daytime),batarg("ms",lng))),
1698 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),arg("ms",lng))),
1699 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk, false, "", args(1,5, batarg("",daytime),batarg("t",daytime),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1700 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("t",daytime),batarg("ms",lng),batarg("s",oid))),
1701 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("t",daytime),arg("ms",lng),batarg("s",oid))),
1702 : command("mtime", "diff", MTIMEdaytime_diff_msec, false, "returns the number of msec between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",daytime),arg("val2",daytime))),
1703 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",daytime),batarg("val2",daytime))),
1704 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",daytime),batarg("val2",daytime))),
1705 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",daytime),arg("val2",daytime))),
1706 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",daytime),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1707 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",daytime),batarg("val2",daytime),batarg("s",oid))),
1708 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",daytime),arg("val2",daytime),batarg("s",oid))),
1709 : command("mtime", "date_sub_month_interval", MTIMEdate_submonths, false, "Subtract months from a date", args(1,3, arg("",date),arg("t",date),arg("months",int))),
1710 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("months",int))),
1711 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("months",int))),
1712 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",date),arg("months",int))),
1713 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk, false, "", args(1,5, batarg("",date),batarg("t",date),batarg("months",int),batarg("s1",oid),batarg("s2",oid))),
1714 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",date),batarg("months",int),batarg("s",oid))),
1715 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",date),arg("months",int),batarg("s",oid))),
1716 : command("mtime", "local_timezone", MTIMElocal_timezone_msec, false, "get the local timezone in seconds", args(1,1, arg("",lng))),
1717 : command("mtime", "century", MTIMEdate_extract_century, false, "extracts century from date.", args(1,2, arg("",int),arg("d",date))),
1718 : pattern("batmtime", "century", MTIMEdate_extract_century_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))),
1719 : pattern("batmtime", "century", MTIMEdate_extract_century_bulk, false, "", args(1,3, batarg("",int),batarg("d",date),batarg("s",oid))),
1720 : command("mtime", "decade", MTIMEdate_extract_decade, false, "extracts decade from date.", args(1,2, arg("",int),arg("d",date))),
1721 : pattern("batmtime", "decade", MTIMEdate_extract_decade_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))),
1722 : pattern("batmtime", "decade", MTIMEdate_extract_decade_bulk, false, "", args(1,3, batarg("",int),batarg("d",date),batarg("s",oid))),
1723 : command("mtime", "year", MTIMEdate_extract_year, false, "extracts year from date.", args(1,2, arg("",int),arg("d",date))),
1724 : pattern("batmtime", "year", MTIMEdate_extract_year_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))),
1725 : pattern("batmtime", "year", MTIMEdate_extract_year_bulk, false, "", args(1,3, batarg("",int),batarg("d",date),batarg("s",oid))),
1726 : command("mtime", "quarter", MTIMEdate_extract_quarter, false, "extracts quarter from date", args(1,2, arg("",bte),arg("d",date))),
1727 : pattern("batmtime", "quarter", MTIMEdate_extract_quarter_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1728 : pattern("batmtime", "quarter", MTIMEdate_extract_quarter_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1729 : command("mtime", "month", MTIMEdate_extract_month, false, "extracts month from date", args(1,2, arg("",bte),arg("d",date))),
1730 : pattern("batmtime", "month", MTIMEdate_extract_month_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1731 : pattern("batmtime", "month", MTIMEdate_extract_month_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1732 : command("mtime", "day", MTIMEdate_extract_day, false, "extracts day from date ", args(1,2, arg("",bte),arg("d",date))),
1733 : pattern("batmtime", "day", MTIMEdate_extract_day_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1734 : pattern("batmtime", "day", MTIMEdate_extract_day_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1735 : command("mtime", "epoch_ms", MTIMEdate_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("d",date))),
1736 : pattern("batmtime", "epoch_ms", MTIMEdate_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("d",date))),
1737 : pattern("batmtime", "epoch_ms", MTIMEdate_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("d",date),batarg("s",oid))),
1738 : command("mtime", "hours", MTIMEdaytime_extract_hours, false, "extracts hour from daytime", args(1,2, arg("",bte),arg("h",daytime))),
1739 : pattern("batmtime", "hours", MTIMEdaytime_extract_hours_bulk, false, "", args(1,2, batarg("",bte),batarg("d",daytime))),
1740 : pattern("batmtime", "hours", MTIMEdaytime_extract_hours_bulk, false, "", args(1,3, batarg("",bte),batarg("d",daytime),batarg("s",oid))),
1741 : command("mtime", "minutes", MTIMEdaytime_extract_minutes, false, "extracts minutes from daytime", args(1,2, arg("",bte),arg("d",daytime))),
1742 : pattern("batmtime", "minutes", MTIMEdaytime_extract_minutes_bulk, false, "", args(1,2, batarg("",bte),batarg("d",daytime))),
1743 : pattern("batmtime", "minutes", MTIMEdaytime_extract_minutes_bulk, false, "", args(1,3, batarg("",bte),batarg("d",daytime),batarg("s",oid))),
1744 : command("mtime", "sql_seconds", MTIMEdaytime_extract_sql_seconds, false, "extracts seconds (with fractional milliseconds) from daytime", args(1,2, arg("",int),arg("d",daytime))),
1745 : pattern("batmtime", "sql_seconds", MTIMEdaytime_extract_sql_seconds_bulk, false, "", args(1,2, batarg("",int),batarg("d",daytime))),
1746 : pattern("batmtime", "sql_seconds", MTIMEdaytime_extract_sql_seconds_bulk, false, "", args(1,3, batarg("",int),batarg("d",daytime),batarg("s",oid))),
1747 : command("mtime", "epoch_ms", MTIMEdaytime_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("d",daytime))),
1748 : pattern("batmtime", "epoch_ms", MTIMEdaytime_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("d",daytime))),
1749 : pattern("batmtime", "epoch_ms", MTIMEdaytime_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("d",daytime),batarg("s",oid))),
1750 : command("mtime", "addmonths", MTIMEdate_addmonths, false, "returns the date after a number of\nmonths (possibly negative).", args(1,3, arg("",date),arg("value",date),arg("months",int))),
1751 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk, false, "", args(1,3, batarg("",date),batarg("value",date),batarg("months",int))),
1752 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p1, false, "", args(1,3, batarg("",date),arg("value",date),batarg("months",int))),
1753 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p2, false, "", args(1,3, batarg("",date),batarg("value",date),arg("months",int))),
1754 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk, false, "", args(1,5, batarg("",date),batarg("value",date),batarg("months",int),batarg("s1",oid),batarg("s2",oid))),
1755 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p1, false, "", args(1,4, batarg("",date),arg("value",date),batarg("months",int),batarg("s",oid))),
1756 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p2, false, "", args(1,4, batarg("",date),batarg("value",date),arg("months",int),batarg("s",oid))),
1757 : command("mtime", "diff", MTIMEdate_diff, false, "returns the number of days\nbetween 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",date))),
1758 : pattern("batmtime", "diff", MTIMEdate_diff_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",date))),
1759 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",date))),
1760 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",date))),
1761 : pattern("batmtime", "diff", MTIMEdate_diff_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1762 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",date),batarg("s",oid))),
1763 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",date),batarg("s",oid))),
1764 : command("mtime", "dayofyear", MTIMEdate_extract_dayofyear, false, "Returns N where d is the Nth day\nof the year (january 1 returns 1)", args(1,2, arg("",sht),arg("d",date))),
1765 : pattern("batmtime", "dayofyear", MTIMEdate_extract_dayofyear_bulk, false, "", args(1,2, batarg("",sht),batarg("d",date))),
1766 : pattern("batmtime", "dayofyear", MTIMEdate_extract_dayofyear_bulk, false, "", args(1,3, batarg("",sht),batarg("d",date),batarg("s",oid))),
1767 : command("mtime", "weekofyear", MTIMEdate_extract_weekofyear, false, "Returns the week number in the year.", args(1,2, arg("",bte),arg("d",date))),
1768 : pattern("batmtime", "weekofyear", MTIMEdate_extract_weekofyear_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1769 : pattern("batmtime", "weekofyear", MTIMEdate_extract_weekofyear_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1770 : command("mtime", "usweekofyear", MTIMEdate_extract_usweekofyear, false, "Returns the week number in the year, US style.", args(1,2, arg("",bte),arg("d",date))),
1771 : pattern("batmtime", "usweekofyear", MTIMEdate_extract_usweekofyear_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1772 : pattern("batmtime", "usweekofyear", MTIMEdate_extract_usweekofyear_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1773 : command("mtime", "dayofweek", MTIMEdate_extract_dayofweek, false, "Returns the current day of the week\nwhere 1=monday, .., 7=sunday", args(1,2, arg("",bte),arg("d",date))),
1774 : pattern("batmtime", "dayofweek", MTIMEdate_extract_dayofweek_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1775 : pattern("batmtime", "dayofweek", MTIMEdate_extract_dayofweek_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1776 : command("mtime", "diff", MTIMEtimestamp_diff_msec, false, "returns the number of milliseconds\nbetween 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1777 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1778 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1779 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1780 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1781 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1782 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1783 : command("mtime", "str_to_date", MTIMEstr_to_date, false, "create a date from the string, using the specified format (see man strptime)", args(1,4, arg("",date),arg("s",str),arg("format",str),arg("tz_msec",lng))),
1784 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk, false, "", args(1,4, batarg("",date),batarg("s",str),batarg("format",str),arg("tz_msec",lng))),
1785 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p1, false, "", args(1,4, batarg("",date),arg("s",str),batarg("format",str),arg("tz_msec",lng))),
1786 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p2, false, "", args(1,4, batarg("",date),batarg("s",str),arg("format",str),arg("tz_msec",lng))),
1787 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk, false, "", args(1,6, batarg("",date),batarg("s",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid),arg("tz_msec",lng))),
1788 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p1, false, "", args(1,5, batarg("",date),arg("s",str),batarg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1789 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p2, false, "", args(1,5, batarg("",date),batarg("s",str),arg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1790 : command("mtime", "date_to_str", MTIMEdate_to_str, false, "create a string from the date, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",date),arg("format",str))),
1791 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",date),batarg("format",str))),
1792 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",date),batarg("format",str))),
1793 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p2, false, "", args(1,3, batarg("",str),batarg("d",date),arg("format",str))),
1794 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk, false, "", args(1,5, batarg("",str),batarg("d",date),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1795 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",date),batarg("format",str),batarg("s",oid))),
1796 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",date),arg("format",str),batarg("s",oid))),
1797 : command("mtime", "str_to_time", MTIMEstr_to_time, false, "create a time from the string, using the specified format (see man strptime)", args(1,4, arg("",daytime),arg("s",str),arg("format",str),arg("tz_msec",lng))),
1798 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk, false, "", args(1,4, batarg("",daytime),batarg("s",str),batarg("format",str),arg("tz_msec",lng))),
1799 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("s",str),batarg("format",str),arg("tz_msec",lng))),
1800 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("s",str),arg("format",str),arg("tz_msec",lng))),
1801 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk, false, "", args(1,6, batarg("",daytime),batarg("s",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid),arg("tz_msec",lng))),
1802 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,5, batarg("",daytime),arg("s",str),batarg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1803 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,5, batarg("",daytime),batarg("s",str),arg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1804 : command("mtime", "time_to_str", MTIMEtime_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",daytime),arg("format",str))),
1805 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",daytime),batarg("format",str))),
1806 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",daytime),batarg("format",str))),
1807 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p2, false, "", args(1,3, batarg("",str),batarg("d",daytime),arg("format",str))),
1808 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk, false, "", args(1,5, batarg("",str),batarg("d",daytime),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1809 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",daytime),batarg("format",str),batarg("s",oid))),
1810 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",daytime),arg("format",str),batarg("s",oid))),
1811 : command("mtime", "timetz_to_str", MTIMEtimetz_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,4, arg("",str),arg("d",daytime),arg("format",str),arg("tz_msec",lng))),
1812 : pattern("batmtime", "timetz_to_str", MTIMEtimetz_to_str_bulk, false, "", args(1,4, batarg("",str),batarg("d",daytime),batarg("format",str),arg("tz_msec",lng))),
1813 : pattern("batmtime", "timetz_to_str", MTIMEtimetz_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",daytime),batarg("format",str),arg("tz_msec",lng))),
1814 : pattern("batmtime", "timetz_to_str", MTIMEtimetz_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",daytime),arg("format",str),arg("tz_msec",lng))),
1815 : pattern("batmtime", "timetz_to_str", MTIMEtimetz_to_str_bulk, false, "", args(1,6, batarg("",str),batarg("d",daytime),batarg("format",str),batarg("s1",oid),batarg("s2",oid),arg("tz_msec",lng))),
1816 : pattern("batmtime", "timetz_to_str", MTIMEtimetz_to_str_bulk_p1, false, "", args(1,5, batarg("",str),arg("d",daytime),batarg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1817 : pattern("batmtime", "timetz_to_str", MTIMEtimetz_to_str_bulk_p2, false, "", args(1,5, batarg("",str),batarg("d",daytime),arg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1818 : command("mtime", "str_to_timestamp", MTIMEstr_to_timestamp, false, "create a timestamp from the string, using the specified format (see man strptime)", args(1,4, arg("",timestamp),arg("s",str),arg("format",str),arg("tz_msec",lng))),
1819 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk, false, "", args(1,4, batarg("",timestamp),batarg("d",str),batarg("format",str),arg("tz_msec",lng))),
1820 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("s",str),batarg("format",str),arg("tz_msec",lng))),
1821 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("s",str),arg("format",str),arg("tz_msec",lng))),
1822 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk, false, "", args(1,6, batarg("",timestamp),batarg("d",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid),arg("tz_msec",lng))),
1823 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p1, false, "", args(1,5, batarg("",timestamp),arg("s",str),batarg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1824 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p2, false, "", args(1,5, batarg("",timestamp),batarg("s",str),arg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1825 : command("mtime", "timestamp_to_str", MTIMEtimestamp_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",timestamp),arg("format",str))),
1826 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",timestamp),batarg("format",str))),
1827 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",timestamp),batarg("format",str))),
1828 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p2, false, "", args(1,3, batarg("",str),batarg("d",timestamp),arg("format",str))),
1829 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk, false, "", args(1,5, batarg("",str),batarg("d",timestamp),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1830 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",timestamp),batarg("format",str),batarg("s",oid))),
1831 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",timestamp),arg("format",str),batarg("s",oid))),
1832 : command("mtime", "timestamptz_to_str", MTIMEtimestamptz_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,4, arg("",str),arg("d",timestamp),arg("format",str),arg("tz_msec",lng))),
1833 : pattern("batmtime", "timestamptz_to_str", MTIMEtimestamptz_to_str_bulk, false, "", args(1,4, batarg("",str),batarg("d",timestamp),batarg("format",str),arg("tz_msec",lng))),
1834 : pattern("batmtime", "timestamptz_to_str", MTIMEtimestamptz_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",timestamp),batarg("format",str),arg("tz_msec",lng))),
1835 : pattern("batmtime", "timestamptz_to_str", MTIMEtimestamptz_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",timestamp),arg("format",str),arg("tz_msec",lng))),
1836 : pattern("batmtime", "timestamptz_to_str", MTIMEtimestamptz_to_str_bulk, false, "", args(1,6, batarg("",str),batarg("d",timestamp),batarg("format",str),batarg("s1",oid),batarg("s2",oid),arg("tz_msec",lng))),
1837 : pattern("batmtime", "timestamptz_to_str", MTIMEtimestamptz_to_str_bulk_p1, false, "", args(1,5, batarg("",str),arg("d",timestamp),batarg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1838 : pattern("batmtime", "timestamptz_to_str", MTIMEtimestamptz_to_str_bulk_p2, false, "", args(1,5, batarg("",str),batarg("d",timestamp),arg("format",str),arg("tz_msec",lng),batarg("s",oid))),
1839 : command("mtime", "current_timestamp", MTIMEcurrent_timestamp, false, "", args(1,1, arg("",timestamp))),
1840 : command("mtime", "current_date", MTIMEcurrent_date, false, "", args(1,1, arg("",date))),
1841 : command("mtime", "current_time", MTIMEcurrent_time, false, "", args(1,1, arg("",daytime))),
1842 : command("mtime", "century", MTIMEtimestamp_century, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1843 : pattern("batmtime", "century", MTIMEtimestamp_century_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1844 : pattern("batmtime", "century", MTIMEtimestamp_century_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1845 : command("mtime", "decade", MTIMEtimestamp_decade, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1846 : pattern("batmtime", "decade", MTIMEtimestamp_decade_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1847 : pattern("batmtime", "decade", MTIMEtimestamp_decade_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1848 : command("mtime", "year", MTIMEtimestamp_year, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1849 : pattern("batmtime", "year", MTIMEtimestamp_year_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1850 : pattern("batmtime", "year", MTIMEtimestamp_year_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1851 : command("mtime", "quarter", MTIMEtimestamp_quarter, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1852 : pattern("batmtime", "quarter", MTIMEtimestamp_quarter_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1853 : pattern("batmtime", "quarter", MTIMEtimestamp_quarter_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1854 : command("mtime", "month", MTIMEtimestamp_month, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1855 : pattern("batmtime", "month", MTIMEtimestamp_month_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1856 : pattern("batmtime", "month", MTIMEtimestamp_month_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1857 : command("mtime", "day", MTIMEtimestamp_day, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1858 : pattern("batmtime", "day", MTIMEtimestamp_day_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1859 : pattern("batmtime", "day", MTIMEtimestamp_day_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1860 : command("mtime", "hours", MTIMEtimestamp_hours, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1861 : pattern("batmtime", "hours", MTIMEtimestamp_hours_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1862 : pattern("batmtime", "hours", MTIMEtimestamp_hours_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1863 : command("mtime", "minutes", MTIMEtimestamp_minutes, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1864 : pattern("batmtime", "minutes", MTIMEtimestamp_minutes_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1865 : pattern("batmtime", "minutes", MTIMEtimestamp_minutes_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1866 : command("mtime", "sql_seconds", MTIMEtimestamp_sql_seconds, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1867 : pattern("batmtime", "sql_seconds", MTIMEtimestamp_sql_seconds_bulk, false, "", args(1,2, batarg("",int),batarg("d",timestamp))),
1868 : pattern("batmtime", "sql_seconds", MTIMEtimestamp_sql_seconds_bulk, false, "", args(1,3, batarg("",int),batarg("d",timestamp),batarg("s",oid))),
1869 : command("mtime", "epoch_ms", MTIMEtimestamp_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("t",timestamp))),
1870 : pattern("batmtime", "epoch_ms", MTIMEtimestamp_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("t",timestamp))),
1871 : pattern("batmtime", "epoch_ms", MTIMEtimestamp_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("t",timestamp),batarg("s",oid))),
1872 : command("mtime", "year", MTIMEsql_year, false, "", args(1,2, arg("",int),arg("months",int))),
1873 : pattern("batmtime", "year", MTIMEsql_year_bulk, false, "", args(1,2, batarg("",int),batarg("months",int))),
1874 : pattern("batmtime", "year", MTIMEsql_year_bulk, false, "", args(1,3, batarg("",int),batarg("months",int),batarg("s",oid))),
1875 : command("mtime", "month", MTIMEsql_month, false, "", args(1,2, arg("",int),arg("months",int))),
1876 : pattern("batmtime", "month", MTIMEsql_month_bulk, false, "", args(1,2, batarg("",int),batarg("months",int))),
1877 : pattern("batmtime", "month", MTIMEsql_month_bulk, false, "", args(1,3, batarg("",int),batarg("months",int),batarg("s",oid))),
1878 : command("mtime", "day", MTIMEsql_day, false, "", args(1,2, arg("",lng),arg("msecs",lng))),
1879 : pattern("batmtime", "day", MTIMEsql_day_bulk, false, "", args(1,2, batarg("",lng),batarg("msecs",lng))),
1880 : pattern("batmtime", "day", MTIMEsql_day_bulk, false, "", args(1,3, batarg("",lng),batarg("msecs",lng),batarg("s",oid))),
1881 : command("mtime", "hours", MTIMEsql_hours, false, "", args(1,2, arg("",int),arg("msecs",lng))),
1882 : pattern("batmtime", "hours", MTIMEsql_hours_bulk, false, "", args(1,2, batarg("",int),batarg("msecs",lng))),
1883 : pattern("batmtime", "hours", MTIMEsql_hours_bulk, false, "", args(1,3, batarg("",int),batarg("msecs",lng),batarg("s",oid))),
1884 : command("mtime", "minutes", MTIMEsql_minutes, false, "", args(1,2, arg("",int),arg("msecs",lng))),
1885 : pattern("batmtime", "minutes", MTIMEsql_minutes_bulk, false, "", args(1,2, batarg("",int),batarg("msecs",lng))),
1886 : pattern("batmtime", "minutes", MTIMEsql_minutes_bulk, false, "", args(1,3, batarg("",int),batarg("msecs",lng),batarg("s",oid))),
1887 : command("mtime", "seconds", MTIMEsql_seconds, false, "", args(1,2, arg("",int),arg("msecs",lng))),
1888 : pattern("batmtime", "seconds", MTIMEsql_seconds_bulk, false, "", args(1,2, batarg("",int),batarg("msecs",lng))),
1889 : pattern("batmtime", "seconds", MTIMEsql_seconds_bulk, false, "", args(1,3, batarg("",int),batarg("msecs",lng),batarg("s",oid))),
1890 : command("mtime", "epoch_ms", MTIMEmsec_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("msecs",lng))),
1891 : pattern("batmtime", "epoch_ms", MTIMEmsec_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("msecs",lng))),
1892 : pattern("batmtime", "epoch_ms", MTIMEmsec_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("msecs",lng),batarg("s",oid))),
1893 : command("calc", "date", MTIMEdate_fromstr, false, "", args(1,2, arg("",date),arg("s",str))),
1894 : command("calc", "date", MTIMEdate_date, false, "", args(1,2, arg("",date),arg("d",date))),
1895 : command("calc", "date", MTIMEtimestamp_extract_date, false, "", args(1,2, arg("",date),arg("t",timestamp))),
1896 : command("calc", "datetz", MTIMEtimestamp_tz_extract_date, false, "", args(1,3, arg("",date),arg("t",timestamp),arg("tz_msec",lng))),
1897 : command("calc", "timestamp", MTIMEtimestamp_fromstr, false, "", args(1,2, arg("",timestamp),arg("s",str))),
1898 : command("calc", "timestamp", MTIMEtimestamp_timestamp, false, "", args(1,2, arg("",timestamp),arg("t",timestamp))),
1899 : command("calc", "timestamp", MTIMEtimestamp_fromdate, false, "", args(1,2, arg("",timestamp),arg("d",date))),
1900 : command("calc", "timestamp", MTIMEtimestamp_fromsecond, false, "", args(1,2, arg("",timestamp),arg("secs",int))),
1901 : command("calc", "timestamp", MTIMEtimestamp_frommsec, false, "", args(1,2, arg("",timestamp),arg("msecs",lng))),
1902 : command("calc", "daytime", MTIMEdaytime_fromstr, false, "", args(1,2, arg("",daytime),arg("s",str))),
1903 : command("calc", "daytime", MTIMEdaytime_daytime, false, "", args(1,2, arg("",daytime),arg("d",daytime))),
1904 : command("calc", "daytime", MTIMEdaytime_fromseconds, false, "", args(1,2, arg("",daytime),arg("s",lng))),
1905 : command("calc", "daytime", MTIMEtimestamp_extract_daytime, false, "", args(1,2, arg("",daytime),arg("t",timestamp))),
1906 : // pattern("batcalc", "date", MTIMEdate_fromstr_bulk, false, "", args(1,2, batarg("",date),batarg("s",str))),
1907 : pattern("batcalc", "date", MTIMEdate_fromstr_bulk, false, "", args(1,3, batarg("",date),batarg("s",str),batarg("s",oid))),
1908 : // pattern("batcalc", "date", MTIMEdate_date_bulk, false, "", args(1,2, batarg("",date),batarg("d",date))),
1909 : pattern("batcalc", "date", MTIMEdate_date_bulk, false, "", args(1,3, batarg("",date),batarg("d",date),batarg("s",oid))),
1910 : // pattern("batcalc", "date", MTIMEtimestamp_extract_date_bulk, false, "", args(1,2, batarg("",date),batarg("t",timestamp))),
1911 : pattern("batcalc", "date", MTIMEtimestamp_extract_date_bulk, false, "", args(1,3, batarg("",date),batarg("t",timestamp),batarg("s",oid))),
1912 : pattern("batcalc", "datetz", MTIMEtimestamp_tz_extract_date_bulk, false, "", args(1,3, batarg("",date),batarg("t",timestamp),batarg("tz_msec",lng))),
1913 : pattern("batcalc", "datetz", MTIMEtimestamp_tz_extract_date_bulk, false, "", args(1,5, batarg("",date),batarg("t",timestamp),batarg("tz_msec",lng),batarg("s1",oid),batarg("s2",oid))),
1914 : pattern("batcalc", "datetz", MTIMEtimestamp_tz_extract_date_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",timestamp),batarg("tz_msec",lng))),
1915 : pattern("batcalc", "datetz", MTIMEtimestamp_tz_extract_date_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",timestamp),batarg("tz_msec",lng),batarg("s",oid))),
1916 : pattern("batcalc", "datetz", MTIMEtimestamp_tz_extract_date_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",timestamp),arg("tz_msec",lng))),
1917 : pattern("batcalc", "datetz", MTIMEtimestamp_tz_extract_date_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",timestamp),arg("tz_msec",lng),batarg("s",oid))),
1918 : // pattern("batcalc", "timestamp", MTIMEtimestamp_fromstr_bulk, false, "", args(1,2, batarg("",timestamp),batarg("s",str))),
1919 : pattern("batcalc", "timestamp", MTIMEtimestamp_fromstr_bulk, false, "", args(1,3, batarg("",timestamp),batarg("s",str),batarg("s",oid))),
1920 : // pattern("batcalc", "timestamp", MTIMEtimestamp_timestamp_bulk, false, "", args(1,2, batarg("",timestamp),batarg("t",timestamp))),
1921 : pattern("batcalc", "timestamp", MTIMEtimestamp_timestamp_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",oid))),
1922 : // pattern("batcalc", "timestamp", MTIMEtimestamp_fromdate_bulk, false, "", args(1,2, batarg("",timestamp),batarg("d",date))),
1923 : pattern("batcalc", "timestamp", MTIMEtimestamp_fromdate_bulk, false, "", args(1,3, batarg("",timestamp),batarg("d",date),batarg("s",oid))),
1924 : // pattern("batcalc", "timestamp", MTIMEtimestamp_fromsecond_bulk, false, "", args(1,2, batarg("",timestamp),batarg("secs",int))),
1925 : pattern("batcalc", "timestamp", MTIMEtimestamp_fromsecond_bulk, false, "", args(1,3, batarg("",timestamp),batarg("secs",int),batarg("s",oid))),
1926 : // pattern("batcalc", "timestamp", MTIMEtimestamp_frommsec_bulk, false, "", args(1,2, batarg("",timestamp),batarg("msecs",lng))),
1927 : pattern("batcalc", "timestamp", MTIMEtimestamp_frommsec_bulk, false, "", args(1,3, batarg("",timestamp),batarg("msecs",lng),batarg("s",oid))),
1928 : // pattern("batcalc", "daytime", MTIMEdaytime_fromstr_bulk, false, "", args(1,2, batarg("",daytime),batarg("s",str))),
1929 : pattern("batcalc", "daytime", MTIMEdaytime_fromstr_bulk, false, "", args(1,3, batarg("",daytime),batarg("s",str),batarg("s",oid))),
1930 : // pattern("batcalc", "daytime", MTIMEdaytime_daytime_bulk, false, "", args(1,2, batarg("",daytime),batarg("d",daytime))),
1931 : pattern("batcalc", "daytime", MTIMEdaytime_daytime_bulk, false, "", args(1,3, batarg("",daytime),batarg("d",daytime),batarg("s",oid))),
1932 : // pattern("batcalc", "daytime", MTIMEdaytime_fromseconds_bulk, false, "", args(1,2, batarg("",daytime),batarg("s",lng))),
1933 : pattern("batcalc", "daytime", MTIMEdaytime_fromseconds_bulk, false, "", args(1,3, batarg("",daytime),batarg("s",lng),batarg("s",oid))),
1934 : // pattern("batcalc", "daytime", MTIMEtimestamp_extract_daytime_bulk, false, "", args(1,2, batarg("",daytime),batarg("t",timestamp))),
1935 : pattern("batcalc", "daytime", MTIMEtimestamp_extract_daytime_bulk, false, "", args(1,3, batarg("",daytime),batarg("t",timestamp),batarg("s",oid))),
1936 : // -- odbc timestampdiff variants
1937 : command("mtime", "timestampdiff_sec", MTIMEtimestampdiff_sec, false, "diff in seconds between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1938 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1939 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1940 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1941 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1942 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1943 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1944 : // --
1945 : command("mtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts, false, "diff in seconds between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",timestamp))),
1946 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",timestamp))),
1947 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",timestamp))),
1948 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",timestamp))),
1949 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1950 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",timestamp),batarg("s",oid))),
1951 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",timestamp),batarg("s",oid))),
1952 : // --
1953 : command("mtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d, false, "diff in seconds between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",date))),
1954 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",date))),
1955 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",date))),
1956 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",date))),
1957 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1958 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",date),batarg("s",oid))),
1959 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",date),batarg("s",oid))),
1960 : // --
1961 : command("mtime", "timestampdiff_min", MTIMEtimestampdiff_min, false, "diff in min between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1962 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1963 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1964 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1965 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1966 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1967 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1968 : // --
1969 : command("mtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts, false, "diff in min between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",timestamp))),
1970 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",timestamp))),
1971 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",timestamp))),
1972 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",timestamp))),
1973 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1974 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",timestamp),batarg("s",oid))),
1975 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",timestamp),batarg("s",oid))),
1976 : // --
1977 : command("mtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d, false, "diff in min between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",date))),
1978 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",date))),
1979 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",date))),
1980 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",date))),
1981 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1982 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",date),batarg("s",oid))),
1983 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",date),batarg("s",oid))),
1984 : // --
1985 : command("mtime", "timestampdiff_hour", MTIMEtimestampdiff_hour, false, "diff in hours between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1986 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1987 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1988 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1989 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1990 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1991 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1992 : // --
1993 : command("mtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts, false, "diff in hours between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",timestamp))),
1994 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",timestamp))),
1995 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",timestamp))),
1996 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",timestamp))),
1997 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1998 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",timestamp),batarg("s",oid))),
1999 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",timestamp),batarg("s",oid))),
2000 : // --
2001 : command("mtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d, false, "diff in hours between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",date))),
2002 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",date))),
2003 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",date))),
2004 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",date))),
2005 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
2006 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",date),batarg("s",oid))),
2007 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",date),batarg("s",oid))),
2008 : // --
2009 : command("mtime", "timestampdiff_day", MTIMEtimestampdiff_day, false, "diff in days between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
2010 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
2011 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
2012 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
2013 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2014 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
2015 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
2016 : // --
2017 : command("mtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts, false, "diff in days between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
2018 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
2019 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
2020 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
2021 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2022 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
2023 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
2024 : // --
2025 : command("mtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t, false, "diff in days between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
2026 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
2027 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
2028 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
2029 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
2030 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
2031 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
2032 : // --
2033 : command("mtime", "timestampdiff_week", MTIMEtimestampdiff_week, false, "diff in weeks between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
2034 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
2035 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
2036 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
2037 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2038 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
2039 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
2040 : // --
2041 : command("mtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts, false, "diff in weeks between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
2042 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
2043 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
2044 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
2045 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2046 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
2047 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
2048 : // --
2049 : command("mtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t, false, "diff in weeks between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
2050 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
2051 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
2052 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
2053 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
2054 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
2055 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
2056 : // --
2057 : command("mtime", "timestampdiff_month", MTIMEtimestampdiff_month, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
2058 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
2059 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
2060 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
2061 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2062 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
2063 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
2064 : // --
2065 : command("mtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
2066 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
2067 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
2068 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
2069 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2070 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
2071 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
2072 : // --
2073 : command("mtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
2074 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
2075 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
2076 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
2077 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
2078 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
2079 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
2080 : // --
2081 : command("mtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
2082 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
2083 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
2084 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
2085 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2086 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
2087 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
2088 : // --
2089 : command("mtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
2090 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
2091 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
2092 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
2093 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2094 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
2095 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
2096 : // --
2097 : command("mtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
2098 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
2099 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
2100 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
2101 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
2102 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
2103 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
2104 : // --
2105 : command("mtime", "timestampdiff_year", MTIMEtimestampdiff_year, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
2106 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
2107 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
2108 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
2109 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2110 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
2111 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
2112 : // --
2113 : command("mtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
2114 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
2115 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
2116 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
2117 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
2118 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
2119 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
2120 : // --
2121 : command("mtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
2122 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
2123 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
2124 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
2125 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
2126 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
2127 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
2128 : { .imp=NULL }
2129 : };
2130 : #include "mal_import.h"
2131 : #ifdef _MSC_VER
2132 : #undef read
2133 : #pragma section(".CRT$XCU",read)
2134 : #endif
2135 345 : LIB_STARTUP_FUNC(init_mtime_mal)
2136 345 : { mal_module("mtime", NULL, mtime_init_funcs); }
|