FBSQL_SET_LOB_MODE(3) 1 FBSQL_SET_LOB_MODE(3)fbsql_set_lob_mode - Set the LOB retrieve mode for a FrontBase result setSYNOPSIS
bool fbsql_set_lob_mode (resource $result, int $lob_mode)
DESCRIPTION
Sets the mode for retrieving LOB data from the database.
When BLOB and CLOB data is retrieved in FrontBase it can be retrieved direct or indirect. Direct retrieved LOB data will always be fetched
no matter the setting of the lob mode. If the LOB data is less than 512 bytes it will always be retrieved directly.
PARAMETERS
o $
result -A result identifier returned by fbsql_query(3) or fbsql_db_query(3).
o $lob_mode
- Can be one of:
o FBSQL_LOB_DIRECT - LOB data is retrieved directly. When data is fetched from the database with fbsql_fetch_row(3), and
other fetch functions, all CLOB and BLOB columns will be returned as ordinary columns. This is the default value on a new
FrontBase result.
o FBSQL_LOB_HANDLE - LOB data is retrieved as handles to the data. When data is fetched from the database with
fbsql_fetch_row(3), and other fetch functions, LOB data will be returned as a handle to the data if the data is stored
indirect or the data if it is stored direct. If a handle is returned it will be a 27 byte string formatted as
@'000000000000000000000000'.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
SEE ALSO fbsql_create_blob(3), fbsql_create_clob(3), fbsql_read_blob(3), fbsql_read_clob(3).
PHP Documentation Group FBSQL_SET_LOB_MODE(3)
Check Out this Related Man Page
DB2_LOB_READ(3) 1 DB2_LOB_READ(3)db2_lob_read - Gets a user defined size of LOB files with each invocationSYNOPSIS
string db2_lob_read (resource $stmt, int $colnum, int $length)
DESCRIPTION
Use db2_lob_read(3) to iterate through a specified column of a result set and retrieve a user defined size of LOB data.
PARAMETERS
o $stmt
- A valid stmt resource containing LOB data.
o $colnum
- A valid column number in the result set of the stmt resource.
o $length
- The size of the LOB data to be retrieved from the stmt resource.
RETURN VALUES
Returns the amount of data the user specifies. Returns FALSE if the data cannot be retrieved.
EXAMPLES
Example #1
Iterating through different types of data
<?php
/* Database Connection Parameters */
$db = 'SAMPLE';
$username = 'db2inst1';
$password = 'ibmdb2';
/* Obtain Connection Resource */
$conn = db2_connect($db,$username,$password);
if ($conn) {
$drop = 'DROP TABLE clob_stream';
$result = @db2_exec( $conn, $drop );
$create = 'CREATE TABLE clob_stream (id INTEGER, my_clob CLOB)';
$result = db2_exec( $conn, $create );
$variable = "";
$stmt = db2_prepare($conn, "INSERT INTO clob_stream (id,my_clob) VALUES (1, ?)");
$variable = "THIS IS A CLOB TEST. THIS IS A CLOB TEST.";
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
db2_execute($stmt);
$sql = "SELECT id,my_clob FROM clob_stream";
$result = db2_prepare($conn, $sql);
db2_execute($result);
db2_fetch_row($result);
$i = 0;
/* Read LOB data */
while ($data = db2_lob_read($result, 2, 6)) {
echo "Loop $i: $data
";
$i = $i + 1;
}
$drop = 'DROP TABLE blob_stream';
$result = @db2_exec( $conn, $drop );
$create = 'CREATE TABLE blob_stream (id INTEGER, my_blob CLOB)';
$result = db2_exec( $conn, $create );
$variable = "";
$stmt = db2_prepare($conn, "INSERT INTO blob_stream (id,my_blob) VALUES (1, ?)");
$variable = "THIS IS A BLOB TEST. THIS IS A BLOB TEST.";
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
db2_execute($stmt);
$sql = "SELECT id,my_blob FROM blob_stream";
$result = db2_prepare($conn, $sql);
db2_execute($result);
db2_fetch_row($result);
$i = 0;
/* Read LOB data */
while ($data = db2_lob_read($result, 2, 6)) {
echo "Loop $i: $data
";
$i = $i + 1;
}
} else {
echo 'no connection: ' . db2_conn_errormsg();
}
?>
The above example will output:
Loop 0: THIS I
Loop 1: S A CL
Loop 2: OB TES
Loop 3: T. THI
Loop 4: S IS A
Loop 5: CLOB
Loop 6: TEST.
Loop 0: THIS I
Loop 1: S A BL
Loop 2: OB TES
Loop 3: T. THI
Loop 4: S IS A
Loop 5: BLOB
Loop 6: TEST.
SEE ALSO db2_bind_param(3), db2_exec(3), db2_execute(3), db2_fetch_row(3), db2_prepare(3), db2_result(3).
PHP Documentation Group DB2_LOB_READ(3)