(PECL CUBRID >= 8.3.0)
cubrid_seq_put — 使用 OID 更新序列类型列的元素值
$conn_identifier
,$oid
,$attr_name
,$index
,$seq_element
cubrid_seq_put() 函数用于使用 OID 更新序列类型属性中请求元素的内容。
conn_identifier
连接标识符。
oid
要操作的实例的 OID。
attr_name
要更新元素的属性的名称。
index
要更新的元素的索引(从 1 开始)。
seq_element
要用于更新的新内容。
示例 #1 cubrid_seq_put() 示例
<?php
$conn = cubrid_connect("localhost", 33000, "demodb", "dba");
@cubrid_execute($conn, "DROP TABLE foo");
cubrid_execute($conn, "CREATE TABLE foo(a int AUTO_INCREMENT, b set(int), c sequence(int), d char(10))");
cubrid_execute($conn, "INSERT INTO foo(a, b, c, d) VALUES(1, {1,2,3}, {11,22,33,333}, 'a')");
$req = cubrid_execute($conn, "SELECT * FROM foo", CUBRID_INCLUDE_OID);
cubrid_move_cursor($req, 1, CUBRID_CURSOR_FIRST);
$oid = cubrid_current_oid($req);
$attr = cubrid_col_get($conn, $oid, "c");
var_dump($attr);
cubrid_seq_put($conn, $oid, "c", 1, "111");
$attr = cubrid_col_get($conn, $oid, "c");
var_dump($attr);
cubrid_close_request($req);
cubrid_disconnect($conn);
?>
上面的例子将输出
array(4) { [0]=> string(2) "11" [1]=> string(2) "22" [2]=> string(2) "33" [3]=> string(3) "333" } array(4) { [0]=> string(3) "111" [1]=> string(2) "22" [2]=> string(2) "33" [3]=> string(3) "333" }