ruby-staci 2.2.9

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 (115) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +14 -0
  3. data/COPYING +30 -0
  4. data/COPYING_old +64 -0
  5. data/ChangeLog +3826 -0
  6. data/Makefile +92 -0
  7. data/NEWS +1194 -0
  8. data/README.md +66 -0
  9. data/dist-files +113 -0
  10. data/docs/bind-array-to-in_cond.md +38 -0
  11. data/docs/conflicts-local-connections-and-processes.md +98 -0
  12. data/docs/hanging-after-inactivity.md +63 -0
  13. data/docs/install-binary-package.md +44 -0
  14. data/docs/install-full-client.md +111 -0
  15. data/docs/install-instant-client.md +194 -0
  16. data/docs/install-on-osx.md +133 -0
  17. data/docs/ldap-auth-and-function-interposition.md +123 -0
  18. data/docs/number-type-mapping.md +79 -0
  19. data/docs/osx-install-dev-tools.png +0 -0
  20. data/docs/platform-specific-issues.md +164 -0
  21. data/docs/report-installation-issue.md +50 -0
  22. data/docs/timeout-parameters.md +94 -0
  23. data/ext/oci8/.document +18 -0
  24. data/ext/oci8/MANIFEST +18 -0
  25. data/ext/oci8/apiwrap.c.tmpl +178 -0
  26. data/ext/oci8/apiwrap.h.tmpl +61 -0
  27. data/ext/oci8/apiwrap.rb +96 -0
  28. data/ext/oci8/apiwrap.yml +1322 -0
  29. data/ext/oci8/attr.c +57 -0
  30. data/ext/oci8/bind.c +838 -0
  31. data/ext/oci8/connection_pool.c +216 -0
  32. data/ext/oci8/encoding.c +196 -0
  33. data/ext/oci8/env.c +139 -0
  34. data/ext/oci8/error.c +385 -0
  35. data/ext/oci8/extconf.rb +219 -0
  36. data/ext/oci8/hook_funcs.c +407 -0
  37. data/ext/oci8/lob.c +1278 -0
  38. data/ext/oci8/metadata.c +279 -0
  39. data/ext/oci8/object.c +919 -0
  40. data/ext/oci8/oci8.c +1058 -0
  41. data/ext/oci8/oci8.h +556 -0
  42. data/ext/oci8/oci8lib.c +704 -0
  43. data/ext/oci8/ocidatetime.c +506 -0
  44. data/ext/oci8/ocihandle.c +852 -0
  45. data/ext/oci8/ocinumber.c +1922 -0
  46. data/ext/oci8/oraconf.rb +1145 -0
  47. data/ext/oci8/oradate.c +670 -0
  48. data/ext/oci8/oranumber_util.c +352 -0
  49. data/ext/oci8/oranumber_util.h +24 -0
  50. data/ext/oci8/plthook.h +66 -0
  51. data/ext/oci8/plthook_elf.c +702 -0
  52. data/ext/oci8/plthook_osx.c +505 -0
  53. data/ext/oci8/plthook_win32.c +391 -0
  54. data/ext/oci8/post-config.rb +5 -0
  55. data/ext/oci8/stmt.c +448 -0
  56. data/ext/oci8/thread_util.c +81 -0
  57. data/ext/oci8/thread_util.h +18 -0
  58. data/ext/oci8/util.c +71 -0
  59. data/ext/oci8/win32.c +117 -0
  60. data/lib/.document +1 -0
  61. data/lib/dbd/STACI.rb +591 -0
  62. data/lib/oci8/.document +8 -0
  63. data/lib/oci8/bindtype.rb +333 -0
  64. data/lib/oci8/check_load_error.rb +146 -0
  65. data/lib/oci8/compat.rb +117 -0
  66. data/lib/oci8/connection_pool.rb +179 -0
  67. data/lib/oci8/cursor.rb +605 -0
  68. data/lib/oci8/datetime.rb +605 -0
  69. data/lib/oci8/encoding-init.rb +45 -0
  70. data/lib/oci8/encoding.yml +537 -0
  71. data/lib/oci8/metadata.rb +2148 -0
  72. data/lib/oci8/object.rb +641 -0
  73. data/lib/oci8/oci8.rb +756 -0
  74. data/lib/oci8/ocihandle.rb +591 -0
  75. data/lib/oci8/oracle_version.rb +153 -0
  76. data/lib/oci8/properties.rb +196 -0
  77. data/lib/oci8/version.rb +3 -0
  78. data/lib/ruby-staci.rb +1 -0
  79. data/lib/staci.rb +190 -0
  80. data/metaconfig +142 -0
  81. data/pre-distclean.rb +7 -0
  82. data/ruby-aci.gemspec +83 -0
  83. data/setup.rb +1342 -0
  84. data/test/README.md +37 -0
  85. data/test/config.rb +201 -0
  86. data/test/setup_test_object.sql +199 -0
  87. data/test/setup_test_package.sql +59 -0
  88. data/test/test_all.rb +56 -0
  89. data/test/test_appinfo.rb +62 -0
  90. data/test/test_array_dml.rb +333 -0
  91. data/test/test_bind_array.rb +70 -0
  92. data/test/test_bind_boolean.rb +99 -0
  93. data/test/test_bind_integer.rb +47 -0
  94. data/test/test_bind_raw.rb +45 -0
  95. data/test/test_bind_string.rb +105 -0
  96. data/test/test_bind_time.rb +177 -0
  97. data/test/test_break.rb +124 -0
  98. data/test/test_clob.rb +86 -0
  99. data/test/test_connection_pool.rb +124 -0
  100. data/test/test_connstr.rb +220 -0
  101. data/test/test_datetime.rb +585 -0
  102. data/test/test_dbi.rb +365 -0
  103. data/test/test_dbi_clob.rb +53 -0
  104. data/test/test_encoding.rb +103 -0
  105. data/test/test_error.rb +87 -0
  106. data/test/test_metadata.rb +2674 -0
  107. data/test/test_object.rb +546 -0
  108. data/test/test_oci8.rb +624 -0
  109. data/test/test_oracle_version.rb +68 -0
  110. data/test/test_oradate.rb +255 -0
  111. data/test/test_oranumber.rb +786 -0
  112. data/test/test_package_type.rb +981 -0
  113. data/test/test_properties.rb +17 -0
  114. data/test/test_rowid.rb +32 -0
  115. metadata +158 -0
