Class: OCI8::BFILE

Inherits:
OCI8LOB show all
Defined in:
ext/oci8/lob.c

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object



547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'ext/oci8/lob.c', line 547

static VALUE oci8_bfile_initialize(int argc, VALUE *argv, VALUE self)
{
    oci8_lob_t *lob = DATA_PTR(self);
    VALUE svc;
    VALUE dir_alias;
    VALUE filename;
    int rv;

    rb_scan_args(argc, argv, "12", &svc, &dir_alias, &filename);
    TO_SVCCTX(svc); /* check argument type */
    rv = OCIDescriptorAlloc(oci8_envhp, &lob->base.hp.ptr, OCI_DTYPE_LOB, 0, NULL);
    if (rv != OCI_SUCCESS) {
        oci8_env_raise(oci8_envhp, rv);
    }
    lob->base.type = OCI_DTYPE_LOB;
    lob->svc = svc;
    lob->pos = 0;
    lob->char_width = 1;
    lob->csfrm = SQLCS_IMPLICIT;
    lob->lobtype = OCI_TEMP_BLOB;
    lob->state = S_BFILE_CLOSE;
    if (argc != 1) {
        OCI8SafeStringValue(dir_alias);
        OCI8SafeStringValue(filename);
        oci8_bfile_set_name(self, dir_alias, filename);
    }
    oci8_link_to_parent((oci8_base_t*)lob, (oci8_base_t*)DATA_PTR(svc));
    return Qnil;
}

Instance Method Details

#dir_aliasObject



577
578
579
580
581
582
583
# File 'ext/oci8/lob.c', line 577

static VALUE oci8_bfile_get_dir_alias(VALUE self)
{
    VALUE dir_alias;

    oci8_bfile_get_name(self, &dir_alias, NULL);
    return dir_alias;
}

#dir_alias=(dir_alias) ⇒ Object



593
594
595
596
597
598
599
600
601
602
# File 'ext/oci8/lob.c', line 593

static VALUE oci8_bfile_set_dir_alias(VALUE self, VALUE dir_alias)
{
    VALUE filename;

    OCI8SafeStringValue(dir_alias);
    oci8_bfile_get_name(self, NULL, &filename);
    oci8_bfile_set_name(self, dir_alias, filename);
    rb_ivar_set(self, id_dir_alias, dir_alias);
    return dir_alias;
}

#exists?Boolean

Returns:

  • (Boolean)


615
616
617
618
619
620
621
622
623
624
# File 'ext/oci8/lob.c', line 615

static VALUE oci8_bfile_exists_p(VALUE self)
{
    oci8_lob_t *lob = DATA_PTR(self);
    oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
    boolean flag;

    chker2(OCILobFileExists_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, &flag),
           &svcctx->base);
    return flag ? Qtrue : Qfalse;
}

#filenameObject



585
586
587
588
589
590
591
# File 'ext/oci8/lob.c', line 585

static VALUE oci8_bfile_get_filename(VALUE self)
{
    VALUE filename;

    oci8_bfile_get_name(self, NULL, &filename);
    return filename;
}

#filename=(filename) ⇒ Object



604
605
606
607
608
609
610
611
612
613
# File 'ext/oci8/lob.c', line 604

static VALUE oci8_bfile_set_filename(VALUE self, VALUE filename)
{
    VALUE dir_alias;

    OCI8SafeStringValue(filename);
    oci8_bfile_get_name(self, &dir_alias, NULL);
    oci8_bfile_set_name(self, dir_alias, filename);
    rb_ivar_set(self, id_filename, filename);
    return filename;
}

#size=(dummy) ⇒ Object



626
627
628
629
# File 'ext/oci8/lob.c', line 626

static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
    rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}

#truncate(dummy) ⇒ Object



626
627
628
629
# File 'ext/oci8/lob.c', line 626

static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
    rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}

#write(dummy) ⇒ Object



626
627
628
629
# File 'ext/oci8/lob.c', line 626

static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
    rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}