fbsql_read_clob
(PHP 4 >= 4.2.0, PHP 5)
fbsql_read_clob — Read a CLOB from the database
Description
Reads CLOB data from the database.
If a select statement contains BLOB and/or CLOB columns FrontBase will return the data directly when data is fetched. This default behavior can be changed with fbsql_set_lob_mode() so the fetch functions will return handles to BLOB and CLOB data. If a handle is fetched a user must call fbsql_read_clob() to get the actual CLOB data from the database.
Parameters
- clob_handle
-
A CLOB handle, returned by fbsql_create_clob().
- link_identifier
-
A FrontBase link identifier returned by fbsql_connect() or fbsql_pconnect().
If optional and not specified, the function will try to find an open link to the FrontBase server and if no such link is found it will try to create one as if fbsql_connect() was called with no arguments.
Return Values
Returns a string containing the specified CLOB data.
Examples
Example #1 fbsql_read_clob() example
<?php
$link = fbsql_pconnect("localhost", "_SYSTEM", "secret")
or die("Could not connect");
$sql = "SELECT CLOB_COLUMN FROM CLOB_TABLE;";
$rs = fbsql_query($sql, $link);
$row_data = fbsql_fetch_row($rs);
// $row_data[0] will now contain the clob data for the first row
fbsql_free_result($rs);
$rs = fbsql_query($sql, $link);
fbsql_set_lob_mode($rs, FBSQL_LOB_HANDLE);
$row_data = fbsql_fetch_row($rs);
// $row_data[0] will now contain a handle to the CLOB data in the first row
$clob_data = fbsql_read_clob($row_data[0]);
fbsql_free_result($rs);
?>
See Also
- fbsql_create_clob() - Create a CLOB
- fbsql_read_blob() - Read a BLOB from the database
- fbsql_set_lob_mode() - Set the LOB retrieve mode for a FrontBase result set