data/ext/oci8/oci8.h ADDED
@@ -0,0 +1,556 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * oci8.h - part of ruby-oci8
4
+ *
5
+ * Copyright (C) 2002-2016 Kubo Takehiro <kubo@jiubao.org>
6
+ */
7
+ #ifndef _RUBY_OCI_H_
8
+ #define _RUBY_OCI_H_ 1
9
+
10
+ #include "ruby.h"
11
+ #include <stdio.h>
12
+ #include <stdlib.h>
13
+ #include <assert.h>
14
+
15
+ #ifdef __cplusplus
16
+ extern "C"
17
+ {
18
+ #endif
19
+ #include <aci.h>
20
+ #ifdef __cplusplus
21
+ }
22
+ #endif
23
+
24
+ /*
25
+ * Oracle version number format in 32-bit integer.
26
+ *
27
+ * Oracle 12c or earier Oracle 18c or later
28
+ *
29
+ * hexadecimal -> dotted version number hexadecimal -> dotted version number
30
+ * 0c102304 -> 12.1.2.3.4 12012034 -> 18.1.2.3.4
31
+ * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
32
+ * 0c ------------' | | | | 2 bytes 12 ------------' | | | | 2 bytes
33
+ * 1 --------------' | | | 1 byte 01 -------------' | | | 2 bytes
34
+ * 02 --------------' | | 2 bytes 2 --------------' | | 1 byte
35
+ * 3 ---------------' | 1 byte 03 --------------' | 2 bytes
36
+ * 04 ---------------' 2 bytes 4 ---------------' 1 byte
37
+ */
38
+ #define ORAVERNUM(major, minor, update, patch, port_update) \
39
+ (((major) >= 18) ? (((major) << 24) | ((minor) << 16) | ((update) << 12) | ((patch) << 4) | (port_update)) \
40
+ : (((major) << 24) | ((minor) << 20) | ((update) << 12) | ((patch) << 8) | (port_update)))
41
+
42
+ #define ORAVER_8_0 ORAVERNUM(8, 0, 0, 0, 0)
43
+ #define ORAVER_8_1 ORAVERNUM(8, 1, 0, 0, 0)
44
+ #define ORAVER_9_0 ORAVERNUM(9, 0, 0, 0, 0)
45
+ #define ORAVER_9_2 ORAVERNUM(9, 2, 0, 0, 0)
46
+ #define ORAVER_10_1 ORAVERNUM(10, 1, 0, 0, 0)
47
+ #define ORAVER_10_2 ORAVERNUM(10, 2, 0, 0, 0)
48
+ #define ORAVER_11_1 ORAVERNUM(11, 1, 0, 0, 0)
49
+ #define ORAVER_12_1 ORAVERNUM(12, 1, 0, 0, 0)
50
+ #define ORAVER_18 ORAVERNUM(18, 0, 0, 0, 0)
51
+
52
+ #include "extconf.h"
53
+ #include <ruby/encoding.h>
54
+
55
+ #ifndef OCI_TEMP_CLOB
56
+ #define OCI_TEMP_CLOB 1
57
+ #endif
58
+ #ifndef OCI_TEMP_BLOB
59
+ #define OCI_TEMP_BLOB 2
60
+ #endif
61
+
62
+ #ifndef ORAXB8_DEFINED
63
+ #if SIZEOF_LONG == 8
64
+ typedef unsigned long oraub8;
65
+ typedef signed long orasb8;
66
+ #elif SIZEOF_LONG_LONG == 8
67
+ typedef unsigned long long oraub8;
68
+ typedef signed long long orasb8;
69
+ #elif SIZEOF___INT64 == 8
70
+ typedef unsigned __int64 oraub8;
71
+ typedef signed __int64 orasb8;
72
+ #endif
73
+ typedef oraub8 ub8;
74
+ typedef orasb8 sb8;
75
+ #endif /* ORAXB8_DEFINED */
76
+
77
+ #if defined RBX_CAPI_RUBY_H
78
+ /* rubinius 2.0 */
79
+ #ifndef HAVE_RB_ENC_STR_BUF_CAT
80
+ #define rb_enc_str_buf_cat(str, ptr, len, enc) \
81
+ rb_str_concat((str), rb_enc_str_new((ptr), (len), (enc)))
82
+ #endif
83
+ #ifndef HAVE_RB_STR_BUF_CAT_ASCII
84
+ #define rb_str_buf_cat_ascii(str, ptr) \
85
+ rb_str_concat((str), rb_usascii_str_new_cstr(ptr))
86
+ #endif
87
+ #ifndef STRINGIZE
88
+ #define STRINGIZE(name) #name
89
+ #endif
90
+ #endif
91
+
92
+ /*
93
+ * Use TypedData on ruby 1.9.3 and later.
94
+ */
95
+ #ifndef HAVE_RB_DATA_TYPE_T_FUNCTION
96
+
97
+ /*
98
+ * Don't use TypedData even though ruby 1.9.2 has it because the
99
+ * definitions are slightly different from ruby 1.9.3 and later.
100
+ */
101
+ #define rb_data_type_t oci8_data_type_t
102
+ #undef TypedData_Make_Struct
103
+ #undef TypedData_Wrap_Struct
104
+ #undef TypedData_Get_Struct
105
+ #undef RTYPEDDATA_DATA
106
+ #undef RUBY_DEFAULT_FREE
107
+
108
+ /*
109
+ * To pass compilation on ruby 1.9.2 and earlier.
110
+ */
111
+ typedef struct oci8_data_type_struct rb_data_type_t;
112
+ struct oci8_data_type_struct {
113
+ const char *wrap_struct_name;
114
+ struct {
115
+ void (*dmark)(void*);
116
+ void (*dfree)(void*);
117
+ size_t (*dsize)(const void *);
118
+ } function;
119
+ const rb_data_type_t *parent;
120
+ void *data;
121
+ };
122
+ #define TypedData_Make_Struct(klass, type, data_type, sval) \
123
+ Data_Make_Struct((klass), type, (data_type)->function.dmark, (data_type)->function.dfree, (sval))
124
+ #define TypedData_Wrap_Struct(klass, data_type, sval) \
125
+ Data_Wrap_Struct((klass), (data_type)->function.dmark, (data_type)->function.dfree, (sval))
126
+ #define TypedData_Get_Struct(obj, type, data_type, sval) \
127
+ Data_Get_Struct((obj), type, (sval))
128
+ #define RTYPEDDATA_DATA(obj) DATA_PTR(obj)
129
+ #define RUBY_DEFAULT_FREE xfree
130
+ #endif
131
+
132
+ /* a new function in ruby 1.9.3.
133
+ * define a compatible macro for ruby 1.9.2 or lower.
134
+ */
135
+ #ifndef HAVE_RB_CLASS_SUPERCLASS
136
+ #ifdef RCLASS_SUPER
137
+ #define rb_class_superclass(cls) RCLASS_SUPER(cls)
138
+ #else
139
+ #define rb_class_superclass(cls) (RCLASS(cls)->super)
140
+ #endif
141
+ #endif
142
+
143
+ /* new macros in ruby 2.1.0
144
+ */
145
+ #ifndef RARRAY_AREF
146
+ #define RARRAY_AREF(a, i) (RARRAY_PTR(a)[i])
147
+ #endif
148
+ #ifndef RARRAY_CONST_PTR
149
+ #define RARRAY_CONST_PTR(a) RARRAY_PTR(a)
150
+ #endif
151
+ #ifndef RB_OBJ_WRITE
152
+ #define RB_OBJ_WRITE(a, slot, b) do {*(slot) = (b);} while (0)
153
+ #endif
154
+ #ifndef RB_OBJ_WRITTEN
155
+ #define RB_OBJ_WRITTEN(a, oldv, b) do {(void)oldv;} while (0)
156
+ #endif
157
+
158
+ /* new macros in ruby 2.4.0
159
+ */
160
+ #ifndef ALWAYS_INLINE
161
+ #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
162
+ /* gcc version >= 3.1 */
163
+ #define ALWAYS_INLINE(x) __attribute__((always_inline)) x
164
+ #endif
165
+ #ifdef _MSC_VER
166
+ /* microsoft c */
167
+ #define ALWAYS_INLINE(x) __forceinline x
168
+ #endif
169
+ #ifndef ALWAYS_INLINE
170
+ #define ALWAYS_INLINE(x) x
171
+ #endif
172
+ #endif /* ALWAYS_INLINE */
173
+
174
+ /* macros depends on the compiler.
175
+ * LIKELY(x) hint for the compiler that 'x' is 1(TRUE) in many cases.
176
+ * UNLIKELY(x) hint for the compiler that 'x' is 0(FALSE) in many cases.
177
+ */
178
+ #if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
179
+ /* gcc version >= 2.96 */
180
+ #define LIKELY(x) (__builtin_expect((x), 1))
181
+ #define UNLIKELY(x) (__builtin_expect((x), 0))
182
+ #else
183
+ /* other compilers */
184
+ #define LIKELY(x) (x)
185
+ #define UNLIKELY(x) (x)
186
+ #endif
187
+
188
+ /* macros to access thread-local storage.
189
+ *
190
+ * void *oci8_tls_get(oci8_tls_key_t key);
191
+ * get a value associated with the key.
192
+ *
193
+ * void oci8_tls_set(oci8_tls_key_t key, void *value);
194
+ * set a value to the key.
195
+ *
196
+ */
197
+ #if defined(_WIN32)
198
+ #include <windows.h>
199
+ #define oci8_tls_key_t DWORD
200
+ #define oci8_tls_get(key) TlsGetValue(key)
201
+ #define oci8_tls_set(key, val) TlsSetValue((key), (val))
202
+ #else
203
+ #include <pthread.h>
204
+ #define oci8_tls_key_t pthread_key_t
205
+ #define oci8_tls_get(key) pthread_getspecific(key)
206
+ #define oci8_tls_set(key, val) pthread_setspecific((key), (val))
207
+ #endif
208
+
209
+ /* utility macros
210
+ */
211
+ #define IS_OCI_ERROR(v) (((v) != OCI_SUCCESS) && ((v) != OCI_SUCCESS_WITH_INFO))
212
+ #define TO_ORATEXT to_oratext
213
+ #define TO_CONST_ORATEXT to_const_oratext
214
+ #define TO_CHARPTR to_charptr
215
+ ALWAYS_INLINE(static OraText *to_oratext(char *c));
216
+ static inline OraText *to_oratext(char *c)
217
+ {
218
+ return (OraText*)c;
219
+ }
220
+ ALWAYS_INLINE(static const OraText *to_const_oratext(const char *c));
221
+ static inline const OraText *to_const_oratext(const char *c)
222
+ {
223
+ return (const OraText*)c;
224
+ }
225
+ ALWAYS_INLINE(static char *to_charptr(OraText *c));
226
+ static inline char *to_charptr(OraText *c)
227
+ {
228
+ return (char*)c;
229
+ }
230
+ #define RSTRING_ORATEXT(obj) TO_ORATEXT(RSTRING_PTR(obj))
231
+ #define rb_str_new2_ora(str) rb_str_new2(TO_CHARPTR(str))
232
+
233
+ #define TO_BIND(obj) ((oci8_bind_t *)oci8_check_typeddata((obj), &oci8_bind_data_type, 1))
234
+
235
+ /*
236
+ * prevent rdoc from gathering the specified method.
237
+ */
238
+ #define rb_define_method_nodoc rb_define_method
239
+ #define rb_define_singleton_method_nodoc rb_define_singleton_method
240
+
241
+ /* data structure for SQLT_LVC and SQLT_LVB. */
242
+ typedef struct {
243
+ sb4 size;
244
+ char buf[1];
245
+ } oci8_vstr_t;
246
+
247
+ typedef struct oci8_handle_data_type oci8_handle_data_type_t;
248
+ typedef struct oci8_bind_data_type oci8_bind_data_type_t;
249
+
250
+ typedef struct oci8_base oci8_base_t;
251
+ typedef struct oci8_bind oci8_bind_t;
252
+
253
+ /* The virtual method table of oci8_base_t */
254
+ struct oci8_handle_data_type {
255
+ rb_data_type_t rb_data_type;
256
+ void (*free)(oci8_base_t *base);
257
+ size_t size;
258
+ };
259
+
260
+ /* The virtual method table of oci8_bind_t */
261
+ struct oci8_bind_data_type {
262
+ oci8_handle_data_type_t base;
263
+ VALUE (*get)(oci8_bind_t *obind, void *data, void *null_struct);
264
+ void (*set)(oci8_bind_t *obind, void *data, void **null_structp, VALUE val);
265
+ void (*init)(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length);
266
+ void (*init_elem)(oci8_bind_t *obind, VALUE svc);
267
+ void (*pre_fetch_hook)(oci8_bind_t *obind, VALUE svc);
268
+ ub2 dty;
269
+ void (*post_bind_hook)(oci8_bind_t *obind);
270
+ };
271
+
272
+ /* Class structure implemented by C language.
273
+ * oci8_base_t represents OCIHandle and its subclasses.
274
+ *
275
+ */
276
+ struct oci8_base {
277
+ const oci8_handle_data_type_t *data_type;
278
+ ub4 type;
279
+ ub1 closed;
280
+ union {
281
+ dvoid *ptr;
282
+ OCISvcCtx *svc;
283
+ OCICPool *poolhp;
284
+ OCIServer *srvhp;
285
+ OCISession *usrhp;
286
+ OCIStmt *stmt;
287
+ OCIDefine *dfn;
288
+ OCIBind *bnd;
289
+ OCIParam *prm;
290
+ OCILobLocator *lob;
291
+ OCIType *tdo;
292
+ OCIDescribe *dschp;
293
+ } hp;
294
+ VALUE self;
295
+ oci8_base_t *parent;
296
+ oci8_base_t *next;
297
+ oci8_base_t *prev;
298
+ oci8_base_t *children;
299
+ };
300
+
301
+ /* Class structure implemented by C language.
302
+ * This represents STACI::BindType::Base's subclasses.
303
+ *
304
+ * This is a subclass of oci8_base_t because the first member
305
+ * base is oci8_base_t itself.
306
+ */
307
+ struct oci8_bind {
308
+ oci8_base_t base;
309
+ void *valuep;
310
+ sb4 value_sz; /* size to define or bind. */
311
+ sb4 alloc_sz; /* size of a element. */
312
+ ub4 maxar_sz; /* maximum array size. */
313
+ ub4 curar_sz; /* current array size. */
314
+ ub4 curar_idx;/* current array index. */
315
+ VALUE tdo;
316
+ union {
317
+ void **null_structs;
318
+ sb2 *inds;
319
+ } u;
320
+ };
321
+
322
+ typedef struct oci8_logoff_strategy oci8_logoff_strategy_t;
323
+
324
+ typedef struct oci8_temp_lob {
325
+ struct oci8_temp_lob *next;
326
+ OCILobLocator *lob;
327
+ } oci8_temp_lob_t;
328
+
329
+ typedef struct oci8_svcctx {
330
+ oci8_base_t base;
331
+ volatile VALUE executing_thread;
332
+ const oci8_logoff_strategy_t *logoff_strategy;
333
+ OCISession *usrhp;
334
+ OCIServer *srvhp;
335
+ ub4 server_version;
336
+ rb_pid_t pid;
337
+ unsigned char state;
338
+ char is_autocommit;
339
+ char suppress_free_temp_lobs;
340
+ char non_blocking;
341
+ VALUE long_read_len;
342
+ oci8_temp_lob_t *temp_lobs;
343
+ } oci8_svcctx_t;
344
+
345
+ struct oci8_logoff_strategy {
346
+ void *(*prepare)(oci8_svcctx_t *svcctx);
347
+ void *(*execute)(void *);
348
+ };
349
+
350
+ typedef struct {
351
+ dvoid *hp; /* OCIBind* or OCIDefine* */
352
+ dvoid *valuep;
353
+ sb4 value_sz;
354
+ ub2 dty;
355
+ sb2 *indp;
356
+ ub2 *alenp;
357
+ } oci8_exec_sql_var_t;
358
+
359
+ #define oci8_raise(err, status, stmt) oci8_do_raise(err, status, stmt, __FILE__, __LINE__)
360
+ #define oci8_env_raise(env, status) oci8_do_env_raise(env, status, 0, __FILE__, __LINE__)
361
+ #define oci8_env_free_and_raise(env, status) oci8_do_env_raise(env, status, 1, __FILE__, __LINE__)
362
+ #define oci8_raise_init_error() oci8_do_raise_init_error(__FILE__, __LINE__)
363
+ #define oci8_raise_by_msgno(msgno, default_msg) oci8_do_raise_by_msgno(msgno, default_msg, __FILE__, __LINE__)
364
+
365
+ #define chkerr(status) oci8_check_error_((status), NULL, NULL, __FILE__, __LINE__)
366
+ #define chker2(status, base) oci8_check_error_((status), (base), NULL, __FILE__, __LINE__)
367
+ #define chker3(status, base, stmt) oci8_check_error_((status), (base), (stmt), __FILE__, __LINE__)
368
+
369
+ /* The folloiwng macros oci8_envhp and oci8_errhp are used
370
+ * as if they are defined as follows:
371
+ *
372
+ * extern OCIEnv *oci8_envhp;
373
+ * extern OCIError *oci8_errhp;
374
+ */
375
+ #define oci8_envhp (LIKELY(oci8_global_envhp != NULL) ? oci8_global_envhp : oci8_make_envhp())
376
+ #define oci8_errhp oci8_get_errhp()
377
+
378
+ /* env.c */
379
+ extern ub4 oci8_env_mode;
380
+ extern OCIEnv *oci8_global_envhp;
381
+ OCIEnv *oci8_make_envhp(void);
382
+ extern oci8_tls_key_t oci8_tls_key; /* native thread key */
383
+ OCIError *oci8_make_errhp(void);
384
+
385
+ static inline OCIError *oci8_get_errhp()
386
+ {
387
+ OCIError *errhp = (OCIError *)oci8_tls_get(oci8_tls_key);
388
+ return LIKELY(errhp != NULL) ? errhp : oci8_make_errhp();
389
+ }
390
+
391
+ void Init_oci8_env(void);
392
+
393
+ /* oci8lib.c */
394
+ extern ID oci8_id_at_last_error;
395
+ extern ID oci8_id_get;
396
+ extern ID oci8_id_set;
397
+ #ifdef CHAR_IS_NOT_A_SHORTCUT_TO_ID
398
+ extern ID oci8_id_add_op; /* ID of the addition operator '+' */
399
+ extern ID oci8_id_sub_op; /* ID of the subtraction operator '-' */
400
+ extern ID oci8_id_mul_op; /* ID of the multiplication operator '*' */
401
+ extern ID oci8_id_div_op; /* ID of the division operator '/' */
402
+ #else
403
+ #define oci8_id_add_op '+'
404
+ #define oci8_id_sub_op '-'
405
+ #define oci8_id_mul_op '*'
406
+ #define oci8_id_div_op '/'
407
+ #endif
408
+ extern int oci8_in_finalizer;
409
+ extern VALUE oci8_cOCIHandle;
410
+ void oci8_base_free(oci8_base_t *base);
411
+ VALUE oci8_define_class(const char *name, const oci8_handle_data_type_t *data_type, VALUE (*alloc_func)(VALUE));
412
+ VALUE oci8_define_class_under(VALUE outer, const char *name, const oci8_handle_data_type_t *data_type, VALUE (*alloc_func)(VALUE));
413
+ VALUE oci8_define_bind_class(const char *name, const oci8_bind_data_type_t *data_type, VALUE (*alloc_func)(VALUE));
414
+ void oci8_link_to_parent(oci8_base_t *base, oci8_base_t *parent);
415
+ void oci8_unlink_from_parent(oci8_base_t *base);
416
+ sword oci8_call_without_gvl(oci8_svcctx_t *svcctx, void *(*func)(void *), void *data);
417
+ sword oci8_exec_sql(oci8_svcctx_t *svcctx, const char *sql_text, ub4 num_define_vars, oci8_exec_sql_var_t *define_vars, ub4 num_bind_vars, oci8_exec_sql_var_t *bind_vars, int raise_on_error);
418
+ #if defined RUNTIME_API_CHECK
419
+ void *oci8_find_symbol(const char *symbol_name);
420
+ #endif
421
+ void *oci8_check_typeddata(VALUE obj, const oci8_handle_data_type_t *data_type, int error_if_closed);
422
+
423
+ /* error.c */
424
+ extern VALUE eOCIException;
425
+ extern VALUE eOCIBreak;
426
+ void Init_oci8_error(void);
427
+ NORETURN(void oci8_do_raise(OCIError *errhp, sword status, OCIStmt *stmthp, const char *file, int line));
428
+ NORETURN(void oci8_do_env_raise(OCIEnv *envhp, sword status, int free_envhp, const char *file, int line));
429
+ NORETURN(void oci8_do_raise_init_error(const char *file, int line));
430
+ sb4 oci8_get_error_code(OCIError *errhp);
431
+ VALUE oci8_get_error_message(ub4 msgno, const char *default_msg);
432
+ NORETURN(void oci8_do_raise_by_msgno(ub4 msgno, const char *default_msg, const char *file, int line));
433
+ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const char *file, int line);
434
+
435
+ /* ocihandle.c */
436
+ extern const oci8_handle_data_type_t oci8_handle_data_type;
437
+ void Init_oci8_handle(void);
438
+ VALUE oci8_allocate_typeddata(VALUE klass, const oci8_handle_data_type_t *data_type);
439
+ void oci8_handle_cleanup(void *ptr);
440
+ size_t oci8_handle_size(const void *ptr);
441
+
442
+ /* oci8.c */
443
+ void Init_oci8(VALUE *out);
444
+ void oci8_do_parse_connect_string(VALUE conn_str, VALUE *user, VALUE *pass, VALUE *dbname, VALUE *mode);
445
+ oci8_svcctx_t *oci8_get_svcctx(VALUE obj);
446
+ OCISession *oci8_get_oci_session(VALUE obj);
447
+ void oci8_check_pid_consistency(oci8_svcctx_t *svcctx);
448
+ #define TO_SESSION oci8_get_oci_session
449
+
450
+ /* connection_pool.c */
451
+ void Init_oci8_connection_pool(VALUE cOCI8);
452
+
453
+ /* stmt.c */
454
+ void Init_oci8_stmt(VALUE cOCI8);
455
+
456
+ /* bind.c */
457
+ typedef struct {
458
+ void *hp;
459
+ VALUE obj;
460
+ } oci8_hp_obj_t;
461
+ extern const oci8_handle_data_type_t oci8_bind_data_type;
462
+ void oci8_bind_free(oci8_base_t *base);
463
+ void oci8_bind_hp_obj_mark(oci8_base_t *base);
464
+ void Init_oci8_bind(VALUE cOCI8BindTypeBase);
465
+
466
+ /* metadata.c */
467
+ extern const oci8_handle_data_type_t oci8_metadata_base_data_type;
468
+ VALUE oci8_do_describe(VALUE self, void *objptr, ub4 objlen, ub1 objtype, VALUE klass, VALUE check_public);
469
+ void Init_oci8_metadata(VALUE cOCI8);
470
+ VALUE oci8_metadata_create(OCIParam *parmhp, VALUE svc, VALUE parent);
471
+
472
+ /* lob.c */
473
+ void Init_oci8_lob(VALUE cOCI8);
474
+ VALUE oci8_make_clob(oci8_svcctx_t *svcctx, OCILobLocator *s);
475
+ VALUE oci8_make_nclob(oci8_svcctx_t *svcctx, OCILobLocator *s);
476
+ VALUE oci8_make_blob(oci8_svcctx_t *svcctx, OCILobLocator *s);
477
+ VALUE oci8_make_bfile(oci8_svcctx_t *svcctx, OCILobLocator *s);
478
+ void oci8_assign_clob(oci8_svcctx_t *svcctx, VALUE lob, OCILobLocator **dest);
479
+ void oci8_assign_nclob(oci8_svcctx_t *svcctx, VALUE lob, OCILobLocator **dest);
480
+ void oci8_assign_blob(oci8_svcctx_t *svcctx, VALUE lob, OCILobLocator **dest);
481
+ void oci8_assign_bfile(oci8_svcctx_t *svcctx, VALUE lob, OCILobLocator **dest);
482
+
483
+ /* oradate.c */
484
+ void Init_ora_date(void);
485
+
486
+ /* ocinumber.c */
487
+ extern int oci8_float_conversion_type_is_ruby;
488
+ void Init_oci_number(VALUE mOCI, OCIError *errhp);
489
+ /* OraNumber (ruby object) -> OCINumber (C datatype) */
490
+ OCINumber *oci8_get_ocinumber(VALUE num);
491
+ /* OCINumber (C datatype) -> OraNumber (ruby object) */
492
+ VALUE oci8_make_ocinumber(OCINumber *s, OCIError *errhp);
493
+ /* OCINumber (C datatype) -> Integer (ruby object) */
494
+ VALUE oci8_make_integer(OCINumber *s, OCIError *errhp);
495
+ /* OCINumber (C datatype) -> Float (ruby object) */
496
+ VALUE oci8_make_float(OCINumber *s, OCIError *errhp);
497
+ /* Numeric (ruby object) -> OCINumber (C datatype) */
498
+ OCINumber *oci8_set_ocinumber(OCINumber *result, VALUE self, OCIError *errhp);
499
+ /* Numeric (ruby object) -> OCINumber (C datatype) as an integer */
500
+ OCINumber *oci8_set_integer(OCINumber *result, VALUE self, OCIError *errhp);
501
+ /* OCINumber (C datatype) -> double (C datatype) */
502
+ double oci8_onum_to_dbl(OCINumber *s, OCIError *errhp);
503
+ /* double (C datatype) -> OCINumber (C datatype) */
504
+ OCINumber *oci8_dbl_to_onum(OCINumber *result, double dbl, OCIError *errhp);
505
+
506
+ /* ocidatetim.c */
507
+ void Init_oci_datetime(void);
508
+ VALUE oci8_make_ocidate(OCIDate *od);
509
+ OCIDate *oci8_set_ocidate(OCIDate *od, VALUE val);
510
+ VALUE oci8_make_ocitimestamp(OCIDateTime *dttm, boolean have_tz);
511
+ OCIDateTime *oci8_set_ocitimestamp_tz(OCIDateTime *dttm, VALUE val, VALUE svc);
512
+ VALUE oci8_make_interval_ym(OCIInterval *s);
513
+ VALUE oci8_make_interval_ds(OCIInterval *s);
514
+
515
+ /* object.c */
516
+ void Init_oci_object(VALUE mOCI);
517
+
518
+ /* attr.c */
519
+ VALUE oci8_get_rowid_attr(oci8_base_t *base, ub4 attrtype, OCIStmt *stmtp);
520
+
521
+ /* encoding.c */
522
+ void Init_oci8_encoding(VALUE cOCI8);
523
+ extern int oci8_nls_ratio;
524
+ extern rb_encoding *oci8_encoding;
525
+
526
+ /* util.c */
527
+ void Init_oci8_util(VALUE cOCI8);
528
+ const char *oci8_dll_path(void);
529
+
530
+ /* win32.c */
531
+ void Init_oci8_win32(VALUE cOCI8);
532
+
533
+ /* hook_funcs.c */
534
+ void oci8_install_hook_functions(void);
535
+ void oci8_shutdown_sockets(void);
536
+ #ifdef HAVE_PLTHOOK
537
+ extern int oci8_cancel_read_at_exit;
538
+ extern int oci8_tcp_keepalive_time;
539
+ #else
540
+ #define oci8_cancel_read_at_exit (-1)
541
+ #define oci8_tcp_keepalive_time (-1)
542
+ #endif
543
+
544
+ #define OCI8StringValue(v) do { \
545
+ StringValue(v); \
546
+ (v) = rb_str_export_to_enc(v, oci8_encoding); \
547
+ } while (0)
548
+ #define OCI8SafeStringValue(v) do { \
549
+ SafeStringValue(v); \
550
+ (v) = rb_str_export_to_enc(v, oci8_encoding); \
551
+ } while (0)
552
+
553
+ #include "thread_util.h"
554
+ #include "apiwrap.h"
555
+
556
+ #endif