Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: PHP-8.4.1
-
Fix Version/s: None
-
Component/s: PHPDriver
-
Labels:None
Description
Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description:
when the value of $row_number is out of range, the error code is 0 in cubrid_data_seek() method.
when the value of $offset is out of range, the error message will appear in cubrid_move_cursor method
Decription in APIS-109:
Make the return values of cubrid_move_cursor and cubrid_data_seek consistent with mysql_data_seek
when the row number is out of range,whether the error message need to be consistent with mysql_data_seek
Repro steps:
Repro steps:
First: cubrid_data_seek method
1. execute: php seek_errormsg_test2.phpt
statements in seek_errormsg_test2.phpt
$sql ="CREATE TABLE seek_tb(id int, name varchar(10))";
cubrid_execute($conn,$sql);
cubrid_execute($conn,"insert into seek_tb values(1,'name1'),(2,'name2'),(3,'name3'),(4,'name4'),(5,'name5')");
$req1 = cubrid_execute($conn, "SELECT * FROM seek_tb");
//offset is large than range
$mov2=cubrid_data_seek($req1,5);
if(FALSE == $mov2){
printf("[002]Expect false [%d] [%s]\n", cubrid_errno($conn), cubrid_error($conn));
}else{
printf("[002]Move success\n");
$result = cubrid_fetch_row($req1);
var_dump($result);
}
//offset is less than 0
$mov3=cubrid_data_seek($req1,-1);
if(FALSE == $mov3){
printf("[003]Expect false [%d] [%s]\n", cubrid_error_code(), cubrid_error_msg());
}else{
printf("[003]Move success\n");
$result = cubrid_fetch_row($req1);
var_dump($result);
}
cubrid_close_request($req1);
Actual result:
error code is 0 and error message is empty.
[002]Expect false [0] [] [003]Expect false [0] []
Second: cubrid_move_cursor method
Statements:
$sql ="CREATE TABLE move_tb(id int, name varchar(10))";
cubrid_execute($conn,$sql);
cubrid_execute($conn,"insert into move_tb values(1,'name1'),(2,'name2'),(3,'name3'),(4,'name4'),(5,'name5')");
$req1 = cubrid_execute($conn, "SELECT * FROM move_tb order by id");
//offset is large than range
$mov2=cubrid_move_cursor($req1,7, CUBRID_CURSOR_FIRST);
if(FALSE == $mov2){
printf("[002]Expect false [%d] [%s]\n", cubrid_errno($conn), cubrid_error($conn));
}else{
printf("[002]Move success\n");
$result = cubrid_fetch_row($req1);
var_dump($result);
}
//offset is less than 0
$mov3=cubrid_move_cursor($req1,-1, CUBRID_CURSOR_FIRST);
if(FALSE == $mov3){
printf("[003]Expect false [%d] [%s]\n", cubrid_error_code(), cubrid_error_msg());
}else{
printf("[003]Move success\n");
$result = cubrid_fetch_row($req1);
var_dump($result);
}
cubrid_close_request($req1);
Actual result:
Error message is invalid cursor position
PHP Warning: Error: CCI, -5, Invalid cursor position in /home/php/phpTestcases/_02_prepare/bug/move_cursor_test.phpt on line 11 [002]Expect false [-5] [Invalid cursor position] PHP Warning: Error: CCI, -5, Invalid cursor position in /home/php/phpTestcases/_02_prepare/bug/move_cursor_test.phpt on line 21 [003]Expect false [-5] [Invalid cursor position]
Commit rev: 489