Class: OCIHandle

Inherits:
Object
  • Object
show all
Defined in:
ext/oci8/oci8.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.newObject

Instance Method Details

#attrGet(vtype) ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'ext/oci8/attr.c', line 391

VALUE oci8_attr_get(VALUE self, VALUE vtype)
{
  oci8_handle_t *h;
  ub4 type;
  char attr_type_flag;

  Get_Handle(self, h); /* 0 */
  type = NUM2UINT(vtype); /* 1 */

  /* check range. */
  if (oci8_attr_size <= type)
    rb_raise(rb_eArgError, "invalid OCI_ATTR_ type");

  /* check attribute type */
  if (h->type < OCI_DTYPE_FIRST)
    attr_type_flag = ATTR_FOR_HNDL;
  else
    attr_type_flag = ATTR_FOR_DESC;
  if (!(oci8_attr_list[type].attr_type & attr_type_flag))
    rb_raise(rb_eArgError, "invalid OCI_ATTR_ type");
  
  if (oci8_attr_list[type].get == NULL)
    rb_raise(rb_eArgError, "attrGet is not permitted for %s", oci8_attr_list[type].name);
  return oci8_attr_list[type].get(h, oci8_attr_list[type].attr);
}

#attrSet(vtype, value) ⇒ Object



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'ext/oci8/attr.c', line 354

VALUE oci8_attr_set(VALUE self, VALUE vtype, VALUE value)
{
  oci8_handle_t *h;
  ub4 type;
  char attr_type_flag;

  Get_Handle(self, h); /* 0 */
  type = NUM2UINT(vtype); /* 1 */

  /* check range. */
  if (oci8_attr_size <= type)
    rb_raise(rb_eArgError, "invalid OCI_ATTR_ type");

  /* check attribute type */
  if (h->type < OCI_DTYPE_FIRST)
    attr_type_flag = ATTR_FOR_HNDL;
  else
    attr_type_flag = ATTR_FOR_DESC;
  if (!(oci8_attr_list[type].attr_type & attr_type_flag))
    rb_raise(rb_eArgError, "invalid OCI_ATTR_ type");

  if (oci8_attr_list[type].set == NULL)
    rb_raise(rb_eArgError, "attrSet is not permitted for %s", oci8_attr_list[type].name);

  oci8_attr_list[type].set(h, oci8_attr_list[type].attr, value);

  switch (oci8_attr_list[type].attr) {
  case OCI_ATTR_SERVER:
    rb_ivar_set(self, oci8_id_server, value);
    break;
  case OCI_ATTR_SESSION:
    rb_ivar_set(self, oci8_id_session, value);
    break;
  }
  return self;
}

#freeObject

begin

— OCIHandle#free()

explicitly free the OCI's data structure.

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

end



75
76
77
78
79
80
81
82
# File 'ext/oci8/handle.c', line 75

VALUE oci8_handle_free(VALUE self)
{
  oci8_handle_t *h;

  Get_Handle(self, h);
  oci8_handle_do_free(h);
  return self;
}