fbsql_read_blob

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

fbsql_read_blobRead a BLOB from the database

说明

fbsql_read_blob ( string $blob_handle [, resource $link_identifier ] ) : string

Reads BLOB 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_blob() to get the actual BLOB data from the database.

参数

blob_handle

A BLOB handle, returned by fbsql_create_blob().

link_identifier

fbsql_connect()fbsql_pconnect() 返回的 FrontBase 链接标识符.

如可选并未指定,函数会尝试查找一个到 FrontBase 服务器的开放链接,且如没有找到这样的链接,会尝试通过不带参数调用 fbsql_connect() 来创建一个。

返回值

Returns a string containing the specified BLOB data.

范例

Example #1 fbsql_read_blob() example

<?php
$link 
fbsql_pconnect("localhost""_SYSTEM""secret")
    or die(
"Could not connect");
$sql "SELECT BLOB_COLUMN FROM BLOB_TABLE;";
$rs fbsql_query($sql$link);
$row_data fbsql_fetch_row($rs);
// $row_data[0] will now contain the blob data for the first row
fbsql_free_result($rs);

$rs fbsql_query($sql$link);
fbsql_set_lob_mode($rsFBSQL_LOB_HANDLE);
$row_data fbsql_fetch_row($rs);
// $row_data[0] will now contain a handle to the BLOB data in the first row
$blob_data fbsql_read_blob($row_data[0]);
fbsql_free_result($rs);

?>

参见

关注编程学问公众号