(PECL CUBRID >= 8.4.1)
cubrid_lob2_bind — 將 lob 物件或字串作為 lob 物件繫結到準備好的陳述式作為參數
函數 cubrid_lob2_bind() 用於將 BLOB/CLOB 資料繫結至傳遞給 cubrid_prepare() 的 SQL 陳述式中相對應的問號佔位符。如果未提供 bind_value_type
,則預設將字串設為 "BLOB"。但如果您先前使用了 cubrid_lob2_new(),則 bind_value_type
將預設與 cubrid_lob2_new() 中的 type
保持一致。
req_identifier
cubrid_prepare() 執行結果的請求識別碼。
bind_index
繫結參數的位置。從 1 開始。
bind_value
要繫結的實際值。
bind_value_type
必須是 "BLOB" 或 "CLOB",且不區分大小寫。如果未提供,則預設值為 "BLOB"。
範例 #1 cubrid_lob2_bind() 範例
<?php
// 資料表:test_lob (id INT, contents CLOB)
$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, 3);
$lob = cubrid_lob2_new($conn, 'CLOB');
cubrid_lob2_bind($req, 2, $lob);
cubrid_execute($req);
cubrid_bind($req, 1, 4);
cubrid_lob2_bind($req, 2, 'CUBRID LOB2 測試', 'CLOB');
cubrid_execute($req);
cubrid_disconnect($conn);
?>