ruby-oci8-master 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. data/ChangeLog +2321 -0
  2. data/Makefile +88 -0
  3. data/NEWS +303 -0
  4. data/README +76 -0
  5. data/VERSION +1 -0
  6. data/dist-files +83 -0
  7. data/doc/api.en.html +527 -0
  8. data/doc/api.en.rd +554 -0
  9. data/doc/api.ja.html +525 -0
  10. data/doc/api.ja.rd +557 -0
  11. data/doc/manual.css +35 -0
  12. data/ext/oci8/.document +18 -0
  13. data/ext/oci8/MANIFEST +18 -0
  14. data/ext/oci8/apiwrap.c.tmpl +182 -0
  15. data/ext/oci8/apiwrap.h.tmpl +61 -0
  16. data/ext/oci8/apiwrap.rb +91 -0
  17. data/ext/oci8/apiwrap.yml +1455 -0
  18. data/ext/oci8/attr.c +105 -0
  19. data/ext/oci8/bind.c +366 -0
  20. data/ext/oci8/connection_pool.c +199 -0
  21. data/ext/oci8/encoding.c +289 -0
  22. data/ext/oci8/env.c +178 -0
  23. data/ext/oci8/error.c +378 -0
  24. data/ext/oci8/extconf.rb +179 -0
  25. data/ext/oci8/lob.c +805 -0
  26. data/ext/oci8/metadata.c +232 -0
  27. data/ext/oci8/object.c +727 -0
  28. data/ext/oci8/oci8.c +1156 -0
  29. data/ext/oci8/oci8.h +574 -0
  30. data/ext/oci8/oci8lib.c +527 -0
  31. data/ext/oci8/ocidatetime.c +484 -0
  32. data/ext/oci8/ocihandle.c +751 -0
  33. data/ext/oci8/ocinumber.c +1612 -0
  34. data/ext/oci8/oraconf.rb +1119 -0
  35. data/ext/oci8/oradate.c +611 -0
  36. data/ext/oci8/oranumber_util.c +352 -0
  37. data/ext/oci8/oranumber_util.h +24 -0
  38. data/ext/oci8/post-config.rb +5 -0
  39. data/ext/oci8/stmt.c +673 -0
  40. data/ext/oci8/thread_util.c +85 -0
  41. data/ext/oci8/thread_util.h +30 -0
  42. data/ext/oci8/win32.c +137 -0
  43. data/lib/.document +1 -0
  44. data/lib/dbd/OCI8.rb +591 -0
  45. data/lib/oci8.rb.in +94 -0
  46. data/lib/oci8/.document +8 -0
  47. data/lib/oci8/bindtype.rb +349 -0
  48. data/lib/oci8/compat.rb +113 -0
  49. data/lib/oci8/connection_pool.rb +99 -0
  50. data/lib/oci8/datetime.rb +611 -0
  51. data/lib/oci8/encoding-init.rb +74 -0
  52. data/lib/oci8/encoding.yml +537 -0
  53. data/lib/oci8/metadata.rb +2132 -0
  54. data/lib/oci8/object.rb +581 -0
  55. data/lib/oci8/oci8.rb +721 -0
  56. data/lib/oci8/ocihandle.rb +425 -0
  57. data/lib/oci8/oracle_version.rb +144 -0
  58. data/lib/oci8/properties.rb +73 -0
  59. data/metaconfig +142 -0
  60. data/pre-distclean.rb +7 -0
  61. data/ruby-oci8.gemspec +63 -0
  62. data/setup.rb +1331 -0
  63. data/test/README +4 -0
  64. data/test/config.rb +122 -0
  65. data/test/test_all.rb +51 -0
  66. data/test/test_appinfo.rb +63 -0
  67. data/test/test_array_dml.rb +333 -0
  68. data/test/test_bind_raw.rb +46 -0
  69. data/test/test_bind_time.rb +178 -0
  70. data/test/test_break.rb +96 -0
  71. data/test/test_clob.rb +82 -0
  72. data/test/test_connstr.rb +81 -0
  73. data/test/test_datetime.rb +582 -0
  74. data/test/test_dbi.rb +366 -0
  75. data/test/test_dbi_clob.rb +53 -0
  76. data/test/test_encoding.rb +100 -0
  77. data/test/test_error.rb +88 -0
  78. data/test/test_metadata.rb +1399 -0
  79. data/test/test_oci8.rb +434 -0
  80. data/test/test_oracle_version.rb +70 -0
  81. data/test/test_oradate.rb +256 -0
  82. data/test/test_oranumber.rb +746 -0
  83. data/test/test_rowid.rb +33 -0
  84. metadata +137 -0
