[ruby-oci8-commit] [457] trunk/ruby-oci8: delete code for Oracle 8 and Oracle 8i.
nobody at rubyforge.org
nobody at rubyforge.org
Sat Oct 22 01:11:52 EDT 2011
Revision: 457
Author: kubo
Date: 2011-10-22 01:11:51 -0400 (Sat, 22 Oct 2011)
Log Message:
-----------
delete code for Oracle 8 and Oracle 8i.
Modified Paths:
--------------
trunk/ruby-oci8/ChangeLog
trunk/ruby-oci8/ext/oci8/lob.c
trunk/ruby-oci8/ext/oci8/oci8.c
trunk/ruby-oci8/ext/oci8/ocinumber.c
Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog 2011-10-21 14:23:18 UTC (rev 456)
+++ trunk/ruby-oci8/ChangeLog 2011-10-22 05:11:51 UTC (rev 457)
@@ -1,3 +1,7 @@
+2011-10-22 KUBO Takehiro <kubo at jiubao.org>
+ * ext/oci8/lob.c, ext/oci8/oci8.c, ext/oci8/ocinumber.c:
+ delete code for Oracle 8 and Oracle 8i.
+
2011-10-21 KUBO Takehiro <kubo at jiubao.org>
* ext/oci8/error.c, ext/oci8/oci8.h: refactor OCIException and its
subclasses. OCIError#codes and OCIError#messages are deleted.
Modified: trunk/ruby-oci8/ext/oci8/lob.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/lob.c 2011-10-21 14:23:18 UTC (rev 456)
+++ trunk/ruby-oci8/ext/oci8/lob.c 2011-10-22 05:11:51 UTC (rev 457)
@@ -102,7 +102,7 @@
oci8_lob_t *lob = (oci8_lob_t *)base;
boolean is_temporary;
- if (have_OCILobIsTemporary && lob->svchp != NULL
+ if (lob->svchp != NULL
&& OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS
&& is_temporary) {
@@ -131,11 +131,9 @@
static void lob_open(oci8_lob_t *lob)
{
if (lob->state == S_CLOSE) {
- if (have_OCILobOpen_nb) {
- oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
+ oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
- oci_lc(OCILobOpen_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, OCI_DEFAULT));
- }
+ oci_lc(OCILobOpen_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, OCI_DEFAULT));
lob->state = S_OPEN;
}
}
@@ -143,11 +141,9 @@
static void lob_close(oci8_lob_t *lob)
{
if (lob->state == S_OPEN) {
- if (have_OCILobClose_nb) {
- oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
+ oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
- oci_lc(OCILobClose_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob));
- }
+ oci_lc(OCILobClose_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob));
lob->state = S_CLOSE;
}
}
@@ -192,15 +188,11 @@
lob->state = S_NO_OPEN_CLOSE;
oci8_link_to_parent((oci8_base_t*)lob, (oci8_base_t*)DATA_PTR(svc));
if (!NIL_P(val)) {
- if (have_OCILobCreateTemporary_nb) {
- oci8_svcctx_t *svcctx = oci8_get_svcctx(svc);
- OCI8StringValue(val);
- oci_lc(OCILobCreateTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, 0, csfrm, lobtype, TRUE, OCI_DURATION_SESSION));
- lob->svchp = oci8_get_oci_svcctx(svc);
- oci8_lob_write(self, val);
- } else {
- rb_raise(rb_eRuntimeError, "creating a temporary lob is not supported on this Oracle version");
- }
+ oci8_svcctx_t *svcctx = oci8_get_svcctx(svc);
+ OCI8StringValue(val);
+ oci_lc(OCILobCreateTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, 0, csfrm, lobtype, TRUE, OCI_DURATION_SESSION));
+ lob->svchp = oci8_get_oci_svcctx(svc);
+ oci8_lob_write(self, val);
}
return Qnil;
}
@@ -459,16 +451,12 @@
static VALUE oci8_lob_get_chunk_size(VALUE self)
{
- if (have_OCILobGetChunkSize_nb) {
- oci8_lob_t *lob = DATA_PTR(self);
- oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
- ub4 len;
+ oci8_lob_t *lob = DATA_PTR(self);
+ oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
+ ub4 len;
- oci_lc(OCILobGetChunkSize_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, &len));
- return UINT2NUM(len);
- } else {
- rb_notimplement();
- }
+ oci_lc(OCILobGetChunkSize_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, &len));
+ return UINT2NUM(len);
}
static VALUE oci8_lob_clone(VALUE self)
@@ -481,9 +469,8 @@
newobj = rb_funcall(CLASS_OF(self), oci8_id_new, 1, lob->svc);
newlob = DATA_PTR(newobj);
- if (have_OCILobLocatorAssign_nb && have_OCILobIsTemporary
- && OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS
- && is_temporary) {
+ if (OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS
+ && is_temporary) {
oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
rv = OCILobLocatorAssign_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, &newlob->base.hp.lob);
} else {
Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c 2011-10-21 14:23:18 UTC (rev 456)
+++ trunk/ruby-oci8/ext/oci8/oci8.c 2011-10-22 05:11:51 UTC (rev 457)
@@ -779,24 +779,8 @@
ub4 version;
char *p;
- if (have_OCIServerRelease) {
- /* Oracle 9i or later */
- oci_lc(OCIServerRelease(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), (ub1)svcctx->base.type, &version));
- return UINT2NUM(version);
- } else {
- /* Oracle 8.x */
- oci_lc(OCIServerVersion(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), (ub1)svcctx->base.type));
- if ((p = strchr(buf, '.')) != NULL) {
- unsigned int major, minor, update, patch, port_update;
- while (p >= buf && *p != ' ') {
- p--;
- }
- if (sscanf(p + 1, "%u.%u.%u.%u.%u", &major, &minor, &update, &patch, &port_update) == 5) {
- return INT2FIX(ORAVERNUM(major, minor, update, patch, port_update));
- }
- }
- return Qnil;
- }
+ oci_lc(OCIServerRelease(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), (ub1)svcctx->base.type, &version));
+ return UINT2NUM(version);
}
/*
@@ -1127,9 +1111,7 @@
rb_define_const(cOCI8, "VERSION", rb_obj_freeze(rb_usascii_str_new_cstr(OCI8LIB_VERSION)));
rb_define_singleton_method_nodoc(cOCI8, "oracle_client_vernum", oci8_s_oracle_client_vernum, 0);
rb_define_singleton_method_nodoc(cOCI8, "__set_property", oci8_s_set_property, 2);
- if (have_OCIMessageOpen && have_OCIMessageGet) {
- rb_define_singleton_method(cOCI8, "error_message", oci8_s_error_message, 1);
- }
+ rb_define_singleton_method(cOCI8, "error_message", oci8_s_error_message, 1);
rb_define_private_method(cOCI8, "parse_connect_string", oci8_parse_connect_string, 1);
rb_define_private_method(cOCI8, "logon", oci8_logon, 3);
rb_define_private_method(cOCI8, "allocate_handles", oci8_allocate_handles, 0);
Modified: trunk/ruby-oci8/ext/oci8/ocinumber.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocinumber.c 2011-10-21 14:23:18 UTC (rev 456)
+++ trunk/ruby-oci8/ext/oci8/ocinumber.c 2011-10-22 05:11:51 UTC (rev 457)
@@ -257,19 +257,7 @@
}
exponent = FIX2INT(ary[3]);
- if (have_OCINumberShift) {
- /* Oracle 8.1 or upper */
- oci_lc(OCINumberShift(errhp, &digits, exponent - digits_len, &work));
- } else {
- /* Oracle 8.0 */
- int n = 10;
- OCINumber base;
- OCINumber exp;
-
- oci_lc(OCINumberFromInt(errhp, &n, sizeof(n), OCI_NUMBER_SIGNED, &base));
- oci_lc(OCINumberIntPower(errhp, &base, exponent - digits_len, &exp));
- oci_lc(OCINumberMul(errhp, &digits, &exp, &work));
- }
+ oci_lc(OCINumberShift(errhp, &digits, exponent - digits_len, &work));
if (sign >= 0) {
oci_lc(OCINumberAssign(errhp, &work, result));
} else {
@@ -1586,9 +1574,7 @@
rb_define_method(cOCINumber, "ceil", onum_ceil, 0);
rb_define_method(cOCINumber, "round", onum_round, -1);
rb_define_method(cOCINumber, "truncate", onum_trunc, -1);
- if (have_OCINumberPrec) {
- rb_define_method(cOCINumber, "round_prec", onum_round_prec, 1);
- }
+ rb_define_method(cOCINumber, "round_prec", onum_round_prec, 1);
rb_define_method(cOCINumber, "to_s", onum_to_s, 0);
rb_define_method(cOCINumber, "to_char", onum_to_char, -1);
@@ -1601,9 +1587,7 @@
rb_define_method(cOCINumber, "zero?", onum_zero_p, 0);
rb_define_method(cOCINumber, "abs", onum_abs, 0);
- if (have_OCINumberShift) {
- rb_define_method(cOCINumber, "shift", onum_shift, 1);
- }
+ rb_define_method(cOCINumber, "shift", onum_shift, 1);
rb_define_method(cOCINumber, "dump", onum_dump, 0);
rb_define_method_nodoc(cOCINumber, "hash", onum_hash, 0);
More information about the ruby-oci8-commit
mailing list