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
true
when 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.
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 |
# File 'ext/oci8/lob.c', line 805
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;
oci8_svcctx_t *svcctx;
int rv;
rb_scan_args(argc, argv, "12", &svc, &dir_alias, &filename);
svcctx = oci8_get_svcctx(svc);
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->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));
lob->svcctx = svcctx;
return Qnil;
}
|
Instance Method Details
#dir_alias ⇒ String
Returns the directory object name.
841 842 843 844 845 846 847 |
# File 'ext/oci8/lob.c', line 841
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.
870 871 872 873 874 875 876 877 878 879 |
# File 'ext/oci8/lob.c', line 870
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.
905 906 907 908 909 910 911 912 913 914 |
# File 'ext/oci8/lob.c', line 905
static VALUE oci8_bfile_exists_p(VALUE self)
{
oci8_lob_t *lob = DATA_PTR(self);
oci8_svcctx_t *svcctx = check_svcctx(lob);
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.
854 855 856 857 858 859 860 |
# File 'ext/oci8/lob.c', line 854
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.
889 890 891 892 893 894 895 896 897 898 |
# File 'ext/oci8/lob.c', line 889
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
.
949 950 951 952 |
# File 'ext/oci8/lob.c', line 949
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
.
219 220 221 222 |
# File 'ext/oci8/lob.c', line 219
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
.
219 220 221 222 |
# File 'ext/oci8/lob.c', line 219
static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
{
rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
}
|