@@ -0,0 +1,484 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * ocidatetime.c
4
+ *
5
+ * Copyright (C) 2005-2011 KUBO Takehiro <kubo@jiubao.org>
6
+ *
7
+ */
8
+ #include "oci8.h"
9
+
10
+ VALUE oci8_make_ocidate(OCIDate *od)
11
+ {
12
+ return rb_ary_new3(6,
13
+ INT2FIX(od->OCIDateYYYY),
14
+ INT2FIX(od->OCIDateMM),
15
+ INT2FIX(od->OCIDateDD),
16
+ INT2FIX(od->OCIDateTime.OCITimeHH),
17
+ INT2FIX(od->OCIDateTime.OCITimeMI),
18
+ INT2FIX(od->OCIDateTime.OCITimeSS));
19
+ }
20
+
21
+ OCIDate *oci8_set_ocidate(OCIDate *od, VALUE val)
22
+ {
23
+ long year, month, day, hour, minute, second;
24
+
25
+ Check_Type(val, T_ARRAY);
26
+ if (RARRAY_LEN(val) != 6) {
27
+ rb_raise(rb_eRuntimeError, "invalid array size %ld", RARRAY_LEN(val));
28
+ }
29
+ /* year */
30
+ year = NUM2LONG(RARRAY_PTR(val)[0]);
31
+ if (year < -4712 || 9999 < year) {
32
+ rb_raise(rb_eRuntimeError, "out of year range: %ld", year);
33
+ }
34
+ od->OCIDateYYYY = (sb2)year;
35
+ /* month */
36
+ month = NUM2LONG(RARRAY_PTR(val)[1]);
37
+ if (month < 0 || 12 < month) {
38
+ rb_raise(rb_eRuntimeError, "out of month range: %ld", month);
39
+ }
40
+ od->OCIDateMM = (ub1)month;
41
+ /* day */
42
+ day = NUM2LONG(RARRAY_PTR(val)[2]);
43
+ if (day < 0 || 31 < day) {
44
+ rb_raise(rb_eRuntimeError, "out of day range: %ld", day);
45
+ }
46
+ od->OCIDateDD = (ub1)day;
47
+ /* hour */
48
+ hour = NUM2LONG(RARRAY_PTR(val)[3]);
49
+ if (hour < 0 || 23 < hour) {
50
+ rb_raise(rb_eRuntimeError, "out of hour range: %ld", hour);
51
+ }
52
+ od->OCIDateTime.OCITimeHH = (ub1)hour;
53
+ /* minute */
54
+ minute = NUM2LONG(RARRAY_PTR(val)[4]);
55
+ if (minute < 0 || 59 < minute) {
56
+ rb_raise(rb_eRuntimeError, "out of minute range: %ld", minute);
57
+ }
58
+ od->OCIDateTime.OCITimeMI = (ub1)minute;
59
+ /* second */
60
+ second = NUM2LONG(RARRAY_PTR(val)[5]);
61
+ if (second < 0 || 59 < second) {
62
+ rb_raise(rb_eRuntimeError, "out of second range: %ld", second);
63
+ }
64
+ od->OCIDateTime.OCITimeSS = (ub1)second;
65
+ return od;
66
+ }
67
+
68
+ static void bind_init_common(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length)
69
+ {
70
+ obind->value_sz = sizeof(void *);
71
+ obind->alloc_sz = sizeof(void *);
72
+ }
73
+
74
+ static void bind_init_elem_common(oci8_bind_t *obind, VALUE svc, ub4 type)
75
+ {
76
+ ub4 idx = 0;
77
+ sword rv;
78
+
79
+ do {
80
+ rv = OCIDescriptorAlloc(oci8_envhp, (dvoid*)((dvoid**)obind->valuep + idx), type, 0, 0);
81
+ if (rv != OCI_SUCCESS)
82
+ oci8_env_raise(oci8_envhp, rv);
83
+ } while (++idx < obind->maxar_sz);
84
+ }
85
+
86
+ static void bind_free_common(oci8_base_t *base, ub4 type)
87
+ {
88
+ oci8_bind_t *obind = (oci8_bind_t *)base;
89
+
90
+ if (obind->valuep != NULL) {
91
+ ub4 idx = 0;
92
+ void **pp = (void**)obind->valuep;
93
+
94
+ do {
95
+ if (pp[idx] != NULL) {
96
+ OCIDescriptorFree(pp[idx], type);
97
+ pp[idx] = NULL;
98
+ }
99
+ } while (++idx < obind->maxar_sz);
100
+ }
101
+ oci8_bind_free(base);
102
+ }
103
+
104
+ VALUE oci8_make_ocitimestamp(OCIDateTime *dttm, boolean have_tz)
105
+ {
106
+ sb2 year;
107
+ ub1 month;
108
+ ub1 day;
109
+ ub1 hour;
110
+ ub1 minute;
111
+ ub1 sec;
112
+ ub4 fsec;
113
+ sb1 tz_hour;
114
+ sb1 tz_minute;
115
+
116
+ chkerr(OCIDateTimeGetDate(oci8_envhp, oci8_errhp, dttm, &year, &month, &day));
117
+ chkerr(OCIDateTimeGetTime(oci8_envhp, oci8_errhp, dttm, &hour, &minute, &sec, &fsec));
118
+ if (have_tz) {
119
+ chkerr(OCIDateTimeGetTimeZoneOffset(oci8_envhp, oci8_errhp, dttm, &tz_hour, &tz_minute));
120
+ }
121
+ return rb_ary_new3(9,
122
+ INT2FIX(year),
123
+ INT2FIX(month),
124
+ INT2FIX(day),
125
+ INT2FIX(hour),
126
+ INT2FIX(minute),
127
+ INT2FIX(sec),
128
+ INT2FIX(fsec),
129
+ have_tz ? INT2FIX(tz_hour) : Qnil,
130
+ have_tz ? INT2FIX(tz_minute) : Qnil);
131
+ }
132
+
133
+ OCIDateTime *oci8_set_ocitimestamp_tz(OCIDateTime *dttm, VALUE val, VALUE svc)
134
+ {
135
+ long year;
136
+ long month;
137
+ long day;
138
+ long hour;
139
+ long minute;
140
+ long sec;
141
+ long fsec;
142
+ OraText *tz;
143
+ size_t tzlen;
144
+ char tz_str[32];
145
+ OCISession *seshp = NULL;
146
+
147
+ Check_Type(val, T_ARRAY);
148
+ if (RARRAY_LEN(val) != 9) {
149
+ rb_raise(rb_eRuntimeError, "invalid array size %ld", RARRAY_LEN(val));
150
+ }
151
+ /* year */
152
+ year = NUM2LONG(RARRAY_PTR(val)[0]);
153
+ if (year < -4712 || 9999 < year) {
154
+ rb_raise(rb_eRuntimeError, "out of year range: %ld", year);
155
+ }
156
+ /* month */
157
+ month = NUM2LONG(RARRAY_PTR(val)[1]);
158
+ if (month < 0 || 12 < month) {
159
+ rb_raise(rb_eRuntimeError, "out of month range: %ld", month);
160
+ }
161
+ /* day */
162
+ day = NUM2LONG(RARRAY_PTR(val)[2]);
163
+ if (day < 0 || 31 < day) {
164
+ rb_raise(rb_eRuntimeError, "out of day range: %ld", day);
165
+ }
166
+ /* hour */
167
+ hour = NUM2LONG(RARRAY_PTR(val)[3]);
168
+ if (hour < 0 || 23 < hour) {
169
+ rb_raise(rb_eRuntimeError, "out of hour range: %ld", hour);
170
+ }
171
+ /* minute */
172
+ minute = NUM2LONG(RARRAY_PTR(val)[4]);
173
+ if (minute < 0 || 60 < minute) {
174
+ rb_raise(rb_eRuntimeError, "out of minute range: %ld", minute);
175
+ }
176
+ /* second */
177
+ sec = NUM2LONG(RARRAY_PTR(val)[5]);
178
+ if (sec < 0 || 60 < sec) {
179
+ rb_raise(rb_eRuntimeError, "out of second range: %ld", sec);
180
+ }
181
+ /* sec_fraction */
182
+ fsec = NUM2LONG(RARRAY_PTR(val)[6]);
183
+ if (fsec < 0 || 1000000000 < fsec) {
184
+ rb_raise(rb_eRuntimeError, "out of sec_fraction range: %ld", fsec);
185
+ }
186
+ /* time zone */
187
+ if (NIL_P(RARRAY_PTR(val)[7]) && NIL_P(RARRAY_PTR(val)[8])) {
188
+ if (!NIL_P(svc)) {
189
+ /* use session timezone. */
190
+ seshp = oci8_get_oci_session(svc);
191
+ }
192
+ tz = NULL;
193
+ tzlen = 0;
194
+ } else {
195
+ snprintf(tz_str, sizeof(tz_str), "%+02ld:%02ld",
196
+ NUM2LONG(RARRAY_PTR(val)[7]),
197
+ NUM2LONG(RARRAY_PTR(val)[8]));
198
+ tz_str[sizeof(tz_str) - 1] = '\0';
199
+ tz = (OraText*)tz_str;
200
+ tzlen = strlen(tz_str);
201
+ }
202
+ /* construct */
203
+ chkerr(OCIDateTimeConstruct(seshp ? (void*)seshp : (void*)oci8_envhp, oci8_errhp, dttm,
204
+ (sb2)year,
205
+ (ub1)month,
206
+ (ub1)day,
207
+ (ub1)hour,
208
+ (ub1)minute,
209
+ (ub1)sec,
210
+ (ub4)fsec,
211
+ tz, tzlen));
212
+ return dttm;
213
+ }
214
+
215
+ static VALUE bind_ocitimestamp_get(oci8_bind_t *obind, void *data, void *null_struct)
216
+ {
217
+ return oci8_make_ocitimestamp(*(OCIDateTime **)data, FALSE);
218
+ }
219
+
220
+ static void bind_ocitimestamp_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
221
+ {
222
+ oci8_set_ocitimestamp_tz(*(OCIDateTime **)data, val, Qnil);
223
+ }
224
+
225
+ static void bind_ocitimestamp_init_elem(oci8_bind_t *obind, VALUE svc)
226
+ {
227
+ bind_init_elem_common(obind, svc, OCI_DTYPE_TIMESTAMP);
228
+ }
229
+
230
+ static void bind_ocitimestamp_free(oci8_base_t *base)
231
+ {
232
+ bind_free_common(base, OCI_DTYPE_TIMESTAMP);
233
+ }
234
+
235
+ static const oci8_bind_vtable_t bind_ocitimestamp_vtable = {
236
+ {
237
+ NULL,
238
+ bind_ocitimestamp_free,
239
+ sizeof(oci8_bind_t)
240
+ },
241
+ bind_ocitimestamp_get,
242
+ bind_ocitimestamp_set,
243
+ bind_init_common,
244
+ bind_ocitimestamp_init_elem,
245
+ NULL,
246
+ SQLT_TIMESTAMP
247
+ };
248
+
249
+ static VALUE bind_ocitimestamp_tz_get(oci8_bind_t *obind, void *data, void *null_struct)
250
+ {
251
+ return oci8_make_ocitimestamp(*(OCIDateTime **)data, TRUE);
252
+ }
253
+
254
+ static void bind_ocitimestamp_tz_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
255
+ {
256
+ oci8_base_t *parent;
257
+ oci8_base_t *svcctx;
258
+
259
+ parent = obind->base.parent;
260
+ if (parent != NULL && parent->type == OCI_HTYPE_STMT) {
261
+ svcctx = parent->parent;
262
+ } else {
263
+ svcctx = parent;
264
+ }
265
+ if (svcctx == NULL || svcctx->type != OCI_HTYPE_SVCCTX) {
266
+ rb_raise(rb_eRuntimeError, "oci8lib.so internal error [%s:%d, %p, %d, %p, %d]",
267
+ __FILE__, __LINE__,
268
+ parent, parent ? parent->type : -1,
269
+ svcctx, svcctx ? svcctx->type : -1);
270
+ }
271
+ oci8_set_ocitimestamp_tz(*(OCIDateTime **)data, val, svcctx->self);
272
+ }
273
+
274
+ static void bind_ocitimestamp_tz_init(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length)
275
+ {
276
+ oci8_link_to_parent((oci8_base_t*)obind, (oci8_base_t*)oci8_get_svcctx(svc));
277
+ obind->value_sz = sizeof(OCIDateTime *);
278
+ obind->alloc_sz = sizeof(OCIDateTime *);
279
+ }
280
+
281
+ static void bind_ocitimestamp_tz_init_elem(oci8_bind_t *obind, VALUE svc)
282
+ {
283
+ bind_init_elem_common(obind, svc, OCI_DTYPE_TIMESTAMP_TZ);
284
+ }
285
+
286
+ static void bind_ocitimestamp_tz_free(oci8_base_t *base)
287
+ {
288
+ bind_free_common(base, OCI_DTYPE_TIMESTAMP_TZ);
289
+ }
290
+
291
+ static const oci8_bind_vtable_t bind_ocitimestamp_tz_vtable = {
292
+ {
293
+ NULL,
294
+ bind_ocitimestamp_tz_free,
295
+ sizeof(oci8_bind_t)
296
+ },
297
+ bind_ocitimestamp_tz_get,
298
+ bind_ocitimestamp_tz_set,
299
+ bind_ocitimestamp_tz_init,
300
+ bind_ocitimestamp_tz_init_elem,
301
+ NULL,
302
+ SQLT_TIMESTAMP_TZ
303
+ };
304
+
305
+ VALUE oci8_make_ociinterval_ym(OCIInterval *s)
306
+ {
307
+ sb4 year;
308
+ sb4 month;
309
+
310
+ chkerr(OCIIntervalGetYearMonth(oci8_envhp, oci8_errhp, &year, &month, s));
311
+ return rb_ary_new3(2, INT2FIX(year), INT2FIX(month));
312
+ }
313
+
314
+ OCIInterval *oci8_set_ociinterval_ym(OCIInterval *intvl, VALUE val)
315
+ {
316
+ sb4 year;
317
+ sb4 month;
318
+
319
+ Check_Type(val, T_ARRAY);
320
+ if (RARRAY_LEN(val) != 2) {
321
+ rb_raise(rb_eRuntimeError, "invalid array size %ld", RARRAY_LEN(val));
322
+ }
323
+ year = NUM2INT(RARRAY_PTR(val)[0]);
324
+ month = NUM2INT(RARRAY_PTR(val)[1]);
325
+ if (oracle_client_version >= ORAVERNUM(9, 2, 0, 3, 0)) {
326
+ chkerr(OCIIntervalSetYearMonth(oci8_envhp, oci8_errhp,
327
+ year, month, intvl));
328
+ } else {
329
+ /* Workaround for Bug 2227982 */
330
+ char buf[64];
331
+ char *sign = "";
332
+
333
+ if (year < 0 && month != 0) {
334
+ year += 1;
335
+ month -= 12;
336
+ }
337
+ if (year < 0 || month < 0) {
338
+ sign = "-";
339
+ year = -year;
340
+ month = -month;
341
+ }
342
+ sprintf(buf, "%s%d-%d", sign, year, month);
343
+ chkerr(OCIIntervalFromText(oci8_envhp, oci8_errhp, (text*)buf, strlen(buf), intvl));
344
+ }
345
+ return intvl;
346
+ }
347
+
348
+ VALUE oci8_make_ociinterval_ds(OCIInterval *s)
349
+ {
350
+ sb4 day;
351
+ sb4 hour;
352
+ sb4 minute;
353
+ sb4 sec;
354
+ sb4 fsec;
355
+
356
+ chkerr(OCIIntervalGetDaySecond(oci8_envhp, oci8_errhp, &day, &hour, &minute, &sec, &fsec, s));
357
+ return rb_ary_new3(5,
358
+ INT2FIX(day), INT2FIX(hour),
359
+ INT2FIX(minute), INT2FIX(sec),
360
+ INT2FIX(fsec));
361
+ }
362
+
363
+ OCIInterval *oci8_set_ociinterval_ds(OCIInterval *intvl, VALUE val)
364
+ {
365
+ sb4 day;
366
+ sb4 hour;
367
+ sb4 minute;
368
+ sb4 sec;
369
+ sb4 fsec;
370
+
371
+ Check_Type(val, T_ARRAY);
372
+ if (RARRAY_LEN(val) != 5) {
373
+ rb_raise(rb_eRuntimeError, "invalid array size %ld", RARRAY_LEN(val));
374
+ }
375
+ day = NUM2INT(RARRAY_PTR(val)[0]);
376
+ hour = NUM2INT(RARRAY_PTR(val)[1]);
377
+ minute = NUM2INT(RARRAY_PTR(val)[2]);
378
+ sec = NUM2INT(RARRAY_PTR(val)[3]);
379
+ fsec = NUM2INT(RARRAY_PTR(val)[4]);
380
+ if (oracle_client_version >= ORAVERNUM(9, 2, 0, 3, 0)) {
381
+ chkerr(OCIIntervalSetDaySecond(oci8_envhp, oci8_errhp,
382
+ day, hour, minute, sec, fsec, intvl));
383
+ } else {
384
+ /* Workaround for Bug 2227982 */
385
+ char buf[64];
386
+ char *sign = "";
387
+
388
+ if (day == 0) {
389
+ if (hour < 0) {
390
+ sign = "-";
391
+ hour = -hour;
392
+ } else if (minute < 0) {
393
+ sign = "-";
394
+ minute = -minute;
395
+ } else if (sec < 0) {
396
+ sign = "-";
397
+ sec = -sec;
398
+ } else if (fsec < 0) {
399
+ sign = "-";
400
+ fsec = -fsec;
401
+ }
402
+ }
403
+ sprintf(buf, "%s%d %02d:%02d:%02d.%09d", sign, day, hour, minute, sec, fsec);
404
+ chkerr(OCIIntervalFromText(oci8_envhp, oci8_errhp, (text*)buf, strlen(buf), intvl));
405
+ }
406
+ return intvl;
407
+ }
408
+
409
+
410
+ static VALUE bind_ociinterval_ym_get(oci8_bind_t *obind, void *data, void *null_struct)
411
+ {
412
+ return oci8_make_ociinterval_ym(*(OCIInterval **)data);
413
+ }
414
+
415
+ static void bind_ociinterval_ym_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
416
+ {
417
+ oci8_set_ociinterval_ym(*(OCIInterval **)data, val);
418
+ }
419
+
420
+ static void bind_ociinterval_ym_init_elem(oci8_bind_t *obind, VALUE svc)
421
+ {
422
+ bind_init_elem_common(obind, svc, OCI_DTYPE_INTERVAL_YM);
423
+ }
424
+
425
+ static void bind_ociinterval_ym_free(oci8_base_t *base)
426
+ {
427
+ bind_free_common(base, OCI_DTYPE_INTERVAL_YM);
428
+ }
429
+
430
+ static VALUE bind_ociinterval_ds_get(oci8_bind_t *obind, void *data, void *null_struct)
431
+ {
432
+ return oci8_make_ociinterval_ds(*(OCIInterval **)data);
433
+ }
434
+
435
+ static void bind_ociinterval_ds_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
436
+ {
437
+ oci8_set_ociinterval_ds(*(OCIInterval **)data, val);
438
+ }
439
+
440
+ static void bind_ociinterval_ds_init_elem(oci8_bind_t *obind, VALUE svc)
441
+ {
442
+ bind_init_elem_common(obind, svc, OCI_DTYPE_INTERVAL_DS);
443
+ }
444
+
445
+ static void bind_ociinterval_ds_free(oci8_base_t *base)
446
+ {
447
+ bind_free_common(base, OCI_DTYPE_INTERVAL_DS);
448
+ }
449
+
450
+ static const oci8_bind_vtable_t bind_ociinterval_ym_vtable = {
451
+ {
452
+ NULL,
453
+ bind_ociinterval_ym_free,
454
+ sizeof(oci8_bind_t)
455
+ },
456
+ bind_ociinterval_ym_get,
457
+ bind_ociinterval_ym_set,
458
+ bind_init_common,
459
+ bind_ociinterval_ym_init_elem,
460
+ NULL,
461
+ SQLT_INTERVAL_YM
462
+ };
463
+
464
+ static const oci8_bind_vtable_t bind_ociinterval_ds_vtable = {
465
+ {
466
+ NULL,
467
+ bind_ociinterval_ds_free,
468
+ sizeof(oci8_bind_t)
469
+ },
470
+ bind_ociinterval_ds_get,
471
+ bind_ociinterval_ds_set,
472
+ bind_init_common,
473
+ bind_ociinterval_ds_init_elem,
474
+ NULL,
475
+ SQLT_INTERVAL_DS
476
+ };
477
+
478
+ void Init_oci_datetime(void)
479
+ {
480
+ oci8_define_bind_class("OCITimestamp", &bind_ocitimestamp_vtable);
481
+ oci8_define_bind_class("OCITimestampTZ", &bind_ocitimestamp_tz_vtable);
482
+ oci8_define_bind_class("OCIIntervalYM", &bind_ociinterval_ym_vtable);
483
+ oci8_define_bind_class("OCIIntervalDS", &bind_ociinterval_ds_vtable);
484
+ }