Class: OCISvcCtx

Inherits:
OCIHandle show all
Defined in:
ext/oci8/oci8.c

Instance Method Summary collapse

Methods inherited from OCIHandle

#attrGet, #attrSet, #free, new

Instance Method Details

#breakObject



158
159
160
161
162
163
164
165
166
167
168
# File 'ext/oci8/server.c', line 158

VALUE oci8_break(VALUE self)
{
  oci8_handle_t *h;
  sword rv;

  Get_Handle(self, h); /* 0 */
  rv = OCIBreak(h->hp, h->errhp);
  if (rv != OCI_SUCCESS)
    oci8_raise(h->errhp, rv, NULL);
  return self;
}

#close_all_filesObject



170
171
172
173
174
175
176
177
178
179
180
181
# File 'ext/oci8/svcctx.c', line 170

static VALUE oci8_close_all_files(VALUE self)
{
  oci8_handle_t *h;
  sword rv;

  Get_Handle(self, h); /* 0 */
  rv = OCILobFileCloseAll(h->hp, h->errhp);
  if (rv != OCI_SUCCESS) {
    oci8_raise(h->errhp, rv, NULL);
  }
  return self;
}

#commit(*args) ⇒ Object

begin

OCISvcCtx#commit()

commit the transaction.

:flags
   ((|OCI_DEFAULT|)) or ((|OCI_TRANS_TWOPHASE|)).
   Default value is ((|OCI_DEFAULT|)).

correspond native OCI function: ((|OCITransCommit|))

end



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'ext/oci8/svcctx.c', line 101

static VALUE oci8_trans_commit(int argc, VALUE *argv, VALUE self)
{
  VALUE vflags;
  oci8_handle_t *h;
  ub4 flags;
  sword rv;

  rb_scan_args(argc, argv, "01", &vflags);
  Get_Handle(self, h); /* 0 */
  Get_Int_With_Default(argc, 1, vflags, flags, OCI_DEFAULT); /* 1 */

  rv = OCITransCommit(h->hp, h->errhp, flags);
  if (rv != OCI_SUCCESS) {
    oci8_raise(h->errhp, rv, NULL);
  }
  return self;
}

#describeAny(vdsc, vname, vtype) ⇒ Object

THIS WILL BE DELETED IN FUTURE RELEASE.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'ext/oci8/svcctx.c', line 150

static VALUE oci8_describe_any(VALUE self, VALUE vdsc, VALUE vname, VALUE vtype)
{
  oci8_handle_t *h;
  oci8_handle_t *dsch;
  oci8_string_t name;
  ub1 type;
  sword rv;

  Get_Handle(self, h); /* 0 */
  Check_Handle(vdsc, OCIDescribe, dsch); /* 1 */
  Get_String(vname, name); /* 2 */
  type = FIX2INT(vtype); /* 3 */

  rv = OCIDescribeAny(h->hp, h->errhp, name.ptr, name.len, OCI_OTYPE_NAME, OCI_DEFAULT, type, dsch->hp);
  if (rv != OCI_SUCCESS) {
    oci8_raise(h->errhp, rv, NULL);
  }
  return self;
}

#logoffObject

begin

— OCISvcCtx#logoff()

disconnect from Oracle.

