mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
6b3478ec12
Change bool in C code to my_bool Added to mysqltest --enable_parsning and --disable_parsing to avoid to have to comment parts of tests Added comparison of LEX_STRING's and use this to compare file types for view and trigger files. client/client_priv.h: Added OPT_TRIGGERS (to get rid of compiler warning) client/mysql.cc: Added cast to get rid of compiler warning client/mysqldump.c: Added OPT_TRIGGERS (to get rid of compiler warning) Abort if we can't write to outfile (even if --ignore-errors is given) client/mysqltest.c: Added --enable_parsning and --disable_parsing to avoid to have to comment parts of tests include/my_sys.h: Make my_progname const include/my_time.h: Avoid using 'bool' in C programs mysql-test/lib/init_db.sql: Align with mysql_create_system_tables (Ideally this file should be auto-generated from the above script) mysql-test/r/mysqltest.result: Test for --enable_parsing mysql-test/r/variables.result: Update results after fix for overflow checking of max_heap_table_size mysql-test/t/information_schema.test: USe --enable/disable parsing instead of comments mysql-test/t/mysqltest.test: Test for --enable_parsing mysql-test/t/sp.test: USe --enable/disable parsing instead of comments mysql-test/t/variables.test: Portability fix for 64 bit systems mysql-test/t/view.test: USe --enable/disable parsing instead of comments mysys/my_init.c: May my_progname const mysys/my_static.c: May my_progname const mysys/thr_lock.c: Remove not needed casts sql-common/my_time.c: Change bool -> my_bool as bool is not portable in C programs sql/field.cc: Test number_to_datetime() for -1 instead of < 0 (Safety fix) New prototype for TIME_to_timestamp() sql/item.h: Don't have prototypes for both uint32 and ulong as these 'may' be the same thing sql/item_timefunc.cc: New prototype for TIME_to_timestamp() sql/log.cc: Remove compiler warnings sql/mysql_priv.h: New prototype for TIME_to_timestamp() Added function for comparing LEX_STRING sql/set_var.cc: Added overflow checking when setting ulong variable sql/sql_base.cc: Added function is_equal() Changed strncmp -> is_equal() as strncmp() to not match "V" (instead of "VIEW") sql/sql_class.cc: Added comment sql/sql_select.cc: Portability fixes After review fixes sql/sql_trigger.cc: Use 'tables_alias_charset' for comparing database name Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly) sql/sql_view.cc: Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly) sql/time.cc: New prototype for TIME_to_timestamp() to allow easyer mapping to C function sql/tztime.cc: bool -> my_bool (to allow calling C code from C++ code) sql/tztime.h: bool -> my_bool (to allow calling C code from C++ code)
337 lines
11 KiB
Text
337 lines
11 KiB
Text
|
|
# ============================================================================
|
|
#
|
|
# Test of mysqltest itself
|
|
#
|
|
# ============================================================================
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# $mysql_errno contains the return code of the last command
|
|
# send 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)
|
|
# ----------------------------------------------------------------------------
|
|
|
|
select otto from (select 1 as otto) as t1;
|
|
# expectation = response
|
|
--error 0
|
|
select otto from (select 1 as otto) as t1;
|
|
|
|
# expectation <> response
|
|
-- // --error 1054
|
|
-- // select otto from (select 1 as otto) as t1;
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Negative case(statement):
|
|
# The dervied table t1 does not contain a column named 'friedrich' .
|
|
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
|
|
# --> 1054: Unknown column 'friedrich' in 'field list'
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# expectation <> response
|
|
#--error 0
|
|
#select friedrich from (select 1 as otto) as t1;
|
|
|
|
# expectation = response
|
|
--error 1054
|
|
select friedrich from (select 1 as otto) as t1;
|
|
|
|
# The following unmasked unsuccessful statement must give
|
|
# 1. mysqltest gives a 'failed'
|
|
# 2. does not produce a r/<test case>.reject file !!!
|
|
# PLEASE uncomment it and check it's effect
|
|
#select friedrich from (select 1 as otto) as t1;
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Tests for the new feature - SQLSTATE error code matching
|
|
# Positive case(statement)
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# expectation = response
|
|
!S00000 select otto from (select 1 as otto) as t1;
|
|
|
|
--error S00000
|
|
select otto from (select 1 as otto) as t1;
|
|
|
|
# expectation <> response
|
|
#!S42S22 select otto from (select 1 as otto) as t1;
|
|
#--error S42S22
|
|
#select otto from (select 1 as otto) as t1;
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Negative case(statement)
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# expectation = response
|
|
!S42S22 select friedrich from (select 1 as otto) as t1;
|
|
--error S42S22
|
|
select friedrich from (select 1 as otto) as t1;
|
|
|
|
# expectation !=response
|
|
#!S00000 select friedrich from (select 1 as otto) as t1;
|
|
#--error S00000
|
|
#select friedrich from (select 1 as otto) as t1;
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# test cases for $mysql_errno
|
|
#
|
|
# $mysql_errno is a builtin variable of mysqltest and contains the return code
|
|
# of the last command send to the server.
|
|
#
|
|
# The following test cases often initialize $mysql_errno to 1064 by
|
|
# a command with wrong syntax.
|
|
# Example: --error 1064 To prevent the abort after the error.
|
|
# garbage ;
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check mysql_errno = 0 after successful statement
|
|
# ----------------------------------------------------------------------------
|
|
select otto from (select 1 as otto) as t1;
|
|
eval select $mysql_errno as "after_successful_stmt_errno" ;
|
|
|
|
#----------------------------------------------------------------------------
|
|
# check mysql_errno = 1064 after statement with wrong syntax
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
eval select $mysql_errno as "after_wrong_syntax_errno" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check if let $my_var= 'abc' ; affects $mysql_errno
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
let $my_var= 'abc' ;
|
|
eval select $mysql_errno as "after_let_var_equal_value" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check if set @my_var= 'abc' ; affects $mysql_errno
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
set @my_var= 'abc' ;
|
|
eval select $mysql_errno as "after_set_var_equal_value" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check if the setting of --disable-warnings itself affects $mysql_errno
|
|
# (May be --<whatever> modifies $mysql_errno.)
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
--disable_warnings
|
|
eval select $mysql_errno as "after_disable_warnings_command" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check if --disable-warnings + command with warning affects the errno
|
|
# stored within $mysql_errno
|
|
# (May be disabled warnings affect $mysql_errno.)
|
|
# ----------------------------------------------------------------------------
|
|
drop table if exists t1 ;
|
|
--error 1064
|
|
garbage ;
|
|
drop table if exists t1 ;
|
|
eval select $mysql_errno as "after_disable_warnings" ;
|
|
--enable_warnings
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check if masked errors affect $mysql_errno
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
--error 1146
|
|
select 3 from t1 ;
|
|
eval select $mysql_errno as "after_minus_masked" ;
|
|
--error 1064
|
|
garbage ;
|
|
--error 1146
|
|
select 3 from t1 ;
|
|
eval select $mysql_errno as "after_!_masked" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Will manipulations of $mysql_errno be possible and visible ?
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
let $mysql_errno= -1;
|
|
eval select $mysql_errno as "after_let_errno_equal_value" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# How affect actions on prepared statements $mysql_errno ?
|
|
# ----------------------------------------------------------------------------
|
|
# failing prepare
|
|
--error 1064
|
|
garbage ;
|
|
--error 1146
|
|
prepare stmt from "select 3 from t1" ;
|
|
eval select $mysql_errno as "after_failing_prepare" ;
|
|
create table t1 ( f1 char(10));
|
|
|
|
# successful prepare
|
|
--error 1064
|
|
garbage ;
|
|
prepare stmt from "select 3 from t1" ;
|
|
eval select $mysql_errno as "after_successful_prepare" ;
|
|
|
|
# successful execute
|
|
--error 1064
|
|
garbage ;
|
|
execute stmt;
|
|
eval select $mysql_errno as "after_successful_execute" ;
|
|
|
|
# failing execute (table dropped)
|
|
drop table t1;
|
|
--error 1064
|
|
garbage ;
|
|
--error 1146
|
|
execute stmt;
|
|
eval select $mysql_errno as "after_failing_execute" ;
|
|
|
|
# failing execute (unknown statement)
|
|
--error 1064
|
|
garbage ;
|
|
--error 1243
|
|
execute __stmt_;
|
|
eval select $mysql_errno as "after_failing_execute" ;
|
|
|
|
# successful deallocate
|
|
--error 1064
|
|
garbage ;
|
|
deallocate prepare stmt;
|
|
eval select $mysql_errno as "after_successful_deallocate" ;
|
|
|
|
# failing deallocate ( statement handle does not exist )
|
|
--error 1064
|
|
garbage ;
|
|
--error 1243
|
|
deallocate prepare __stmt_;
|
|
eval select $mysql_errno as "after_failing_deallocate" ;
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# test cases for "--disable_abort_on_error"
|
|
#
|
|
# "--disable_abort_on_error" switches the abort of mysqltest
|
|
# after "unmasked" failing statements off.
|
|
#
|
|
# The default is "--enable_abort_on_error".
|
|
#
|
|
# "Maskings" are
|
|
# --error <error number> and --error <error number>
|
|
# in the line before the failing statement.
|
|
#
|
|
# There are some additional test case for $mysql_errno
|
|
# because "--disable_abort_on_error" enables a new situation.
|
|
# Example: "unmasked" statement fails + analysis of $mysql_errno
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Switch the abort on error off and check the effect on $mysql_errno
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
--disable_abort_on_error
|
|
eval select $mysql_errno as "after_--disable_abort_on_error" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# "unmasked" failing statement should not cause an abort
|
|
# ----------------------------------------------------------------------------
|
|
select 3 from t1 ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# masked failing statements
|
|
# ----------------------------------------------------------------------------
|
|
# expected error = response
|
|
--error 1146
|
|
select 3 from t1 ;
|
|
--error 1146
|
|
select 3 from t1 ;
|
|
eval select $mysql_errno as "after_!errno_masked_error" ;
|
|
# expected error <> response
|
|
# --error 1000
|
|
# select 3 from t1 ;
|
|
# --error 1000
|
|
# select 3 from t1 ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Switch the abort on error on and check the effect on $mysql_errno
|
|
# ----------------------------------------------------------------------------
|
|
--error 1064
|
|
garbage ;
|
|
--enable_abort_on_error
|
|
eval select $mysql_errno as "after_--enable_abort_on_error" ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# masked failing statements
|
|
# ----------------------------------------------------------------------------
|
|
# expected error = response
|
|
--error 1146
|
|
select 3 from t1 ;
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# check that the old default behaviour is not changed
|
|
# Please remove the '#' to get the abort on error
|
|
# ----------------------------------------------------------------------------
|
|
#--error 1064
|
|
#select 3 from t1 ;
|
|
#
|
|
#select 3 from t1 ;
|
|
|
|
# End of 4.1 tests
|
|
|
|
#
|
|
# Bug #10251: Identifiers containing quotes not handled correctly
|
|
#
|
|
select 1 as `a'b`, 2 as `a"b`;
|
|
|
|
# Test escaping of quotes
|
|
select 'aaa\\','aa''a',"aa""a";
|
|
|
|
#
|
|
# Check of include/show_msg.inc and include/show_msg80.inc
|
|
#
|
|
|
|
# The message contains in most cases a string with the default character set
|
|
let $message= Here comes a message;
|
|
--source include/show_msg.inc
|
|
|
|
# The message could also contain a string with character set utf8
|
|
let $message= `SELECT USER()`;
|
|
--source include/show_msg.inc
|
|
|
|
# The message contains more then 80 characters on multiple lines
|
|
# and is kept between double quotes.
|
|
let $message=
|
|
"Here comes a very very long message that
|
|
- is longer then 80 characters and
|
|
- consists of several lines";
|
|
--source include/show_msg80.inc
|
|
|
|
# The message contains more then 80 characters on multiple lines
|
|
# and uses the auxiliary character "." at the beginning of the message lines.
|
|
let $message= . Here comes a very very long message that
|
|
. - is longer then 80 characters and
|
|
. - consists of several lines;
|
|
--source include/show_msg80.inc
|
|
|
|
#
|
|
# Test --enable_parsning / disable_parsning
|
|
#
|
|
--disable_query_log
|
|
--disable_parsing
|
|
# The following will not enable query logging
|
|
--enable_query_log
|
|
select "this will not be executed";
|
|
--enable_parsing
|
|
select "this will be executed";
|
|
--enable_query_log
|