/* * call-seq: * oracle_server_vernum -> an integer * * <b>(new in 2.0.1)</b> * * Returns a numerical format of the Oracle server version. * * See also: #oracle_server_version */ static VALUE oci8_oracle_server_vernum(VALUE self) { oci8_svcctx_t *svcctx = DATA_PTR(self); char buf[100]; 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; } }
/* * call-seq: * oracle_server_vernum -> an integer * * <b>(new in 2.0.1)</b> * * Returns a numerical format of the Oracle server version. * * See also: #oracle_server_version */ static VALUE oci8_oracle_server_vernum(VALUE self) { oci8_svcctx_t *svcctx = DATA_PTR(self); char buf[100]; ub4 version; chker2(OCIServerRelease(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), (ub1)svcctx->base.type, &version), &svcctx->base); return UINT2NUM(version); }
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)); }