Loading extra/my_print_defaults.c +12 −1 Original line number Diff line number Diff line Loading @@ -27,12 +27,20 @@ const char *config_file="my"; /* Default config file */ uint verbose= 0, opt_defaults_file_used= 0; const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace"; static struct my_option my_long_options[] = { {"config-file", 'c', "The config file to be used.", (gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"debug", '#', "Output debug log", (gptr*) &default_dbug_option, (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"defaults-file", 'c', "Synonym for --config-file.", (gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -95,6 +103,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'V': usage(1); exit(0); case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; } return 0; } Loading @@ -118,7 +129,7 @@ static int get_options(int *argc,char ***argv) int main(int argc, char **argv) { int count, error; char **load_default_groups, *tmp_arguments[2], char **load_default_groups, *tmp_arguments[3], **argument, **arguments; char *defaults, *extra_defaults; MY_INIT(argv[0]); Loading libmysqld/emb_qcache.cc +18 −18 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ void Querycache_stream::store_char(char c) { if (data_end == cur_data) use_next_block(); use_next_block(TRUE); *(cur_data++)= c; #ifndef DBUG_OFF stored_size++; Loading @@ -42,13 +42,13 @@ void Querycache_stream::store_short(ushort s) } if (data_end == cur_data) { use_next_block(); use_next_block(TRUE); int2store(cur_data, s); cur_data+= 2; return; } *cur_data= ((byte *)(&s))[0]; use_next_block(); use_next_block(TRUE); *(cur_data++)= ((byte *)(&s))[1]; } Loading @@ -66,7 +66,7 @@ void Querycache_stream::store_int(uint i) } if (!rest_len) { use_next_block(); use_next_block(TRUE); int4store(cur_data, i); cur_data+= 4; return; Loading @@ -74,7 +74,7 @@ void Querycache_stream::store_int(uint i) char buf[4]; int4store(buf, i); memcpy(cur_data, buf, rest_len); use_next_block(); use_next_block(TRUE); memcpy(cur_data, buf+rest_len, 4-rest_len); cur_data+= 4-rest_len; } Loading @@ -93,13 +93,13 @@ void Querycache_stream::store_ll(ulonglong ll) } if (!rest_len) { use_next_block(); use_next_block(TRUE); int8store(cur_data, ll); cur_data+= 8; return; } memcpy(cur_data, &ll, rest_len); use_next_block(); use_next_block(TRUE); memcpy(cur_data, ((byte*)&ll)+rest_len, 8-rest_len); cur_data+= 8-rest_len; } Loading @@ -112,14 +112,14 @@ void Querycache_stream::store_str_only(const char *str, uint str_len) do { size_t rest_len= data_end - cur_data; if (rest_len > str_len) if (rest_len >= str_len) { memcpy(cur_data, str, str_len); cur_data+= str_len; return; } memcpy(cur_data, str, rest_len); use_next_block(); use_next_block(TRUE); str_len-= rest_len; str+= rest_len; } while(str_len); Loading @@ -145,7 +145,7 @@ void Querycache_stream::store_safe_str(const char *str, uint str_len) char Querycache_stream::load_char() { if (cur_data == data_end) use_next_block(); use_next_block(FALSE); return *(cur_data++); } Loading @@ -160,13 +160,13 @@ ushort Querycache_stream::load_short() } if (data_end == cur_data) { use_next_block(); use_next_block(FALSE); result= uint2korr(cur_data); cur_data+= 2; return result; } ((byte*)&result)[0]= *cur_data; use_next_block(); use_next_block(FALSE); ((byte*)&result)[1]= *(cur_data++); return result; } Loading @@ -183,14 +183,14 @@ uint Querycache_stream::load_int() } if (!rest_len) { use_next_block(); use_next_block(FALSE); result= uint4korr(cur_data); cur_data+= 4; return result; } char buf[4]; memcpy(buf, cur_data, rest_len); use_next_block(); use_next_block(FALSE); memcpy(buf+rest_len, cur_data, 4-rest_len); cur_data+= 4-rest_len; result= uint4korr(buf); Loading @@ -209,13 +209,13 @@ ulonglong Querycache_stream::load_ll() } if (!rest_len) { use_next_block(); use_next_block(FALSE); result= uint8korr(cur_data); cur_data+= 8; return result; } memcpy(&result, cur_data, rest_len); use_next_block(); use_next_block(FALSE); memcpy(((byte*)&result)+rest_len, cur_data, 8-rest_len); cur_data+= 8-rest_len; return result; Loading @@ -226,7 +226,7 @@ void Querycache_stream::load_str_only(char *buffer, uint str_len) do { size_t rest_len= data_end - cur_data; if (rest_len > str_len) if (rest_len >= str_len) { memcpy(buffer, cur_data, str_len); cur_data+= str_len; Loading @@ -234,7 +234,7 @@ void Querycache_stream::load_str_only(char *buffer, uint str_len) break; } memcpy(buffer, cur_data, rest_len); use_next_block(); use_next_block(FALSE); str_len-= rest_len; buffer+= rest_len; } while(str_len); Loading libmysqld/emb_qcache.h +24 −3 Original line number Diff line number Diff line Loading @@ -22,18 +22,39 @@ class Querycache_stream uint headers_len; public: #ifndef DBUG_OFF Query_cache_block *first_block; uint stored_size; #endif Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) : block(ini_block), headers_len(ini_headers_len) { use_next_block(); cur_data= ((byte*)block)+headers_len; data_end= cur_data + (block->used-headers_len); #ifndef DBUG_OFF first_block= ini_block; stored_size= 0; #endif } void use_next_block() void use_next_block(bool writing) { /* This shouldn't be called if there is only one block, or to loop around to the first block again. That means we're trying to write more data than we allocated space for. */ DBUG_ASSERT(block->next != block); DBUG_ASSERT(block->next != first_block); block= block->next; /* While writing, update the type of each block as we write to it. While reading, make sure that the block is of the expected type. */ if (writing) block->type= Query_cache_block::RES_CONT; else DBUG_ASSERT(block->type == Query_cache_block::RES_CONT); cur_data= ((byte*)block)+headers_len; data_end= cur_data + (block->used-headers_len); } Loading mysql-test/mysql-test-run.sh +6 −0 Original line number Diff line number Diff line Loading @@ -685,6 +685,12 @@ then fi MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT" # Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server # -A marks each argument for passing to the function which initializes the # embedded library if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR" fi MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT" MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose" Loading mysql-test/r/lowercase_table.result +3 −0 Original line number Diff line number Diff line Loading @@ -78,5 +78,8 @@ ERROR 42000: Not unique table/alias: 'C' select C.a, c.a from t1 c, t2 C; ERROR 42000: Not unique table/alias: 'C' drop table t1, t2; create table t1 (a int); create table t2 like T1; drop table t1, t2; show tables; Tables_in_test Loading
extra/my_print_defaults.c +12 −1 Original line number Diff line number Diff line Loading @@ -27,12 +27,20 @@ const char *config_file="my"; /* Default config file */ uint verbose= 0, opt_defaults_file_used= 0; const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace"; static struct my_option my_long_options[] = { {"config-file", 'c', "The config file to be used.", (gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"debug", '#', "Output debug log", (gptr*) &default_dbug_option, (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"defaults-file", 'c', "Synonym for --config-file.", (gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -95,6 +103,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'V': usage(1); exit(0); case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; } return 0; } Loading @@ -118,7 +129,7 @@ static int get_options(int *argc,char ***argv) int main(int argc, char **argv) { int count, error; char **load_default_groups, *tmp_arguments[2], char **load_default_groups, *tmp_arguments[3], **argument, **arguments; char *defaults, *extra_defaults; MY_INIT(argv[0]); Loading
libmysqld/emb_qcache.cc +18 −18 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ void Querycache_stream::store_char(char c) { if (data_end == cur_data) use_next_block(); use_next_block(TRUE); *(cur_data++)= c; #ifndef DBUG_OFF stored_size++; Loading @@ -42,13 +42,13 @@ void Querycache_stream::store_short(ushort s) } if (data_end == cur_data) { use_next_block(); use_next_block(TRUE); int2store(cur_data, s); cur_data+= 2; return; } *cur_data= ((byte *)(&s))[0]; use_next_block(); use_next_block(TRUE); *(cur_data++)= ((byte *)(&s))[1]; } Loading @@ -66,7 +66,7 @@ void Querycache_stream::store_int(uint i) } if (!rest_len) { use_next_block(); use_next_block(TRUE); int4store(cur_data, i); cur_data+= 4; return; Loading @@ -74,7 +74,7 @@ void Querycache_stream::store_int(uint i) char buf[4]; int4store(buf, i); memcpy(cur_data, buf, rest_len); use_next_block(); use_next_block(TRUE); memcpy(cur_data, buf+rest_len, 4-rest_len); cur_data+= 4-rest_len; } Loading @@ -93,13 +93,13 @@ void Querycache_stream::store_ll(ulonglong ll) } if (!rest_len) { use_next_block(); use_next_block(TRUE); int8store(cur_data, ll); cur_data+= 8; return; } memcpy(cur_data, &ll, rest_len); use_next_block(); use_next_block(TRUE); memcpy(cur_data, ((byte*)&ll)+rest_len, 8-rest_len); cur_data+= 8-rest_len; } Loading @@ -112,14 +112,14 @@ void Querycache_stream::store_str_only(const char *str, uint str_len) do { size_t rest_len= data_end - cur_data; if (rest_len > str_len) if (rest_len >= str_len) { memcpy(cur_data, str, str_len); cur_data+= str_len; return; } memcpy(cur_data, str, rest_len); use_next_block(); use_next_block(TRUE); str_len-= rest_len; str+= rest_len; } while(str_len); Loading @@ -145,7 +145,7 @@ void Querycache_stream::store_safe_str(const char *str, uint str_len) char Querycache_stream::load_char() { if (cur_data == data_end) use_next_block(); use_next_block(FALSE); return *(cur_data++); } Loading @@ -160,13 +160,13 @@ ushort Querycache_stream::load_short() } if (data_end == cur_data) { use_next_block(); use_next_block(FALSE); result= uint2korr(cur_data); cur_data+= 2; return result; } ((byte*)&result)[0]= *cur_data; use_next_block(); use_next_block(FALSE); ((byte*)&result)[1]= *(cur_data++); return result; } Loading @@ -183,14 +183,14 @@ uint Querycache_stream::load_int() } if (!rest_len) { use_next_block(); use_next_block(FALSE); result= uint4korr(cur_data); cur_data+= 4; return result; } char buf[4]; memcpy(buf, cur_data, rest_len); use_next_block(); use_next_block(FALSE); memcpy(buf+rest_len, cur_data, 4-rest_len); cur_data+= 4-rest_len; result= uint4korr(buf); Loading @@ -209,13 +209,13 @@ ulonglong Querycache_stream::load_ll() } if (!rest_len) { use_next_block(); use_next_block(FALSE); result= uint8korr(cur_data); cur_data+= 8; return result; } memcpy(&result, cur_data, rest_len); use_next_block(); use_next_block(FALSE); memcpy(((byte*)&result)+rest_len, cur_data, 8-rest_len); cur_data+= 8-rest_len; return result; Loading @@ -226,7 +226,7 @@ void Querycache_stream::load_str_only(char *buffer, uint str_len) do { size_t rest_len= data_end - cur_data; if (rest_len > str_len) if (rest_len >= str_len) { memcpy(buffer, cur_data, str_len); cur_data+= str_len; Loading @@ -234,7 +234,7 @@ void Querycache_stream::load_str_only(char *buffer, uint str_len) break; } memcpy(buffer, cur_data, rest_len); use_next_block(); use_next_block(FALSE); str_len-= rest_len; buffer+= rest_len; } while(str_len); Loading
libmysqld/emb_qcache.h +24 −3 Original line number Diff line number Diff line Loading @@ -22,18 +22,39 @@ class Querycache_stream uint headers_len; public: #ifndef DBUG_OFF Query_cache_block *first_block; uint stored_size; #endif Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) : block(ini_block), headers_len(ini_headers_len) { use_next_block(); cur_data= ((byte*)block)+headers_len; data_end= cur_data + (block->used-headers_len); #ifndef DBUG_OFF first_block= ini_block; stored_size= 0; #endif } void use_next_block() void use_next_block(bool writing) { /* This shouldn't be called if there is only one block, or to loop around to the first block again. That means we're trying to write more data than we allocated space for. */ DBUG_ASSERT(block->next != block); DBUG_ASSERT(block->next != first_block); block= block->next; /* While writing, update the type of each block as we write to it. While reading, make sure that the block is of the expected type. */ if (writing) block->type= Query_cache_block::RES_CONT; else DBUG_ASSERT(block->type == Query_cache_block::RES_CONT); cur_data= ((byte*)block)+headers_len; data_end= cur_data + (block->used-headers_len); } Loading
mysql-test/mysql-test-run.sh +6 −0 Original line number Diff line number Diff line Loading @@ -685,6 +685,12 @@ then fi MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT" # Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server # -A marks each argument for passing to the function which initializes the # embedded library if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR" fi MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT" MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose" Loading
mysql-test/r/lowercase_table.result +3 −0 Original line number Diff line number Diff line Loading @@ -78,5 +78,8 @@ ERROR 42000: Not unique table/alias: 'C' select C.a, c.a from t1 c, t2 C; ERROR 42000: Not unique table/alias: 'C' drop table t1, t2; create table t1 (a int); create table t2 like T1; drop table t1, t2; show tables; Tables_in_test