class OCI_Lob (View source)

OCI8 LOB functionality for large binary (BLOB) and character (CLOB) objects.

Methods

string|false
load()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns large object's contents

int|false
tell()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns the current position of internal pointer of large object

bool
truncate(int $length = 0)

(PHP 5, PECL OCI8 >= 1.1.0)
Truncates large object

int|false
erase(int $offset = null, int $length = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Erases a specified portion of the internal LOB data

bool
flush(int $flag = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Flushes/writes buffer of the LOB to the server

bool
setbuffering(bool $on_off)

(PHP 5, PECL OCI8 >= 1.1.0)
Changes current state of buffering for the large object

bool
getbuffering()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns current state of buffering for the large object

bool
rewind()

(PHP 5, PECL OCI8 >= 1.1.0)
Moves the internal pointer to the beginning of the large object

string|false
read(int $length)

(PHP 5, PECL OCI8 >= 1.1.0)
Reads part of the large object

bool
eof()

(PHP 5, PECL OCI8 >= 1.1.0)
Tests for end-of-file on a large object's descriptor

bool
seek(int $offset, int $whence = OCI_SEEK_SET)

(PHP 5, PECL OCI8 >= 1.1.0)
Sets the internal pointer of the large object

int|false
write(string $data, int $length = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Writes data to the large object

bool
append(OCI_Lob $lob_from)

(PHP 5, PECL OCI8 >= 1.1.0)
Appends data from the large object to another large object

int|false
size()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns size of large object

bool
writetofile($filename, $start, $length)

(PHP 5, PECL OCI8 >= 1.1.0)
Alias of {OCI_Lob::export}

bool
export(string $filename, int $start = null, int $length = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Exports LOB's contents to a file

bool
import(string $filename)

(PHP 5, PECL OCI8 >= 1.1.0)
Imports file data to the LOB

bool
writeTemporary(string $data, int $lob_type = OCI_TEMP_CLOB)

(PHP 5, PECL OCI8 >= 1.1.0)
Writes a temporary large object

bool
close()

(PHP 5, PECL OCI8 >= 1.1.0)
Closes LOB descriptor

bool
save(string $data, int $offset = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Saves data to the large object

bool
savefile($filename)

(PHP 5, PECL OCI8 >= 1.1.0)
Alias of {OCI_Lob::import}

bool
free()

(PHP 5, PECL OCI8 >= 1.1.0)
Frees resources associated with the LOB descriptor

Details

string|false load()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns large object's contents

Return Value

string|false

The contents of the object, or FALSE on errors.

int|false tell()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns the current position of internal pointer of large object

Return Value

int|false

Current position of a LOB's internal pointer or FALSE if an error occurred.

bool truncate(int $length = 0)

(PHP 5, PECL OCI8 >= 1.1.0)
Truncates large object

Parameters

int $length

[optional]

If provided, this method will truncate the LOB to length bytes. Otherwise, it will completely purge the LOB.

Return Value

bool

TRUE on success or FALSE on failure.

int|false erase(int $offset = null, int $length = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Erases a specified portion of the internal LOB data

Parameters

int $offset [optional]
int $length [optional]

Return Value

int|false

The actual number of characters/bytes erased or FALSE on failure.

bool flush(int $flag = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Flushes/writes buffer of the LOB to the server

Parameters

int $flag

[optional]

By default, resources are not freed, but using flag OCI_LOB_BUFFER_FREE you can do it explicitly. Be sure you know what you're doing - next read/write operation to the same part of LOB will involve a round-trip to the server and initialize new buffer resources. It is recommended to use OCI_LOB_BUFFER_FREE flag only when you are not going to work with the LOB anymore.

Return Value

bool

TRUE on success or FALSE on failure.

Returns FALSE if buffering was not enabled or an error occurred.

bool setbuffering(bool $on_off)

(PHP 5, PECL OCI8 >= 1.1.0)
Changes current state of buffering for the large object

Parameters

bool $on_off

TRUE for on and FALSE for off.

Return Value

bool

TRUE on success or FALSE on failure. Repeated calls to this method with the same flag will return TRUE.

bool getbuffering()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns current state of buffering for the large object

Return Value

bool

FALSE if buffering for the large object is off and TRUE if buffering is used.

bool rewind()

(PHP 5, PECL OCI8 >= 1.1.0)
Moves the internal pointer to the beginning of the large object

Return Value

bool

TRUE on success or FALSE on failure.

string|false read(int $length)

(PHP 5, PECL OCI8 >= 1.1.0)
Reads part of the large object

Parameters

int $length

The length of data to read, in bytes. Large values will be rounded down to 1 MB.

Return Value

string|false

The contents as a string, or FALSE on failure.

bool eof()

(PHP 5, PECL OCI8 >= 1.1.0)
Tests for end-of-file on a large object's descriptor

Return Value

bool

TRUE if internal pointer of large object is at the end of LOB. Otherwise returns FALSE.

bool seek(int $offset, int $whence = OCI_SEEK_SET)

(PHP 5, PECL OCI8 >= 1.1.0)
Sets the internal pointer of the large object

Parameters

int $offset

Indicates the amount of bytes, on which internal pointer should be moved from the position, pointed by whence.

int $whence

[optional]

May be one of: OCI_SEEK_SET - sets the position equal to offset OCI_SEEK_CUR - adds offset bytes to the current position OCI_SEEK_END - adds offset bytes to the end of large object (use negative value to move to a position before the end of large object)

Return Value

bool

TRUE on success or FALSE on failure.

int|false write(string $data, int $length = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Writes data to the large object

Parameters

string $data

The data to write in the LOB.

int $length

[optional]

If this parameter is given, writing will stop after length bytes have been written or the end of data is reached, whichever comes first.

Return Value

int|false

The number of bytes written or FALSE on failure.

bool append(OCI_Lob $lob_from)

(PHP 5, PECL OCI8 >= 1.1.0)
Appends data from the large object to another large object

Parameters

OCI_Lob $lob_from

The copied LOB.

Return Value

bool

TRUE on success or FALSE on failure.

int|false size()

(PHP 5, PECL OCI8 >= 1.1.0)
Returns size of large object

Return Value

int|false

Length of large object value or FALSE on failure. Empty objects have zero length.

bool writetofile($filename, $start, $length)

(PHP 5, PECL OCI8 >= 1.1.0)
Alias of {OCI_Lob::export}

Parameters

$filename
$start [optional]
$length [optional]

Return Value

bool

TRUE on success or FALSE on failure.

bool export(string $filename, int $start = null, int $length = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Exports LOB's contents to a file

Parameters

string $filename

Path to the file.

int $start

[optional]

Indicates from where to start exporting.

int $length

[optional]

Indicates the length of data to be exported.

Return Value

bool

TRUE on success or FALSE on failure.

bool import(string $filename)

(PHP 5, PECL OCI8 >= 1.1.0)
Imports file data to the LOB

Parameters

string $filename

Path to the file.

Return Value

bool

TRUE on success or FALSE on failure.

bool writeTemporary(string $data, int $lob_type = OCI_TEMP_CLOB)

(PHP 5, PECL OCI8 >= 1.1.0)
Writes a temporary large object

Parameters

string $data

The data to write.

int $lob_type

[optional]

Can be one of the following: OCI_TEMP_BLOB is used to create temporary BLOBs OCI_TEMP_CLOB is used to create temporary CLOBs

Return Value

bool

TRUE on success or FALSE on failure.

bool close()

(PHP 5, PECL OCI8 >= 1.1.0)
Closes LOB descriptor

Return Value

bool

TRUE on success or FALSE on failure.

bool save(string $data, int $offset = null)

(PHP 5, PECL OCI8 >= 1.1.0)
Saves data to the large object

Parameters

string $data

The data to be saved.

int $offset

[optional]

Can be used to indicate offset from the beginning of the large object.

Return Value

bool

TRUE on success or FALSE on failure.

bool savefile($filename)

(PHP 5, PECL OCI8 >= 1.1.0)
Alias of {OCI_Lob::import}

Parameters

$filename

Return Value

bool

Return true on success and false on failure

bool free()

(PHP 5, PECL OCI8 >= 1.1.0)
Frees resources associated with the LOB descriptor

Return Value

bool

TRUE on success or FALSE on failure.