Class: OCI8::BFILE
Instance Method Summary collapse
-
#dir_alias ⇒ String
Returns the directory object name.
-
#dir_alias=(name) ⇒ Object
Changes the directory object name.
-
#exists? ⇒ true or false
Returns
truewhen the BFILE exists on the server’s operating system. -
#filename ⇒ String
Returns the file name.
-
#filename=(name) ⇒ Object
Changes the file name.
-
#initialize(conn, dir_alias = nil, filename = nil) ⇒ OCI8::BFILE
constructor
Creates a BFILE object.
- #size( = length) ⇒ Object
-
#size=(dummy) ⇒ Object
call-seq: write(data).
-
#truncate(dummy) ⇒ Object
call-seq: write(data).
-
#write(dummy) ⇒ Object
call-seq: write(data).
Methods inherited from LOB
#available?, #chunk_size, #close, #eof?, #pos, #read, #rewind, #seek
Constructor Details
#initialize(conn, dir_alias = nil, filename = nil) ⇒ OCI8::BFILE
Creates a BFILE object. This is correspond to BFILENAME.
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'ext/oci8/lob.c', line 781
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_alias ⇒ String
Returns the directory object name.
816 817 818 819 820 821 822 |
# File 'ext/oci8/lob.c', line 816
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=(name) ⇒ Object
Changes the directory object name.
845 846 847 848 849 850 851 852 853 854 |
# File 'ext/oci8/lob.c', line 845
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? ⇒ true or false
Returns true when the BFILE exists on the server’s operating system.
880 881 882 883 884 885 886 887 888 889 |
# File 'ext/oci8/lob.c', line 880
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;
}
|
#filename ⇒ String
Returns the file name.
829 830 831 832 833 834 835 |
# File 'ext/oci8/lob.c', line 829
static VALUE oci8_bfile_get_filename(VALUE self)
{
VALUE filename;
oci8_bfile_get_name(self, NULL, &filename);
return filename;
}
|
#filename=(name) ⇒ Object
Changes the file name.
864 865 866 867 868 869 870 871 872 873 |
# File 'ext/oci8/lob.c', line 864
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( = length) ⇒ Object
#size=(dummy) ⇒ Object
call-seq:
write(data)
Raises RuntimeError.
924 925 926 927 |
# File 'ext/oci8/lob.c', line 924
static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}
|
#truncate(dummy) ⇒ Object
call-seq:
write(data)
Raises RuntimeError.
205 206 207 208 |
# File 'ext/oci8/lob.c', line 205
static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}
|
#write(dummy) ⇒ Object
call-seq:
write(data)
Raises RuntimeError.
205 206 207 208 |
# File 'ext/oci8/lob.c', line 205
static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}
|