Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description:
when the column value is empty string, the error code is 0 and no warning message.
when the column value is NULL, the error code is 0.
Description in [cubrid_get|http://www.php.net/manual/en/function.cubrid-get.php]
Return Values
FALSE when process is unsuccessful or result is NULL (If error occurs to distinguish empty string from NULL, then it prints the warning message. You can check the error by using cubrid_error_code())
Repro steps:
1. execute: php get_test1.phpt
statements in get_test1.phpt
{noformat}
cubrid_execute($conn,CREATE TABLE tb(id int, name varchar(10), address string default NULL, phone varchar(10)));
cubrid_execute($conn,insert into tb(id,name,phone) values(6,'','NULL'));
cubrid_execute($conn,insert into tb(id,name,phone) values(1,'','NULL'));
$req=cubrid_execute($conn, SELECT * FROM tb order by id, CUBRID_INCLUDE_OID);
cubrid_move_cursor($req,1, CUBRID_CURSOR_FIRST);
$oid= cubrid_current_oid($req);
$attr = cubrid_get($conn, $oid, address);
if (is_null($attr)){
printf([001]NULL [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}elseif(FALSE == $attr){
printf([001]FALSE [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}else{
var_dump($attr);
}
$attr2 = cubrid_get($conn, $oid, name);
if (is_null ($attr2)){
printf([002]NULL [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}elseif(FALSE == $attr2){
printf([002]FALSE [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}else{
var_dump($attr2);
}
$attr3 = cubrid_get($conn, $oid, phone);
if (is_null ($attr3)){
printf([003]NULL [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}elseif(FALSE == $attr3){
printf([003]FALSE [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}else{
var_dump($attr3);
}
cubrid_close_prepare($req);
{noformat}
Actual result:
when column value is empty string or NULL, error code is 0 that the meaning is no error occur.
{noformat}
[001]FALSE [0] []
[002]FALSE [0] []
string(4) NULL
{noformat}
Expect result:
Perhaps warning message will appear when column value is empty string.