(PECL CUBRID >= 8.4.1)
cubrid_lob2_import — 從檔案匯入 BLOB/CLOB 資料
cubrid_lob2_import() 函式用於從檔案儲存 BLOB/CLOB 資料的內容。要使用此函式,您必須先使用 cubrid_lob2_new() 或從 CUBRID 資料庫擷取 lob 物件。如果檔案已存在,操作將會失敗。此函式不會影響 lob 物件的游標位置。它會操作整個 lob 物件。
lob_identifier
Lob 識別碼,作為 cubrid_lob2_new() 的結果或從結果集中取得。
filename
您要匯入 BLOB/CLOB 資料的檔案名稱。它也支援檔案的路徑。
範例 #1 cubrid_lob2_export() 範例
<?php
$conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
cubrid_execute($conn,"DROP TABLE if exists test_lob");
cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)");
$req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES (?, ?)");
cubrid_bind($req, 1, 1);
$lob = cubrid_lob2_new($conn, "clob");
cubrid_lob2_import($lob, "doc_1.txt");
cubrid_lob2_bind($req, 2, $lob, 'CLOB'); // 或 cubrid_lob2_bind($req, 2, $lob);
cubrid_execute($req);
cubrid_lob2_close($lob);
cubrid_disconnect($conn);
?>