If you use ((<OCIServer#attach>)) and ((<OCISession#begin>)) to logon,
use ((<OCIServer#detach>)) and ((<OCISession#end>)) instead.
See also ((<Simplified Logon>)) and ((<Explicit Attach and Begin Session>)).

correspond native OCI function: ((|OCILogoff|))

end



35
36
37
38
39
40
41
42
43
44
45
46
# File 'ext/oci8/svcctx.c', line 35

static VALUE oci8_svcctx_logoff(VALUE self)
{
  oci8_handle_t *h;
  sword rv;

  Get_Handle(self, h); /* 0 */

  rv = OCILogoff(h->hp, h->errhp);
  if (rv != OCI_SUCCESS)
    oci8_raise(h->errhp, rv, NULL);
  return self;
}

#passwordChange(*args) ⇒ Object

begin

— OCISvcCtx#passwordChange(username, old_password, new_password [, mode])

:username
   the username.
:old_password
   old password of the user.
:new_password
   new password of the user.
:mode
   ((|OCI_DEFAULT|)) or ((|OCI_AUTH|)). Default value is ((|OCI_DEFAULT|)).

   For most cases, use default value. If you want to know detail,
   see "Oracle Call Interface Programmer's Guide".

correspond native OCI function: ((|OCIPasswordChange|))

end



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'ext/oci8/svcctx.c', line 66

static VALUE oci8_password_change(int argc, VALUE *argv, VALUE self)
{
  VALUE vusername, vopasswd, vnpasswd, vmode;
  oci8_handle_t *h;
  oci8_string_t username, opasswd, npasswd;
  ub4 mode;
  sword rv;

  rb_scan_args(argc, argv, "31", &vusername, &vopasswd, &vnpasswd, &vmode);
  Get_Handle(self, h); /* 0 */
  Get_String(vusername, username); /* 1 */
  Get_String(vopasswd, opasswd); /* 2 */
  Get_String(vnpasswd, npasswd); /* 3 */
  Get_Int_With_Default(argc, 4, vmode, mode, OCI_DEFAULT); /* 4 */

  rv = OCIPasswordChange(h->hp, h->errhp, username.ptr, username.len,
			 opasswd.ptr, opasswd.len, npasswd.ptr, npasswd.len, mode);
  if (rv != OCI_SUCCESS) {
    oci8_raise(h->errhp, rv, NULL);
  }
  return self;
}

#pidObject



183
184
185
186
187
188
189
# File 'ext/oci8/svcctx.c', line 183

static VALUE oci8_pid(VALUE self)
{
  oci8_handle_t *h;

  Get_Handle(self, h); /* 0 */
  return INT2FIX(h->u.svcctx.pid);
}

#releaseObject



143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'ext/oci8/server.c', line 143

VALUE oci8_server_release(VALUE self)
{
  oci8_handle_t *h;
  OraText buf[1024];
  ub4 version = 0;
  sword rv;

  Get_Handle(self, h); /* 0 */
  rv = OCIServerRelease(h->hp, h->errhp, buf, sizeof(buf), h->type, &version);
  if (rv != OCI_SUCCESS)
    oci8_raise(h->errhp, rv, NULL);
  return rb_ary_new3(2, INT2FIX(version), rb_str_new2(buf));
}

#resetObject



171
172
173
174
175
176
177
178
179
180
181
# File 'ext/oci8/server.c', line 171

VALUE oci8_reset(VALUE self)
{
  oci8_handle_t *h;
  sword rv;

  Get_Handle(self, h); /* 0 */
  rv = OCIReset(h->hp, h->errhp);
  if (rv != OCI_SUCCESS)
    oci8_raise(h->errhp, rv, NULL);
  return self;
}

#rollback(*args) ⇒ Object

begin

OCISvcCtx#rollback()

rollback the transaction.

:flags
   ((|OCI_DEFAULT|)) only valid. Default value is ((|OCI_DEFAULT|)).

correspond native OCI function: ((|OCITransRollback|))

end



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'ext/oci8/svcctx.c', line 131

static VALUE oci8_trans_rollback(int argc, VALUE *argv, VALUE self)
{
  VALUE vflags;
  oci8_handle_t *h;
  ub4 flags;
  sword rv;

  rb_scan_args(argc, argv, "01", &vflags);
  Get_Handle(self, h); /* 0 */
  Get_Int_With_Default(argc, 1, vflags, flags, OCI_DEFAULT); /* 1 */

  rv = OCITransRollback(h->hp, h->errhp, flags);
  if (rv != OCI_SUCCESS) {
    oci8_raise(h->errhp, rv, NULL);
  }
  return self;
}

#versionObject

begin

— OCIServer#version()

get server version.

:return value
   string of server version. For example
     Oracle8 Release 8.0.5.0.0 - Production
     PL/SQL Release 8.0.5.0.0 - Production

correspond native OCI function: ((|OCIServerVersion|))

end



110
111
112
113
114
115
116
117
118
119
120
121
# File 'ext/oci8/server.c', line 110

VALUE oci8_server_version(VALUE self)
{
  oci8_handle_t *h;
  OraText buf[1024];
  sword rv;

  Get_Handle(self, h); /* 0 */
  rv = OCIServerVersion(h->hp, h->errhp, buf, sizeof(buf), h->type);
  if (rv != OCI_SUCCESS)
    oci8_raise(h->errhp, rv, NULL);
  return rb_str_new2(TO_CHARPTR(buf));
}