ruby-oci8 1.0.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1254 -390
- data/Makefile +10 -13
- data/README +56 -385
- data/VERSION +1 -1
- data/dist-files +26 -27
- data/ext/oci8/.document +1 -0
- data/ext/oci8/MANIFEST +0 -4
- data/ext/oci8/apiwrap.c.tmpl +172 -0
- data/ext/oci8/apiwrap.h.tmpl +61 -0
- data/ext/oci8/apiwrap.rb +91 -0
- data/ext/oci8/apiwrap.yml +1243 -0
- data/ext/oci8/attr.c +124 -384
- data/ext/oci8/bind.c +472 -164
- data/ext/oci8/encoding.c +196 -0
- data/ext/oci8/env.c +84 -253
- data/ext/oci8/error.c +196 -127
- data/ext/oci8/extconf.rb +82 -59
- data/ext/oci8/lob.c +710 -370
- data/ext/oci8/metadata.c +359 -0
- data/ext/oci8/object.c +622 -0
- data/ext/oci8/oci8.c +577 -161
- data/ext/oci8/oci8.h +354 -258
- data/ext/oci8/oci8lib.c +493 -0
- data/ext/oci8/ocidatetime.c +473 -0
- data/ext/oci8/ocinumber.c +1123 -24
- data/ext/oci8/oraconf.rb +72 -106
- data/ext/oci8/oradate.c +511 -321
- data/ext/oci8/stmt.c +752 -572
- data/ext/oci8/win32.c +131 -0
- data/ext/oci8/xmldb.c +383 -0
- data/lib/.document +2 -0
- data/lib/dbd/OCI8.rb +2 -17
- data/lib/oci8.rb.in +41 -1622
- data/lib/oci8/.document +5 -0
- data/lib/oci8/compat.rb +108 -0
- data/lib/oci8/datetime.rb +489 -0
- data/lib/oci8/encoding-init.rb +40 -0
- data/lib/oci8/encoding.yml +537 -0
- data/lib/oci8/metadata.rb +2077 -0
- data/lib/oci8/object.rb +548 -0
- data/lib/oci8/oci8.rb +773 -0
- data/lib/oci8/oracle_version.rb +144 -0
- data/metaconfig +3 -3
- data/ruby-oci8.gemspec +5 -5
- data/setup.rb +4 -4
- data/test/config.rb +64 -84
- data/test/test_all.rb +14 -21
- data/test/test_array_dml.rb +317 -0
- data/test/test_bind_raw.rb +18 -25
- data/test/test_bind_time.rb +78 -91
- data/test/test_break.rb +37 -35
- data/test/test_clob.rb +33 -89
- data/test/test_connstr.rb +5 -4
- data/test/test_datetime.rb +469 -0
- data/test/test_dbi.rb +99 -60
- data/test/test_dbi_clob.rb +3 -8
- data/test/test_metadata.rb +65 -51
- data/test/test_oci8.rb +151 -55
- data/test/test_oracle_version.rb +70 -0
- data/test/test_oradate.rb +76 -83
- data/test/test_oranumber.rb +405 -71
- data/test/test_rowid.rb +6 -11
- metadata +31 -32
- data/NEWS +0 -420
- data/ext/oci8/const.c +0 -165
- data/ext/oci8/define.c +0 -53
- data/ext/oci8/describe.c +0 -81
- data/ext/oci8/descriptor.c +0 -39
- data/ext/oci8/handle.c +0 -273
- data/ext/oci8/oranumber.c +0 -445
- data/ext/oci8/param.c +0 -37
- data/ext/oci8/server.c +0 -182
- data/ext/oci8/session.c +0 -99
- data/ext/oci8/svcctx.c +0 -238
- data/ruby-oci8.spec +0 -62
- data/support/README +0 -4
- data/support/runit/assert.rb +0 -281
- data/support/runit/cui/testrunner.rb +0 -101
- data/support/runit/error.rb +0 -4
- data/support/runit/method_mappable.rb +0 -20
- data/support/runit/robserver.rb +0 -25
- data/support/runit/setuppable.rb +0 -15
- data/support/runit/teardownable.rb +0 -16
- data/support/runit/testcase.rb +0 -113
- data/support/runit/testfailure.rb +0 -25
- data/support/runit/testresult.rb +0 -121
- data/support/runit/testsuite.rb +0 -43
- data/support/runit/version.rb +0 -3
- data/test/test_describe.rb +0 -137
data/ext/oci8/server.c
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
server.c - part of ruby-oci8
|
3
|
-
|
4
|
-
Copyright (C) 2002 KUBO Takehiro <kubo@jiubao.org>
|
5
|
-
|
6
|
-
=begin
|
7
|
-
== OCIServer
|
8
|
-
If you use ((<OCIEnv#logon>)), you have no need to use this handle directly.
|
9
|
-
Because ((<OCIEnv#logon>)) create this handle implicitly and set it to ((<OCISvcCtx>)).
|
10
|
-
|
11
|
-
super class: ((<OCIHandle>))
|
12
|
-
|
13
|
-
correspond native OCI datatype: ((|OCIServer|))
|
14
|
-
=end
|
15
|
-
*/
|
16
|
-
#include "oci8.h"
|
17
|
-
|
18
|
-
/*
|
19
|
-
=begin
|
20
|
-
--- OCIServer#attach(dbname [, mode])
|
21
|
-
attach to the database.
|
22
|
-
:dbname
|
23
|
-
the name of database.
|
24
|
-
:mode
|
25
|
-
((|OCI_DEFAULT|)) or ((|OCI_CPOOL|))(Oracle 9i). Default value is ((|OCI_DEFAULT|)).
|
26
|
-
|
27
|
-
This ruby module doesn't support the connection pooling provided by OCI,
|
28
|
-
so ((|OCI_CPOOL|)) is invalid value for now.
|
29
|
-
|
30
|
-
correspond native OCI function: ((|OCIServerAttach|))
|
31
|
-
=end
|
32
|
-
*/
|
33
|
-
static VALUE oci8_server_attach(int argc, VALUE *argv, VALUE self)
|
34
|
-
{
|
35
|
-
VALUE vdbname, vmode;
|
36
|
-
oci8_handle_t *h;
|
37
|
-
oci8_string_t d;
|
38
|
-
ub4 mode;
|
39
|
-
sword rv;
|
40
|
-
|
41
|
-
rb_scan_args(argc, argv, "11", &vdbname, &vmode);
|
42
|
-
Get_Handle(self, h); /* 0 */
|
43
|
-
Get_String(vdbname, d); /* 1 */
|
44
|
-
Get_Int_With_Default(argc, 2, vmode, mode, OCI_DEFAULT); /* 2 */
|
45
|
-
|
46
|
-
rv = OCIServerAttach(h->hp, h->errhp, d.ptr, d.len, mode);
|
47
|
-
if (rv != OCI_SUCCESS)
|
48
|
-
oci8_raise(h->errhp, rv, NULL);
|
49
|
-
return self;
|
50
|
-
}
|
51
|
-
|
52
|
-
/*
|
53
|
-
=begin
|
54
|
-
--- OCIServer#detach([mode])
|
55
|
-
detach from the database.
|
56
|
-
|
57
|
-
:mode
|
58
|
-
((|OCI_DEFAULT|)) only valid. Default value is ((|OCI_DEFAULT|)).
|
59
|
-
|
60
|
-
correspond native OCI function: ((|OCIServerDetach|))
|
61
|
-
=end
|
62
|
-
*/
|
63
|
-
static VALUE oci8_server_detach(int argc, VALUE *argv, VALUE self)
|
64
|
-
{
|
65
|
-
VALUE vmode;
|
66
|
-
oci8_handle_t *h;
|
67
|
-
ub4 mode;
|
68
|
-
sword rv;
|
69
|
-
|
70
|
-
|
71
|
-
rb_scan_args(argc, argv, "01", &vmode);
|
72
|
-
Get_Handle(self, h); /* 0 */
|
73
|
-
Get_Int_With_Default(argc, 1, vmode, mode, OCI_DEFAULT); /* 1 */
|
74
|
-
|
75
|
-
rv = OCIServerDetach(h->hp, h->errhp, mode);
|
76
|
-
if (rv != OCI_SUCCESS)
|
77
|
-
oci8_raise(h->errhp, rv, NULL);
|
78
|
-
return self;
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
void Init_oci8_server(void)
|
84
|
-
{
|
85
|
-
rb_define_method(cOCIServer, "attach", oci8_server_attach, -1);
|
86
|
-
rb_define_method(cOCIServer, "detach", oci8_server_detach, -1);
|
87
|
-
rb_define_method(cOCIServer, "version", oci8_server_version, 0);
|
88
|
-
#ifdef HAVE_OCISERVERRELEASE
|
89
|
-
rb_define_method(cOCIServer, "release", oci8_server_release, 0);
|
90
|
-
#endif
|
91
|
-
rb_define_method(cOCIServer, "break", oci8_break, 0);
|
92
|
-
#ifdef HAVE_OCIRESET
|
93
|
-
rb_define_method(cOCIServer, "reset", oci8_reset, 0);
|
94
|
-
#endif
|
95
|
-
}
|
96
|
-
|
97
|
-
/*
|
98
|
-
=begin
|
99
|
-
--- OCIServer#version()
|
100
|
-
get server version.
|
101
|
-
|
102
|
-
:return value
|
103
|
-
string of server version. For example
|
104
|
-
Oracle8 Release 8.0.5.0.0 - Production
|
105
|
-
PL/SQL Release 8.0.5.0.0 - Production
|
106
|
-
|
107
|
-
correspond native OCI function: ((|OCIServerVersion|))
|
108
|
-
=end
|
109
|
-
*/
|
110
|
-
VALUE oci8_server_version(VALUE self)
|
111
|
-
{
|
112
|
-
oci8_handle_t *h;
|
113
|
-
OraText buf[1024];
|
114
|
-
sword rv;
|
115
|
-
|
116
|
-
Get_Handle(self, h); /* 0 */
|
117
|
-
rv = OCIServerVersion(h->hp, h->errhp, buf, sizeof(buf), h->type);
|
118
|
-
if (rv != OCI_SUCCESS)
|
119
|
-
oci8_raise(h->errhp, rv, NULL);
|
120
|
-
return rb_str_new2(TO_CHARPTR(buf));
|
121
|
-
}
|
122
|
-
|
123
|
-
/*
|
124
|
-
=begin
|
125
|
-
--- OCIServer#release()
|
126
|
-
get server version number and string
|
127
|
-
|
128
|
-
:return value
|
129
|
-
array of number and string. For example
|
130
|
-
|
131
|
-
version_number, version_str = srv.release()
|
132
|
-
version_number is 0x8005000.
|
133
|
-
version_str is
|
134
|
-
Oracle8 Release 8.0.5.0.0 - Production
|
135
|
-
PL/SQL Release 8.0.5.0.0 - Production
|
136
|
-
|
137
|
-
correspond native OCI function: ((|OCIServerVersion|))
|
138
|
-
|
139
|
-
Oracle 9i or later?
|
140
|
-
=end
|
141
|
-
*/
|
142
|
-
#ifdef HAVE_OCISERVERRELEASE
|
143
|
-
VALUE oci8_server_release(VALUE self)
|
144
|
-
{
|
145
|
-
oci8_handle_t *h;
|
146
|
-
OraText buf[1024];
|
147
|
-
ub4 version = 0;
|
148
|
-
sword rv;
|
149
|
-
|
150
|
-
Get_Handle(self, h); /* 0 */
|
151
|
-
rv = OCIServerRelease(h->hp, h->errhp, buf, sizeof(buf), h->type, &version);
|
152
|
-
if (rv != OCI_SUCCESS)
|
153
|
-
oci8_raise(h->errhp, rv, NULL);
|
154
|
-
return rb_ary_new3(2, INT2FIX(version), rb_str_new2(buf));
|
155
|
-
}
|
156
|
-
#endif
|
157
|
-
|
158
|
-
VALUE oci8_break(VALUE self)
|
159
|
-
{
|
160
|
-
oci8_handle_t *h;
|
161
|
-
sword rv;
|
162
|
-
|
163
|
-
Get_Handle(self, h); /* 0 */
|
164
|
-
rv = OCIBreak(h->hp, h->errhp);
|
165
|
-
if (rv != OCI_SUCCESS)
|
166
|
-
oci8_raise(h->errhp, rv, NULL);
|
167
|
-
return self;
|
168
|
-
}
|
169
|
-
|
170
|
-
#ifdef HAVE_OCIRESET
|
171
|
-
VALUE oci8_reset(VALUE self)
|
172
|
-
{
|
173
|
-
oci8_handle_t *h;
|
174
|
-
sword rv;
|
175
|
-
|
176
|
-
Get_Handle(self, h); /* 0 */
|
177
|
-
rv = OCIReset(h->hp, h->errhp);
|
178
|
-
if (rv != OCI_SUCCESS)
|
179
|
-
oci8_raise(h->errhp, rv, NULL);
|
180
|
-
return self;
|
181
|
-
}
|
182
|
-
#endif
|
data/ext/oci8/session.c
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
session.c - part of ruby-oci8
|
3
|
-
|
4
|
-
Copyright (C) 2002 KUBO Takehiro <kubo@jiubao.org>
|
5
|
-
|
6
|
-
=begin
|
7
|
-
== OCISession
|
8
|
-
If you use ((<OCIEnv#logon>)), you have no need to use this handle directly.
|
9
|
-
Because ((<OCIEnv#logon>)) create this handle implicitly and set it to ((<OCISvcCtx>)).
|
10
|
-
|
11
|
-
super class: ((<OCIHandle>))
|
12
|
-
|
13
|
-
correspond native OCI datatype: ((|OCISession|))
|
14
|
-
=end
|
15
|
-
*/
|
16
|
-
#include "oci8.h"
|
17
|
-
|
18
|
-
/*
|
19
|
-
=begin
|
20
|
-
--- OCISession#begin(svc [, credt [, mode]])
|
21
|
-
start user session under the specified server context.
|
22
|
-
:svc
|
23
|
-
((<OCISvcCtx>)).
|
24
|
-
:credt
|
25
|
-
((|OCI_CRED_RDBMS|)) or ((|OCI_CRED_EXT|)).
|
26
|
-
Default value is ((|OCI_CRED_RDBMS|)).
|
27
|
-
|
28
|
-
If you use ((|OCI_CRED_RDBMS|)), set ((<OCI_ATTR_USERNAME>))
|
29
|
-
and ((<OCI_ATTR_PASSWORD>)) in advance.
|
30
|
-
|
31
|
-
:mode
|
32
|
-
((|OCI_DEFAULT|)), ((|OCI_MIGRATE|)), ((|OCI_SYSDBA|)), ((|OCI_SYSOPER|)),
|
33
|
-
(((|OCI_SYSDBA|)) | ((|OCI_PRELIM_AUTH|))), or (((|OCI_SYSOPER|)) | ((|OCI_PRELIM_AUTH|))).
|
34
|
-
Default value is ((|OCI_DEFAULT|)).
|
35
|
-
|
36
|
-
If you need SYSDBA or SYSOPER privilege, use
|
37
|
-
((|OCI_SYSDBA|)) or ((|OCI_SYSOPER|)) respectively.
|
38
|
-
|
39
|
-
correspond native OCI function: ((|OCISessionBegin|))
|
40
|
-
=end
|
41
|
-
*/
|
42
|
-
static VALUE oci8_session_begin(int argc, VALUE *argv, VALUE self)
|
43
|
-
{
|
44
|
-
VALUE vsvc, vcredt, vmode;
|
45
|
-
oci8_handle_t *h;
|
46
|
-
oci8_handle_t *svch;
|
47
|
-
ub4 credt;
|
48
|
-
ub4 mode;
|
49
|
-
sword rv;
|
50
|
-
|
51
|
-
rb_scan_args(argc, argv, "12", &vsvc, &vcredt, &vmode);
|
52
|
-
Get_Handle(self, h); /* 0 */
|
53
|
-
Check_Handle(vsvc, OCISvcCtx, svch); /* 1 */
|
54
|
-
Get_Int_With_Default(argc, 2, vcredt, credt, OCI_NTV_SYNTAX); /* 2 */
|
55
|
-
Get_Int_With_Default(argc, 3, vmode, mode, OCI_DEFAULT); /* 3 */
|
56
|
-
|
57
|
-
rv = OCISessionBegin(svch->hp, h->errhp, h->hp, credt, mode);
|
58
|
-
if (rv != OCI_SUCCESS)
|
59
|
-
oci8_raise(h->errhp, rv, NULL);
|
60
|
-
return self;
|
61
|
-
}
|
62
|
-
|
63
|
-
/*
|
64
|
-
=begin
|
65
|
-
--- OCISession#end(svc [, vmode])
|
66
|
-
terminate user Authentication Context
|
67
|
-
|
68
|
-
:svc
|
69
|
-
((<OCISvcCtx>)).
|
70
|
-
:mode
|
71
|
-
((|OCI_DEFAULT|)) only valid. Defalt value is ((|OCI_DEFAULT|)).
|
72
|
-
|
73
|
-
correspond native OCI function: ((|OCISessionEnd|))
|
74
|
-
=end
|
75
|
-
*/
|
76
|
-
static VALUE oci8_session_end(int argc, VALUE *argv, VALUE self)
|
77
|
-
{
|
78
|
-
VALUE vsvc, vmode;
|
79
|
-
oci8_handle_t *h;
|
80
|
-
oci8_handle_t *svch;
|
81
|
-
ub4 mode;
|
82
|
-
sword rv;
|
83
|
-
|
84
|
-
rb_scan_args(argc, argv, "11", &vsvc, &vmode);
|
85
|
-
Get_Handle(self, h); /* 0 */
|
86
|
-
Check_Handle(vsvc, OCISvcCtx, svch); /* 1 */
|
87
|
-
Get_Int_With_Default(argc, 2, vmode, mode, OCI_DEFAULT); /* 2 */
|
88
|
-
|
89
|
-
rv = OCISessionEnd(svch->hp, h->errhp, h->hp, mode);
|
90
|
-
if (rv != OCI_SUCCESS)
|
91
|
-
oci8_raise(h->errhp, rv, NULL);
|
92
|
-
return self;
|
93
|
-
}
|
94
|
-
|
95
|
-
void Init_oci8_session(void)
|
96
|
-
{
|
97
|
-
rb_define_method(cOCISession, "begin", oci8_session_begin, -1);
|
98
|
-
rb_define_method(cOCISession, "end", oci8_session_end, -1);
|
99
|
-
}
|
data/ext/oci8/svcctx.c
DELETED
@@ -1,238 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
svcctx.c - part of ruby-oci8
|
3
|
-
|
4
|
-
Copyright (C) 2002 KUBO Takehiro <kubo@jiubao.org>
|
5
|
-
|
6
|
-
=begin
|
7
|
-
== OCISvcCtx
|
8
|
-
The service context handle is correspond to `session' compared
|
9
|
-
with other general database interfaces although OCI constains OCISession.
|
10
|
-
|
11
|
-
This handle cooperates with a ((<server handle|OCIServer>)), a
|
12
|
-
((<user session handle|OCISession>)), and a transaction handle.
|
13
|
-
But these three handles work at the back of it. So you don't have to use
|
14
|
-
them except when you have special purpose.
|
15
|
-
|
16
|
-
super class: ((<OCIHandle>))
|
17
|
-
|
18
|
-
correspond native OCI datatype: ((|OCISvcCtx|))
|
19
|
-
=end
|
20
|
-
*/
|
21
|
-
#include "oci8.h"
|
22
|
-
|
23
|
-
/*
|
24
|
-
=begin
|
25
|
-
--- OCISvcCtx#logoff()
|
26
|
-
disconnect from Oracle.
|
27
|
-
|
28
|
-
If you use ((<OCIServer#attach>)) and ((<OCISession#begin>)) to logon,
|
29
|
-
use ((<OCIServer#detach>)) and ((<OCISession#end>)) instead.
|
30
|
-
See also ((<Simplified Logon>)) and ((<Explicit Attach and Begin Session>)).
|
31
|
-
|
32
|
-
correspond native OCI function: ((|OCILogoff|))
|
33
|
-
=end
|
34
|
-
*/
|
35
|
-
static VALUE oci8_svcctx_logoff(VALUE self)
|
36
|
-
{
|
37
|
-
oci8_handle_t *h;
|
38
|
-
sword rv;
|
39
|
-
|
40
|
-
Get_Handle(self, h); /* 0 */
|
41
|
-
|
42
|
-
rv = OCILogoff(h->hp, h->errhp);
|
43
|
-
if (rv != OCI_SUCCESS)
|
44
|
-
oci8_raise(h->errhp, rv, NULL);
|
45
|
-
return self;
|
46
|
-
}
|
47
|
-
|
48
|
-
/*
|
49
|
-
=begin
|
50
|
-
--- OCISvcCtx#passwordChange(username, old_password, new_password [, mode])
|
51
|
-
:username
|
52
|
-
the username.
|
53
|
-
:old_password
|
54
|
-
old password of the user.
|
55
|
-
:new_password
|
56
|
-
new password of the user.
|
57
|
-
:mode
|
58
|
-
((|OCI_DEFAULT|)) or ((|OCI_AUTH|)). Default value is ((|OCI_DEFAULT|)).
|
59
|
-
|
60
|
-
For most cases, use default value. If you want to know detail,
|
61
|
-
see "Oracle Call Interface Programmer's Guide".
|
62
|
-
|
63
|
-
correspond native OCI function: ((|OCIPasswordChange|))
|
64
|
-
=end
|
65
|
-
*/
|
66
|
-
static VALUE oci8_password_change(int argc, VALUE *argv, VALUE self)
|
67
|
-
{
|
68
|
-
VALUE vusername, vopasswd, vnpasswd, vmode;
|
69
|
-
oci8_handle_t *h;
|
70
|
-
oci8_string_t username, opasswd, npasswd;
|
71
|
-
ub4 mode;
|
72
|
-
sword rv;
|
73
|
-
|
74
|
-
rb_scan_args(argc, argv, "31", &vusername, &vopasswd, &vnpasswd, &vmode);
|
75
|
-
Get_Handle(self, h); /* 0 */
|
76
|
-
Get_String(vusername, username); /* 1 */
|
77
|
-
Get_String(vopasswd, opasswd); /* 2 */
|
78
|
-
Get_String(vnpasswd, npasswd); /* 3 */
|
79
|
-
Get_Int_With_Default(argc, 4, vmode, mode, OCI_DEFAULT); /* 4 */
|
80
|
-
|
81
|
-
rv = OCIPasswordChange(h->hp, h->errhp, username.ptr, username.len,
|
82
|
-
opasswd.ptr, opasswd.len, npasswd.ptr, npasswd.len, mode);
|
83
|
-
if (rv != OCI_SUCCESS) {
|
84
|
-
oci8_raise(h->errhp, rv, NULL);
|
85
|
-
}
|
86
|
-
return self;
|
87
|
-
}
|
88
|
-
|
89
|
-
/*
|
90
|
-
=begin
|
91
|
-
--- OCISvcCtx#commit([flags])
|
92
|
-
commit the transaction.
|
93
|
-
|
94
|
-
:flags
|
95
|
-
((|OCI_DEFAULT|)) or ((|OCI_TRANS_TWOPHASE|)).
|
96
|
-
Default value is ((|OCI_DEFAULT|)).
|
97
|
-
|
98
|
-
correspond native OCI function: ((|OCITransCommit|))
|
99
|
-
=end
|
100
|
-
*/
|
101
|
-
static VALUE oci8_trans_commit(int argc, VALUE *argv, VALUE self)
|
102
|
-
{
|
103
|
-
VALUE vflags;
|
104
|
-
oci8_handle_t *h;
|
105
|
-
ub4 flags;
|
106
|
-
sword rv;
|
107
|
-
|
108
|
-
rb_scan_args(argc, argv, "01", &vflags);
|
109
|
-
Get_Handle(self, h); /* 0 */
|
110
|
-
Get_Int_With_Default(argc, 1, vflags, flags, OCI_DEFAULT); /* 1 */
|
111
|
-
|
112
|
-
rv = OCITransCommit(h->hp, h->errhp, flags);
|
113
|
-
if (rv != OCI_SUCCESS) {
|
114
|
-
oci8_raise(h->errhp, rv, NULL);
|
115
|
-
}
|
116
|
-
return self;
|
117
|
-
}
|
118
|
-
|
119
|
-
/*
|
120
|
-
=begin
|
121
|
-
|
122
|
-
--- OCISvcCtx#rollback([flags])
|
123
|
-
rollback the transaction.
|
124
|
-
|
125
|
-
:flags
|
126
|
-
((|OCI_DEFAULT|)) only valid. Default value is ((|OCI_DEFAULT|)).
|
127
|
-
|
128
|
-
correspond native OCI function: ((|OCITransRollback|))
|
129
|
-
=end
|
130
|
-
*/
|
131
|
-
static VALUE oci8_trans_rollback(int argc, VALUE *argv, VALUE self)
|
132
|
-
{
|
133
|
-
VALUE vflags;
|
134
|
-
oci8_handle_t *h;
|
135
|
-
ub4 flags;
|
136
|
-
sword rv;
|
137
|
-
|
138
|
-
rb_scan_args(argc, argv, "01", &vflags);
|
139
|
-
Get_Handle(self, h); /* 0 */
|
140
|
-
Get_Int_With_Default(argc, 1, vflags, flags, OCI_DEFAULT); /* 1 */
|
141
|
-
|
142
|
-
rv = OCITransRollback(h->hp, h->errhp, flags);
|
143
|
-
if (rv != OCI_SUCCESS) {
|
144
|
-
oci8_raise(h->errhp, rv, NULL);
|
145
|
-
}
|
146
|
-
return self;
|
147
|
-
}
|
148
|
-
|
149
|
-
/* THIS WILL BE DELETED IN FUTURE RELEASE. */
|
150
|
-
static VALUE oci8_describe_any(VALUE self, VALUE vdsc, VALUE vname, VALUE vtype)
|
151
|
-
{
|
152
|
-
oci8_handle_t *h;
|
153
|
-
oci8_handle_t *dsch;
|
154
|
-
oci8_string_t name;
|
155
|
-
ub1 type;
|
156
|
-
sword rv;
|
157
|
-
|
158
|
-
Get_Handle(self, h); /* 0 */
|
159
|
-
Check_Handle(vdsc, OCIDescribe, dsch); /* 1 */
|
160
|
-
Get_String(vname, name); /* 2 */
|
161
|
-
type = FIX2INT(vtype); /* 3 */
|
162
|
-
|
163
|
-
rv = OCIDescribeAny(h->hp, h->errhp, name.ptr, name.len, OCI_OTYPE_NAME, OCI_DEFAULT, type, dsch->hp);
|
164
|
-
if (rv != OCI_SUCCESS) {
|
165
|
-
oci8_raise(h->errhp, rv, NULL);
|
166
|
-
}
|
167
|
-
return self;
|
168
|
-
}
|
169
|
-
|
170
|
-
static VALUE oci8_close_all_files(VALUE self)
|
171
|
-
{
|
172
|
-
oci8_handle_t *h;
|
173
|
-
sword rv;
|
174
|
-
|
175
|
-
Get_Handle(self, h); /* 0 */
|
176
|
-
rv = OCILobFileCloseAll(h->hp, h->errhp);
|
177
|
-
if (rv != OCI_SUCCESS) {
|
178
|
-
oci8_raise(h->errhp, rv, NULL);
|
179
|
-
}
|
180
|
-
return self;
|
181
|
-
}
|
182
|
-
|
183
|
-
static VALUE oci8_pid(VALUE self)
|
184
|
-
{
|
185
|
-
oci8_handle_t *h;
|
186
|
-
|
187
|
-
Get_Handle(self, h); /* 0 */
|
188
|
-
return INT2FIX(h->u.svcctx.pid);
|
189
|
-
}
|
190
|
-
|
191
|
-
void Init_oci8_svcctx(void)
|
192
|
-
{
|
193
|
-
rb_define_method(cOCISvcCtx, "logoff", oci8_svcctx_logoff, 0);
|
194
|
-
rb_define_method(cOCISvcCtx, "passwordChange", oci8_password_change, -1);
|
195
|
-
rb_define_method(cOCISvcCtx, "commit", oci8_trans_commit, -1);
|
196
|
-
rb_define_method(cOCISvcCtx, "rollback", oci8_trans_rollback, -1);
|
197
|
-
rb_define_method(cOCISvcCtx, "describeAny", oci8_describe_any, 3); /* delete later. */
|
198
|
-
rb_define_method(cOCISvcCtx, "version", oci8_server_version, 0);
|
199
|
-
#ifdef HAVE_OCISERVERRELEASE
|
200
|
-
rb_define_method(cOCISvcCtx, "release", oci8_server_release, 0);
|
201
|
-
#endif
|
202
|
-
rb_define_method(cOCISvcCtx, "break", oci8_break, 0);
|
203
|
-
#ifdef HAVE_OCIRESET
|
204
|
-
rb_define_method(cOCISvcCtx, "reset", oci8_reset, 0);
|
205
|
-
#endif
|
206
|
-
rb_define_method(cOCISvcCtx, "close_all_files", oci8_close_all_files, 0);
|
207
|
-
rb_define_method(cOCISvcCtx, "pid", oci8_pid, 0);
|
208
|
-
}
|
209
|
-
|
210
|
-
/*
|
211
|
-
=begin
|
212
|
-
--- OCISvcCtx#version()
|
213
|
-
get server version.
|
214
|
-
|
215
|
-
:return value
|
216
|
-
string of server version. For example
|
217
|
-
Oracle8 Release 8.0.5.0.0 - Production
|
218
|
-
PL/SQL Release 8.0.5.0.0 - Production
|
219
|
-
|
220
|
-
correspond native OCI function: ((|OCIServerVersion|))
|
221
|
-
|
222
|
-
--- OCISvcCtx#release()
|
223
|
-
get server version number and string
|
224
|
-
|
225
|
-
:return value
|
226
|
-
array of number and string. For example
|
227
|
-
|
228
|
-
version_number, version_str = svc.release()
|
229
|
-
version_number is 0x8005000.
|
230
|
-
version_str is
|
231
|
-
Oracle8 Release 8.0.5.0.0 - Production
|
232
|
-
PL/SQL Release 8.0.5.0.0 - Production
|
233
|
-
|
234
|
-
correspond native OCI function: ((|OCIServerVersion|))
|
235
|
-
|
236
|
-
Oracle 9i or later?
|
237
|
-
=end
|
238
|
-
*/
|