Commit 34f75f9f authored by Bjorn Munch's avatar Bjorn Munch

Bug #12793170 MYSQLTEST: PROVIDE ACCESS TO ERROR NAMES THROUGH NUMERIC CODES AND VICE VERSA

  Added a second internal variable $mysql_errname
  This is set the same way as $mysql_errno
  Can be used like "if ($mysql_errname == ER_NO_SUCH_TABLE)...."
parent 3b05c2ab
...@@ -494,6 +494,7 @@ void str_to_file(const char *fname, char *str, int size); ...@@ -494,6 +494,7 @@ void str_to_file(const char *fname, char *str, int size);
void str_to_file2(const char *fname, char *str, int size, my_bool append); void str_to_file2(const char *fname, char *str, int size, my_bool append);
void fix_win_paths(const char *val, int len); void fix_win_paths(const char *val, int len);
const char *get_errname_from_code (uint error_code);
#ifdef __WIN__ #ifdef __WIN__
void free_tmp_sh_file(); void free_tmp_sh_file();
...@@ -2263,6 +2264,7 @@ void var_set_int(const char* name, int value) ...@@ -2263,6 +2264,7 @@ void var_set_int(const char* name, int value)
void var_set_errno(int sql_errno) void var_set_errno(int sql_errno)
{ {
var_set_int("$mysql_errno", sql_errno); var_set_int("$mysql_errno", sql_errno);
var_set_string("$mysql_errname", get_errname_from_code(sql_errno));
} }
...@@ -4670,8 +4672,7 @@ void do_shutdown_server(struct st_command *command) ...@@ -4670,8 +4672,7 @@ void do_shutdown_server(struct st_command *command)
} }
#if MYSQL_VERSION_ID >= 50000 /* List of error names to error codes */
/* List of error names to error codes, available from 5.0 */
typedef struct typedef struct
{ {
const char *name; const char *name;
...@@ -4681,6 +4682,7 @@ typedef struct ...@@ -4681,6 +4682,7 @@ typedef struct
static st_error global_error_names[] = static st_error global_error_names[] =
{ {
{ "<No error>", -1, "" },
#include <mysqld_ername.h> #include <mysqld_ername.h>
{ 0, 0, 0 } { 0, 0, 0 }
}; };
...@@ -4711,16 +4713,28 @@ uint get_errcode_from_name(char *error_name, char *error_end) ...@@ -4711,16 +4713,28 @@ uint get_errcode_from_name(char *error_name, char *error_end)
die("Unknown SQL error name '%s'", error_name); die("Unknown SQL error name '%s'", error_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#else
uint get_errcode_from_name(char *error_name __attribute__((unused)), const char *get_errname_from_code (uint error_code)
char *error_end __attribute__((unused)))
{ {
abort_not_in_this_version(); st_error *e= global_error_names;
return 0; /* Never reached */
}
#endif
DBUG_ENTER("get_errname_from_code");
DBUG_PRINT("enter", ("error_code: %d", error_code));
if (! error_code)
{
DBUG_RETURN("");
}
for (; e->name; e++)
{
if (e->code == error_code)
{
DBUG_RETURN(e->name);
}
}
die("Unknown SQL error code '%d'", error_code);
}
void do_get_errcodes(struct st_command *command) void do_get_errcodes(struct st_command *command)
{ {
......
...@@ -7,6 +7,6 @@ PRIMARY KEY (`ID_MEMBER`,`ID_BOARD`), ...@@ -7,6 +7,6 @@ PRIMARY KEY (`ID_MEMBER`,`ID_BOARD`),
KEY `logTime` (`logTime`) KEY `logTime` (`logTime`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_bulgarian_ci; ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_bulgarian_ci;
INSERT INTO `t_bug21476` VALUES (2,2,1154870939,0),(1,2,1154870957,0),(2,183,1154941362,0),(2,84,1154904301,0),(1,84,1154905867,0),(2,13,1154947484,10271),(3,84,1154880549,0),(1,6,1154892183,0),(2,25,1154947581,10271),(3,25,1154904760,0),(1,25,1154947373,10271),(1,179,1154899992,0),(2,179,1154899410,0),(5,25,1154901666,0),(2,329,1154902026,0),(3,329,1154902040,0),(1,329,1154902058,0),(1,13,1154930841,0),(3,85,1154904987,0),(1,183,1154929665,0),(3,13,1154931268,0),(1,85,1154936888,0),(1,169,1154937959,0),(2,169,1154941717,0),(3,183,1154939810,0),(3,169,1154941734,0); INSERT INTO `t_bug21476` VALUES (2,2,1154870939,0),(1,2,1154870957,0),(2,183,1154941362,0),(2,84,1154904301,0),(1,84,1154905867,0),(2,13,1154947484,10271),(3,84,1154880549,0),(1,6,1154892183,0),(2,25,1154947581,10271),(3,25,1154904760,0),(1,25,1154947373,10271),(1,179,1154899992,0),(2,179,1154899410,0),(5,25,1154901666,0),(2,329,1154902026,0),(3,329,1154902040,0),(1,329,1154902058,0),(1,13,1154930841,0),(3,85,1154904987,0),(1,183,1154929665,0),(3,13,1154931268,0),(1,85,1154936888,0),(1,169,1154937959,0),(2,169,1154941717,0),(3,183,1154939810,0),(3,169,1154941734,0);
Assertion: mysql_errno 1436 == 1436 Assertion: mysql_errname ER_STACK_OVERRUN_NEED_MORE == ER_STACK_OVERRUN_NEED_MORE
DROP TABLE `t_bug21476`; DROP TABLE `t_bug21476`;
End of 5.0 tests. End of 5.0 tests.
select 0 as "before_use_test" ; -1 before test
before_use_test <No error> before test
0
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
otto otto
1 1
...@@ -21,27 +20,32 @@ mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' fai ...@@ -21,27 +20,32 @@ mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' fai
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
otto otto
1 1
select 0 as "after_successful_stmt_errno" ; select 0 as "after_successful_stmt_errno" ;
after_successful_stmt_errno after_successful_stmt_errno
0 0
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
ER_PARSE_ERROR
select 1064 as "after_wrong_syntax_errno" ; select 1064 as "after_wrong_syntax_errno" ;
after_wrong_syntax_errno after_wrong_syntax_errno
1064 1064
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
ER_PARSE_ERROR
select 1064 as "after_let_var_equal_value" ; select 1064 as "after_let_var_equal_value" ;
after_let_var_equal_value after_let_var_equal_value
1064 1064
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
set @my_var= 'abc' ; set @my_var= 'abc' ;
select 0 as "after_set_var_equal_value" ; select 0 as "after_set_var_equal_value" ;
after_set_var_equal_value after_set_var_equal_value
0 0
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
ER_PARSE_ERROR
select 1064 as "after_disable_warnings_command" ; select 1064 as "after_disable_warnings_command" ;
after_disable_warnings_command after_disable_warnings_command
1064 1064
...@@ -49,6 +53,7 @@ drop table if exists t1 ; ...@@ -49,6 +53,7 @@ drop table if exists t1 ;
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
drop table if exists t1 ; drop table if exists t1 ;
select 0 as "after_disable_warnings" ; select 0 as "after_disable_warnings" ;
after_disable_warnings after_disable_warnings
0 0
...@@ -56,6 +61,7 @@ garbage ; ...@@ -56,6 +61,7 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
select 3 from t1 ; select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
ER_NO_SUCH_TABLE
select 1146 as "after_minus_masked" ; select 1146 as "after_minus_masked" ;
after_minus_masked after_minus_masked
1146 1146
...@@ -63,6 +69,7 @@ garbage ; ...@@ -63,6 +69,7 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
select 3 from t1 ; select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
ER_NO_SUCH_TABLE
select 1146 as "after_!_masked" ; select 1146 as "after_!_masked" ;
after_!_masked after_!_masked
1146 1146
...@@ -75,6 +82,7 @@ garbage ; ...@@ -75,6 +82,7 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
prepare stmt from "select 3 from t1" ; prepare stmt from "select 3 from t1" ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
ER_NO_SUCH_TABLE
select 1146 as "after_failing_prepare" ; select 1146 as "after_failing_prepare" ;
after_failing_prepare after_failing_prepare
1146 1146
...@@ -82,6 +90,7 @@ create table t1 ( f1 char(10)); ...@@ -82,6 +90,7 @@ create table t1 ( f1 char(10));
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
prepare stmt from "select 3 from t1" ; prepare stmt from "select 3 from t1" ;
select 0 as "after_successful_prepare" ; select 0 as "after_successful_prepare" ;
after_successful_prepare after_successful_prepare
0 0
...@@ -89,6 +98,7 @@ garbage ; ...@@ -89,6 +98,7 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
execute stmt; execute stmt;
3 3
select 0 as "after_successful_execute" ; select 0 as "after_successful_execute" ;
after_successful_execute after_successful_execute
0 0
...@@ -97,6 +107,7 @@ garbage ; ...@@ -97,6 +107,7 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
execute stmt; execute stmt;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
ER_NO_SUCH_TABLE
select 1146 as "after_failing_execute" ; select 1146 as "after_failing_execute" ;
after_failing_execute after_failing_execute
1146 1146
...@@ -104,12 +115,14 @@ garbage ; ...@@ -104,12 +115,14 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
execute __stmt_; execute __stmt_;
ERROR HY000: Unknown prepared statement handler (__stmt_) given to EXECUTE ERROR HY000: Unknown prepared statement handler (__stmt_) given to EXECUTE
ER_UNKNOWN_STMT_HANDLER
select 1243 as "after_failing_execute" ; select 1243 as "after_failing_execute" ;
after_failing_execute after_failing_execute
1243 1243
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
deallocate prepare stmt; deallocate prepare stmt;
select 0 as "after_successful_deallocate" ; select 0 as "after_successful_deallocate" ;
after_successful_deallocate after_successful_deallocate
0 0
...@@ -117,11 +130,13 @@ garbage ; ...@@ -117,11 +130,13 @@ garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
deallocate prepare __stmt_; deallocate prepare __stmt_;
ERROR HY000: Unknown prepared statement handler (__stmt_) given to DEALLOCATE PREPARE ERROR HY000: Unknown prepared statement handler (__stmt_) given to DEALLOCATE PREPARE
ER_UNKNOWN_STMT_HANDLER
select 1243 as "after_failing_deallocate" ; select 1243 as "after_failing_deallocate" ;
after_failing_deallocate after_failing_deallocate
1243 1243
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
ER_PARSE_ERROR
select 1064 as "after_--disable_abort_on_error" ; select 1064 as "after_--disable_abort_on_error" ;
after_--disable_abort_on_error after_--disable_abort_on_error
1064 1064
...@@ -131,12 +146,14 @@ select 3 from t1 ; ...@@ -131,12 +146,14 @@ select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
select 3 from t1 ; select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
ER_NO_SUCH_TABLE
select 1146 as "after_!errno_masked_error" ; select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error after_!errno_masked_error
1146 1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
ER_PARSE_ERROR
select 1064 as "after_--enable_abort_on_error" ; select 1064 as "after_--enable_abort_on_error" ;
after_--enable_abort_on_error after_--enable_abort_on_error
1064 1064
......
...@@ -38,7 +38,7 @@ while ($i) ...@@ -38,7 +38,7 @@ while ($i)
{ {
# If we SEGV because the min stack size is exceeded, this would return error # If we SEGV because the min stack size is exceeded, this would return error
# 2013 . # 2013 .
error 0,1436 // error 0,ER_STACK_OVERRUN_NEED_MORE //
eval $query_head 0 $query_tail// eval $query_head 0 $query_tail//
if ($mysql_errno) if ($mysql_errno)
...@@ -48,10 +48,10 @@ while ($i) ...@@ -48,10 +48,10 @@ while ($i)
# limit, we still have enough space reserved to report an error. # limit, we still have enough space reserved to report an error.
let $i = 1// let $i = 1//
# Check that mysql_errno is 1436 # Check that mysql_errname is ER_STACK_OVERRUN_NEED_MORE
if ($mysql_errno != 1436) if ($mysql_errname != ER_STACK_OVERRUN_NEED_MORE)
{ {
die Wrong error triggered, expected 1436 but got $mysql_errno// die Wrong error triggered, expected ER_STACK_OVERRUN_NEED_MORE but got $mysql_errname//
} }
} }
...@@ -76,7 +76,7 @@ while ($i) ...@@ -76,7 +76,7 @@ while ($i)
enable_result_log// enable_result_log//
enable_query_log// enable_query_log//
echo Assertion: mysql_errno 1436 == $mysql_errno// echo Assertion: mysql_errname ER_STACK_OVERRUN_NEED_MORE == $mysql_errname//
delimiter ;// delimiter ;//
DROP TABLE `t_bug21476`; DROP TABLE `t_bug21476`;
......
# ----------------------------------------------------------------------------
# $mysql_errno contains the return code of the last command
# sent to the server.
# ----------------------------------------------------------------------------
# get $mysql_errno before the first statement
# $mysql_errno should be -1
# get $mysql_errname as well
echo $mysql_errno before test;
echo $mysql_errname before test;
-- source include/have_log_bin.inc -- source include/have_log_bin.inc
# This test should work in embedded server after mysqltest is fixed # This test should work in embedded server after mysqltest is fixed
...@@ -33,15 +44,6 @@ ...@@ -33,15 +44,6 @@
# #
# ============================================================================ # ============================================================================
# ----------------------------------------------------------------------------
# $mysql_errno contains the return code of the last command
# sent to the server.
# ----------------------------------------------------------------------------
# get $mysql_errno before the first statement
# $mysql_errno should be -1
eval select $mysql_errno as "before_use_test" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Positive case(statement) # Positive case(statement)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -134,6 +136,7 @@ select friedrich from (select 1 as otto) as t1; ...@@ -134,6 +136,7 @@ select friedrich from (select 1 as otto) as t1;
# check mysql_errno = 0 after successful statement # check mysql_errno = 0 after successful statement
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
echo $mysql_errname;
eval select $mysql_errno as "after_successful_stmt_errno" ; eval select $mysql_errno as "after_successful_stmt_errno" ;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
...@@ -142,6 +145,7 @@ eval select $mysql_errno as "after_successful_stmt_errno" ; ...@@ -142,6 +145,7 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
garbage ; garbage ;
echo $mysql_errname;
eval select $mysql_errno as "after_wrong_syntax_errno" ; eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -151,6 +155,7 @@ eval select $mysql_errno as "after_wrong_syntax_errno" ; ...@@ -151,6 +155,7 @@ eval select $mysql_errno as "after_wrong_syntax_errno" ;
garbage ; garbage ;
let $my_var= 'abc' ; let $my_var= 'abc' ;
echo $mysql_errname;
eval select $mysql_errno as "after_let_var_equal_value" ; eval select $mysql_errno as "after_let_var_equal_value" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -160,6 +165,7 @@ eval select $mysql_errno as "after_let_var_equal_value" ; ...@@ -160,6 +165,7 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
garbage ; garbage ;
set @my_var= 'abc' ; set @my_var= 'abc' ;
echo $mysql_errname;
eval select $mysql_errno as "after_set_var_equal_value" ; eval select $mysql_errno as "after_set_var_equal_value" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -170,6 +176,7 @@ eval select $mysql_errno as "after_set_var_equal_value" ; ...@@ -170,6 +176,7 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
garbage ; garbage ;
--disable_warnings --disable_warnings
echo $mysql_errname;
eval select $mysql_errno as "after_disable_warnings_command" ; eval select $mysql_errno as "after_disable_warnings_command" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -182,6 +189,7 @@ drop table if exists t1 ; ...@@ -182,6 +189,7 @@ drop table if exists t1 ;
garbage ; garbage ;
drop table if exists t1 ; drop table if exists t1 ;
echo $mysql_errname;
eval select $mysql_errno as "after_disable_warnings" ; eval select $mysql_errno as "after_disable_warnings" ;
--enable_warnings --enable_warnings
...@@ -194,6 +202,7 @@ garbage ; ...@@ -194,6 +202,7 @@ garbage ;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
select 3 from t1 ; select 3 from t1 ;
echo $mysql_errname;
eval select $mysql_errno as "after_minus_masked" ; eval select $mysql_errno as "after_minus_masked" ;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
...@@ -201,6 +210,7 @@ garbage ; ...@@ -201,6 +210,7 @@ garbage ;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
select 3 from t1 ; select 3 from t1 ;
echo $mysql_errname;
eval select $mysql_errno as "after_!_masked" ; eval select $mysql_errno as "after_!_masked" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -222,6 +232,7 @@ garbage ; ...@@ -222,6 +232,7 @@ garbage ;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
prepare stmt from "select 3 from t1" ; prepare stmt from "select 3 from t1" ;
echo $mysql_errname;
eval select $mysql_errno as "after_failing_prepare" ; eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10)); create table t1 ( f1 char(10));
...@@ -230,6 +241,7 @@ create table t1 ( f1 char(10)); ...@@ -230,6 +241,7 @@ create table t1 ( f1 char(10));
garbage ; garbage ;
prepare stmt from "select 3 from t1" ; prepare stmt from "select 3 from t1" ;
echo $mysql_errname;
eval select $mysql_errno as "after_successful_prepare" ; eval select $mysql_errno as "after_successful_prepare" ;
# successful execute # successful execute
...@@ -237,6 +249,7 @@ eval select $mysql_errno as "after_successful_prepare" ; ...@@ -237,6 +249,7 @@ eval select $mysql_errno as "after_successful_prepare" ;
garbage ; garbage ;
execute stmt; execute stmt;
echo $mysql_errname;
eval select $mysql_errno as "after_successful_execute" ; eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped) # failing execute (table has been dropped)
...@@ -247,6 +260,7 @@ garbage ; ...@@ -247,6 +260,7 @@ garbage ;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
execute stmt; execute stmt;
echo $mysql_errname;
eval select $mysql_errno as "after_failing_execute" ; eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement) # failing execute (unknown statement)
...@@ -256,6 +270,7 @@ garbage ; ...@@ -256,6 +270,7 @@ garbage ;
--error ER_UNKNOWN_STMT_HANDLER --error ER_UNKNOWN_STMT_HANDLER
execute __stmt_; execute __stmt_;
echo $mysql_errname;
eval select $mysql_errno as "after_failing_execute" ; eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate # successful deallocate
...@@ -263,6 +278,7 @@ eval select $mysql_errno as "after_failing_execute" ; ...@@ -263,6 +278,7 @@ eval select $mysql_errno as "after_failing_execute" ;
garbage ; garbage ;
deallocate prepare stmt; deallocate prepare stmt;
echo $mysql_errname;
eval select $mysql_errno as "after_successful_deallocate" ; eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist ) # failing deallocate ( statement handle does not exist )
...@@ -272,6 +288,7 @@ garbage ; ...@@ -272,6 +288,7 @@ garbage ;
--error ER_UNKNOWN_STMT_HANDLER --error ER_UNKNOWN_STMT_HANDLER
deallocate prepare __stmt_; deallocate prepare __stmt_;
echo $mysql_errname;
eval select $mysql_errno as "after_failing_deallocate" ; eval select $mysql_errno as "after_failing_deallocate" ;
...@@ -299,6 +316,7 @@ eval select $mysql_errno as "after_failing_deallocate" ; ...@@ -299,6 +316,7 @@ eval select $mysql_errno as "after_failing_deallocate" ;
garbage ; garbage ;
--disable_abort_on_error --disable_abort_on_error
echo $mysql_errname;
eval select $mysql_errno as "after_--disable_abort_on_error" ; eval select $mysql_errno as "after_--disable_abort_on_error" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -316,6 +334,7 @@ select 3 from t1 ; ...@@ -316,6 +334,7 @@ select 3 from t1 ;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
select 3 from t1 ; select 3 from t1 ;
echo $mysql_errname;
eval select $mysql_errno as "after_!errno_masked_error" ; eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response # expected error <> response
# --error 1000 # --error 1000
...@@ -341,6 +360,7 @@ EOF ...@@ -341,6 +360,7 @@ EOF
garbage ; garbage ;
--enable_abort_on_error --enable_abort_on_error
echo $mysql_errname;
eval select $mysql_errno as "after_--enable_abort_on_error" ; eval select $mysql_errno as "after_--enable_abort_on_error" ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment