mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixes during review of new pushed code
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)
This commit is contained in:
@ -42,7 +42,7 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#define MTEST_VERSION "2.4"
|
||||
#define MTEST_VERSION "2.5"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql_embed.h>
|
||||
@ -151,6 +151,7 @@ const char* user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
|
||||
static int port = 0;
|
||||
static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0;
|
||||
static my_bool tty_password= 0, ps_protocol= 0, ps_protocol_enabled= 0;
|
||||
static int parsing_disabled= 0;
|
||||
static uint start_lineno, *lineno;
|
||||
const char* manager_user="root",*manager_host=0;
|
||||
char *manager_pass=0;
|
||||
@ -308,6 +309,7 @@ Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
|
||||
Q_EXIT,
|
||||
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
|
||||
Q_IF,
|
||||
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
|
||||
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
@ -399,6 +401,8 @@ const char *command_names[]=
|
||||
"disable_reconnect",
|
||||
"enable_reconnect",
|
||||
"if",
|
||||
"disable_parsing",
|
||||
"enable_parsing",
|
||||
0
|
||||
};
|
||||
|
||||
@ -2141,7 +2145,7 @@ int read_line(char* buf, int size)
|
||||
}
|
||||
break;
|
||||
case R_LINE_START:
|
||||
if (c == '#' || c == '-')
|
||||
if (c == '#' || c == '-' || parsing_disabled)
|
||||
{
|
||||
state = R_COMMENT;
|
||||
}
|
||||
@ -2268,18 +2272,22 @@ int read_query(struct st_query** q_ptr)
|
||||
/* This goto is to avoid losing the "expected error" info. */
|
||||
goto end;
|
||||
}
|
||||
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
|
||||
sizeof(global_expected_errno));
|
||||
q->expected_errors= global_expected_errors;
|
||||
q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
|
||||
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
|
||||
global_expected_errors=0;
|
||||
if (!parsing_disabled)
|
||||
{
|
||||
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
|
||||
sizeof(global_expected_errno));
|
||||
q->expected_errors= global_expected_errors;
|
||||
q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
|
||||
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
|
||||
global_expected_errors=0;
|
||||
}
|
||||
|
||||
if (p[0] == '-' && p[1] == '-')
|
||||
{
|
||||
q->type= Q_COMMENT_WITH_COMMAND;
|
||||
p+= 2; /* To calculate first word */
|
||||
}
|
||||
else
|
||||
else if (!parsing_disabled)
|
||||
{
|
||||
if (*p == '!')
|
||||
{
|
||||
@ -3586,20 +3594,29 @@ void get_query_type(struct st_query* q)
|
||||
uint type;
|
||||
DBUG_ENTER("get_query_type");
|
||||
|
||||
if (*q->query == '}')
|
||||
if (!parsing_disabled && *q->query == '}')
|
||||
{
|
||||
q->type = Q_END_BLOCK;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (q->type != Q_COMMENT_WITH_COMMAND)
|
||||
q->type = Q_QUERY;
|
||||
q->type= parsing_disabled ? Q_COMMENT : Q_QUERY;
|
||||
|
||||
save=q->query[q->first_word_len];
|
||||
q->query[q->first_word_len]=0;
|
||||
type=find_type(q->query, &command_typelib, 1+2);
|
||||
q->query[q->first_word_len]=save;
|
||||
if (type > 0)
|
||||
{
|
||||
q->type=(enum enum_commands) type; /* Found command */
|
||||
/*
|
||||
If queries are disabled, only recognize
|
||||
--enable-queries and --disable-queries
|
||||
*/
|
||||
if (parsing_disabled && q->type != Q_ENABLE_PARSING &&
|
||||
q->type != Q_DISABLE_PARSING)
|
||||
q->type= Q_COMMENT;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -3963,6 +3980,17 @@ int main(int argc, char **argv)
|
||||
case Q_ENABLE_RECONNECT:
|
||||
cur_con->mysql.reconnect= 1;
|
||||
break;
|
||||
case Q_DISABLE_PARSING:
|
||||
parsing_disabled++;
|
||||
break;
|
||||
case Q_ENABLE_PARSING:
|
||||
/*
|
||||
Ensure we don't get parsing_disabled < 0 as this would accidently
|
||||
disable code we don't want to have disabled
|
||||
*/
|
||||
if (parsing_disabled > 0)
|
||||
parsing_disabled--;
|
||||
break;
|
||||
|
||||
case Q_EXIT:
|
||||
abort_flag= 1;
|
||||
|
Reference in New Issue
Block a user