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
@@ -0,0 +1,352 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ #include <stdio.h>
3
+ #include <string.h>
4
+ #include "oranumber_util.h"
5
+
6
+ int oranumber_to_str(const ACINumber *on, char *buf, int buflen)
7
+ {
8
+ signed char exponent;
9
+ signed char mantissa[21]; /* terminated by a negative number */
10
+ int datalen = on->ACINumberPart[0];
11
+ int len = 0;
12
+ int idx;
13
+ int n;
14
+ #define PUTC(chr) do { \
15
+ if (len < buflen) { \
16
+ buf[len++] = (chr); \
17
+ } else { \
18
+ return ORANUMBER_TOO_SHORT_BUFFER; \
19
+ } \
20
+ } while(0)
21
+ #define PUTEND() do { \
22
+ if (len < buflen) { \
23
+ buf[len] = '\0'; \
24
+ } else { \
25
+ return ORANUMBER_TOO_SHORT_BUFFER; \
26
+ } \
27
+ } while(0)
28
+
29
+ if (datalen == 0) {
30
+ /* too short */
31
+ return -1;
32
+ }
33
+ if (datalen == 1) {
34
+ if (on->ACINumberPart[1] == 0x80) {
35
+ /* zero */
36
+ PUTC('0');
37
+ PUTEND();
38
+ return 1;
39
+ }
40
+ if (on->ACINumberPart[1] == 0) {
41
+ /* negative infinity */
42
+ PUTC('-');
43
+ PUTC('~');
44
+ PUTEND();
45
+ return 2;
46
+ }
47
+ /* unexpected format */
48
+ return -1;
49
+ }
50
+ if (datalen == 2) {
51
+ if (on->ACINumberPart[1] == 255 && on->ACINumberPart[2] == 101) {
52
+ /* positive infinity */
53
+ PUTC('~');
54
+ PUTEND();
55
+ return 1;
56
+ }
57
+ }
58
+ if (datalen > 21) {
59
+ /* too long */
60
+ return -1;
61
+ }
62
+ /* normalize exponent and mantissa */
63
+ if (on->ACINumberPart[1] >= 128) {
64
+ /* positive number */
65
+ exponent = on->ACINumberPart[1] - 193;
66
+ for (idx = 0; idx < on->ACINumberPart[0] - 1; idx++) {
67
+ mantissa[idx] = on->ACINumberPart[idx + 2] - 1;
68
+ }
69
+ mantissa[idx] = -1;
70
+ } else {
71
+ /* negative number */
72
+ exponent = 62 - on->ACINumberPart[1];
73
+ for (idx = 0; idx < on->ACINumberPart[0] - 1; idx++) {
74
+ mantissa[idx] = 101 - on->ACINumberPart[idx + 2];
75
+ }
76
+ mantissa[idx] = -1;
77
+ PUTC('-');
78
+ }
79
+ /* convert exponent and mantissa to human readable number */
80
+ idx = 0;
81
+ if (exponent-- >= 0) {
82
+ /* integer part */
83
+ n = mantissa[idx++];
84
+ if (n / 10 != 0) {
85
+ PUTC(n / 10 + '0');
86
+ }
87
+ PUTC(n % 10 + '0');
88
+ while (exponent-- >= 0) {
89
+ n = mantissa[idx++];
90
+ if (n < 0) {
91
+ do {
92
+ PUTC('0');
93
+ PUTC('0');
94
+ } while (exponent-- >= 0);
95
+ PUTEND();
96
+ return len;
97
+ }
98
+ PUTC(n / 10 + '0');
99
+ PUTC(n % 10 + '0');
100
+ }
101
+ if (mantissa[idx] < 0) {
102
+ PUTEND();
103
+ return len;
104
+ }
105
+ } else {
106
+ PUTC('0');
107
+ }
108
+ PUTC('.');
109
+ /* fractional number part */
110
+ while (++exponent < -1) {
111
+ PUTC('0');
112
+ PUTC('0');
113
+ }
114
+ while ((n = mantissa[idx++]) >= 0) {
115
+ PUTC(n / 10 + '0');
116
+ PUTC(n % 10 + '0');
117
+ }
118
+ if (buf[len - 1] == '0') {
119
+ len--;
120
+ }
121
+ PUTEND();
122
+ return len;
123
+ }
124
+
125
+ int oranumber_from_str(ACINumber *on, const char *buf, int buflen)
126
+ {
127
+ const char *end;
128
+ int is_positive = 1;
129
+ char mantissa[41];
130
+ int dec_point;
131
+ long exponent = 0;
132
+ int idx = 0;
133
+ int i;
134
+
135
+ if (buflen < 0) {
136
+ end = buf + strlen(buf);
137
+ } else {
138
+ end = buf + buflen;
139
+ }
140
+
141
+ /* skip leading spaces */
142
+ while (buf < end && *buf == ' ') {
143
+ buf++;
144
+ }
145
+ if (buf == end) {
146
+ return ORANUMBER_INVALID_NUMBER;
147
+ }
148
+ /* read a sign mark */
149
+ if (*buf == '+') {
150
+ buf++;
151
+ } else if (*buf == '-') {
152
+ buf++;
153
+ is_positive = 0;
154
+ }
155
+ if (*buf == '~') {
156
+ buf ++;
157
+ /* skip trailing spaces */
158
+ while (buf < end && *buf == ' ') {
159
+ buf++;
160
+ }
161
+ if (buf != end) {
162
+ return ORANUMBER_INVALID_NUMBER;
163
+ }
164
+ if (is_positive) {
165
+ /* positive infinity */
166
+ on->ACINumberPart[0] = 2;
167
+ on->ACINumberPart[1] = 255;
168
+ on->ACINumberPart[2] = 101;
169
+ } else {
170
+ /* negative infinity */
171
+ on->ACINumberPart[0] = 1;
172
+ on->ACINumberPart[1] = 0;
173
+ }
174
+ return ORANUMBER_SUCCESS;
175
+ }
176
+
177
+ /* next should be number or a dot */
178
+ if ((*buf < '0' || '9' < *buf) && *buf != '.') {
179
+ return ORANUMBER_INVALID_NUMBER;
180
+ }
181
+ /* skip leading zeros */
182
+ while (buf < end) {
183
+ if (*buf == '0') {
184
+ buf++;
185
+ } else {
186
+ break;
187
+ }
188
+ }
189
+ /* read integer part */
190
+ while (buf < end) {
191
+ if ('0' <= *buf && *buf <= '9') {
192
+ if (idx < 41) {
193
+ mantissa[idx] = *buf - '0';
194
+ }
195
+ idx++;
196
+ } else if (*buf == '.' || *buf == 'E' || *buf == 'e' || *buf == ' ') {
197
+ break;
198
+ } else {
199
+ return ORANUMBER_INVALID_NUMBER;
200
+ }
201
+ buf++;
202
+ }
203
+ dec_point = idx;
204
+ /* read fractional part */
205
+ if (buf < end && *buf == '.') {
206
+ buf++;
207
+ if (idx == 0) {
208
+ /* skip leading zeros */
209
+ while (buf < end) {
210
+ if (*buf == '0') {
211
+ dec_point--;
212
+ buf++;
213
+ } else {
214
+ break;
215
+ }
216
+ }
217
+ }
218
+ while (buf < end) {
219
+ if ('0' <= *buf && *buf <= '9') {
220
+ if (idx < 41) {
221
+ mantissa[idx++] = *buf - '0';
222
+ }
223
+ } else if (*buf == 'E' || *buf == 'e' || *buf == ' ') {
224
+ break;
225
+ } else {
226
+ return ORANUMBER_INVALID_NUMBER;
227
+ }
228
+ buf++;
229
+ }
230
+ }
231
+ /* read exponent part */
232
+ if (buf < end && (*buf == 'E' || *buf == 'e')) {
233
+ int negate = 0;
234
+ buf++;
235
+ if (buf < end) {
236
+ if (*buf == '+') {
237
+ buf++;
238
+ } else if (*buf == '-') {
239
+ buf++;
240
+ negate = 1;
241
+ }
242
+ }
243
+ while (buf < end) {
244
+ if ('0' <= *buf && *buf <= '9') {
245
+ exponent *= 10;
246
+ exponent += *buf - '0';
247
+ } else if (*buf == ' ') {
248
+ break;
249
+ } else {
250
+ return ORANUMBER_INVALID_NUMBER;
251
+ }
252
+ buf++;
253
+ }
254
+ if (negate) {
255
+ exponent = -exponent;
256
+ }
257
+ }
258
+ /* skip trailing spaces */
259
+ while (buf < end && *buf == ' ') {
260
+ buf++;
261
+ }
262
+ /* final format check */
263
+ if (buf != end) {
264
+ return ORANUMBER_INVALID_NUMBER;
265
+ }
266
+ /* determine exponent */
267
+ exponent += dec_point - 1;
268
+ if (exponent % 2 == 0) {
269
+ memmove(mantissa + 1, mantissa, 40);
270
+ mantissa[0] = 0;
271
+ idx++;
272
+ }
273
+ /* round if needed */
274
+ if (idx > 40) {
275
+ idx = 40;
276
+ if (mantissa[40] >= 5) {
277
+ /* round up */
278
+ for (i = 39; i >= 0; i--) {
279
+ mantissa[i]++;
280
+ if (mantissa[i] == 10) {
281
+ mantissa[i] = 0;
282
+ } else {
283
+ break;
284
+ }
285
+ }
286
+ if (i == -1) {
287
+ /* all figures are rounded up. */
288
+ mantissa[0] = 0;
289
+ mantissa[1] = 1;
290
+ idx = 2;
291
+ exponent++;
292
+ }
293
+ }
294
+ }
295
+ /* shrink mantissa scale */
296
+ while (idx > 0 && mantissa[idx - 1] == 0) {
297
+ idx--;
298
+ }
299
+ /* check zero or underflow */
300
+ if (idx == 0 || exponent < -130) {
301
+ on->ACINumberPart[0] = 1;
302
+ on->ACINumberPart[1] = 0x80;
303
+ return ORANUMBER_SUCCESS;
304
+ }
305
+ /* check overflow */
306
+ if (exponent > 125) {
307
+ return ORANUMBER_NUMERIC_OVERFLOW;
308
+ }
309
+ /* change the base number from 10 to 100 */
310
+ if (idx % 2 == 1) {
311
+ mantissa[idx++] = 0;
312
+ }
313
+ idx /= 2;
314
+ for (i = 0; i < idx; i++) {
315
+ mantissa[i] = mantissa[i * 2] * 10 + mantissa[i * 2 + 1];
316
+ }
317
+ /* add negative value's terminator */
318
+ if (!is_positive && idx < 20) {
319
+ mantissa[idx++] = -1;
320
+ }
321
+ /* construct OCINumber */
322
+ on->ACINumberPart[0] = 1 + idx;
323
+ if (is_positive) {
324
+ on->ACINumberPart[1] = (exponent >> 1) + 193;
325
+ for (i = 0; i < idx; i++) {
326
+ on->ACINumberPart[i + 2] = mantissa[i] + 1;
327
+ }
328
+ } else {
329
+ on->ACINumberPart[1] = 62 - (exponent >> 1);
330
+ for (i = 0; i < idx; i++) {
331
+ on->ACINumberPart[i + 2] = 101 - mantissa[i];
332
+ }
333
+ }
334
+ return ORANUMBER_SUCCESS;
335
+ }
336
+
337
+ int oranumber_dump(const ACINumber *on, char *buf)
338
+ {
339
+ int idx;
340
+ int len = on->ACINumberPart[0];
341
+ int offset;
342
+
343
+ offset = sprintf(buf, "Typ=2 Len=%u: ", len);
344
+ if (len > 21) {
345
+ len = 21;
346
+ }
347
+ for (idx = 1; idx <= len; idx++) {
348
+ offset += sprintf(buf + offset, "%u,", (ub4)on->ACINumberPart[idx]);
349
+ }
350
+ buf[--offset] = '\0';
351
+ return offset;
352
+ }
@@ -0,0 +1,24 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * oranumber_util.h - part of ruby-oci8
4
+ *
5
+ * Copyright (C) 2010 KUBO Takehiro <kubo@jiubao.org>
6
+ */
7
+ #ifndef ORANUMBER_UTIL_H
8
+ #define ORANUMBER_UTIL_H 1
9
+ #include <aci.h>
10
+
11
+ #define ORANUMBER_INVALID_INTERNAL_FORMAT -1
12
+ #define ORANUMBER_TOO_SHORT_BUFFER -2
13
+
14
+ #define ORANUMBER_SUCCESS 0
15
+ #define ORANUMBER_INVALID_NUMBER 1722
16
+ #define ORANUMBER_NUMERIC_OVERFLOW 1426
17
+
18
+ int oranumber_to_str(const OCINumber *on, char *buf, int buflen);
19
+ int oranumber_from_str(OCINumber *on, const char *buf, int buflen);
20
+
21
+ #define ORANUMBER_DUMP_BUF_SIZ 99
22
+ int oranumber_dump(const OCINumber *on, char *buf);
23
+
24
+ #endif
@@ -0,0 +1,66 @@
1
+ /* -*- indent-tabs-mode: nil -*-
2
+ *
3
+ * plthook.h -- the header file of plthook
4
+ *
5
+ * URL: https://github.com/kubo/plthook
6
+ *
7
+ * ------------------------------------------------------
8
+ *
9
+ * Copyright 2013-2014 Kubo Takehiro <kubo@jiubao.org>
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without modification, are
12
+ * permitted provided that the following conditions are met:
13
+ *
14
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
15
+ * conditions and the following disclaimer.
16
+ *
17
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
18
+ * of conditions and the following disclaimer in the documentation and/or other materials
19
+ * provided with the distribution.
20
+ *
21
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR IMPLIED
22
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
24
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * The views and conclusions contained in the software and documentation are those of the
32
+ * authors and should not be interpreted as representing official policies, either expressed
33
+ * or implied, of the authors.
34
+ *
35
+ */
36
+ #ifndef PLTHOOK_H
37
+ #define PLTHOOK_H 1
38
+
39
+ #define PLTHOOK_SUCCESS 0
40
+ #define PLTHOOK_FILE_NOT_FOUND 1
41
+ #define PLTHOOK_INVALID_FILE_FORMAT 2
42
+ #define PLTHOOK_FUNCTION_NOT_FOUND 3
43
+ #define PLTHOOK_INVALID_ARGUMENT 4
44
+ #define PLTHOOK_OUT_OF_MEMORY 5
45
+ #define PLTHOOK_INTERNAL_ERROR 6
46
+ #define PLTHOOK_NOT_IMPLEMENTED 7
47
+
48
+ typedef struct plthook plthook_t;
49
+
50
+ #ifdef __cplusplus
51
+ extern "C" {
52
+ #endif
53
+
54
+ int plthook_open(plthook_t **plthook_out, const char *filename);
55
+ int plthook_open_by_handle(plthook_t **plthook_out, void *handle);
56
+ int plthook_open_by_address(plthook_t **plthook_out, void *address);
57
+ int plthook_enum(plthook_t *plthook, unsigned int *pos, const char **name_out, void ***addr_out);
58
+ int plthook_replace(plthook_t *plthook, const char *funcname, void *funcaddr, void **oldfunc);
59
+ void plthook_close(plthook_t *plthook);
60
+ const char *plthook_error(void);
61
+
62
+ #ifdef __cplusplus
63
+ }; /* extern "C" */
64
+ #endif
65
+
66
+ #endif