With a query that can update the CUBRID_INCLUDE_OID option in the cubrid_execute() function, you can get the OID value of the current row updated by the executing cubrid_current_oid().
$req = cubrid_execute($con, "select * from person where id = 1", CUBRID_INCLUDE_OID);
if ($req) {
while ($row = cubrid_fetch($req)) {
echo cubrid_current_oid($req);
echo $row["id"];
echo $row["name"];
}
cubrid_close_request($req);
}
You can get all attributes, the specified attribute or an attribute of an instance by using the OID.
If you don't specify any attribute in the cubrid_get() function, the values of all attributes are returned (a). If you specify an attribute as an array data type, an associative array containing the values of the specified attribute is returned (b). If you specify an attribute as a character string array, the value of the attribute is returned (c).
$attrarray = cubrid_get($con, $oid); // (a)
$attrarray = cubrid_get($con, $oid, array("id", "name")); // (b)
$attrarray = cubrid_get($con, $oid, "id"); // (c)
You can also update an attribute value of an instance by using the OID. To update a single attribute value, specify the attribute name as a character string type and its value (a). To set multiple attribute values, specify an associative array containing the attribute names and values (b).
$cubrid_put ($con, $oid, "id", 1); // (a)
$cubrid_put ($con, $oid, array("id"=>1, "name"=>"Tomas")); // (b)
$row = cubrid_fetch ($req);
$col = $row["customer"];
while (list ($key, $cust) = each ($col)) {
echo $cust;
}
$tels = cubrid_col_get ($con, $oid, "tels");
while (list ($key, $tel) = each ($tels)) {
echo $tel."\n";
}
$tels = cubrid_col_get ($con, $oid, "tels");
while (list ($key, $tel) = each ($tels)) {
$res = cubrid_set_drop ($con, $oid, "tel", $tel);
}
cubrid_commit ($con);
Note A string is truncated if longer string specified in the column is inserted or updated (INSERT/UPDATE).