W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
(PECL CUBRID >= 8.4.1)
cubrid_lob2_read — 從 BLOB/CLOB 數(shù)據(jù)讀取
cubrid_lob2_read(resource $lob_identifier, int $len): string
cubrid_lob2_read() 函數(shù)從 LOB 數(shù)據(jù)并返回讀取的字節(jié)數(shù)。len
lob_identifier
作為 cubrid_lob2_new() 結(jié)果的 Lob 標(biāo)識(shí)符或從結(jié)果集中獲取。
len
要從 lob 數(shù)據(jù)中讀取的緩沖區(qū)的長(zhǎng)度。
以字符串形式返回內(nèi)容,當(dāng)沒(méi)有更多數(shù)據(jù)時(shí)返回 false,失敗時(shí)返回 null。
示例 #1 cubrid_lob2_read() example 1
<?php
// test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "public", "");
$req = cubrid_execute($conn, "select * from test_lob");
$row = cubrid_fetch_row($req, CUBRID_LOB);
print "position now is " . cubrid_lob2_tell($row[1]) . "\n";
cubrid_lob2_seek($row[1], 10, CUBRID_CURSOR_FIRST);
print "\nposition after moving farword is " . cubrid_lob2_tell($row[1]) . "\n";
$data = cubrid_lob2_read($row[1], 12);
print "\nposition after reading is " . cubrid_lob2_tell($row[1]) . "\n";
print $data . "\n";
cubrid_lob2_seek($row[1], 5, CUBRID_CURSOR_CURRENT);
print "\nposition after moving again is " . cubrid_lob2_tell($row[1]) . "\n";
$data = cubrid_lob2_read($row[1], 20);
print $data . "\n";
cubrid_disconnect($conn);
?>
示例 #2 cubrid_lob2_read() example 2
<?php
// test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
$req = cubrid_execute($conn, "select * from test_lob");
$row = cubrid_fetch_row($req, CUBRID_LOB);
while (true) {
if ($data = cubrid_lob2_read($row[1], 1024)) {
print $data . "\n";
}
elseif ($data === false) {
print "There is no more data\n";
break;
}
else {
print "There must some errors\n";
break;
}
}
cubrid_disconnect($conn);
?>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: