62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'ext/oracledb/rboradb.c', line 62
static VALUE context_initialize(int argc, VALUE *argv, VALUE self)
{
context_t *ctxt = rb_check_typeddata(self, &context_data_type);
dpiContextCreateParams params = {0,};
VALUE arg;
dpiContext *handle;
dpiErrorInfo errorInfo;
volatile VALUE gc_guard = Qnil;
rb_scan_args(argc, argv, "01", &arg);
if (!NIL_P(arg)) {
gc_guard = rboradb_set_dpiContextCreateParams(¶ms, arg);
}
if (dpiContext_createWithParams(DPI_MAJOR_VERSION, DPI_MINOR_VERSION, ¶ms, &handle, &errorInfo) != DPI_SUCCESS) {
rb_exc_raise(rboradb_from_dpiErrorInfo(&errorInfo));
}
RB_GC_GUARD(gc_guard);
ctxt->ctxt = RB_ALLOC(rbOraDBContext);
ctxt->ctxt->handle = handle;
ctxt->ctxt->refcnt = 1;
return Qnil;
}
|