Commit 6d0e43c7 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Renamed stripp_sp -> strip_sp

Remove end space from ENUM and SET strings
parent 07886933
...@@ -46916,6 +46916,9 @@ not yet 100% confident in this code. ...@@ -46916,6 +46916,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.51 @appendixsubsec Changes in release 3.23.51
@itemize @bullet @itemize @bullet
@item @item
Remove end space from @code{enum} values. (This fixed a problem with
@code{SHOW CREATE TABLE}).
@item
Fixed bug in @code{CONCAT_WS()} that cut the result. Fixed bug in @code{CONCAT_WS()} that cut the result.
@item @item
Changed name of variables @code{Com_show_master_stat} to Changed name of variables @code{Com_show_master_stat} to
...@@ -494,7 +494,7 @@ extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len); ...@@ -494,7 +494,7 @@ extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len);
extern WF_PACK *wf_comp(my_string str); extern WF_PACK *wf_comp(my_string str);
extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
extern void wf_end(struct wild_file_pack *buffer); extern void wf_end(struct wild_file_pack *buffer);
extern size_s stripp_sp(my_string str); extern size_s strip_sp(my_string str);
extern void get_date(my_string to,int timeflag,time_t use_time); extern void get_date(my_string to,int timeflag,time_t use_time);
extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage); extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage);
extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
......
...@@ -1614,3 +1614,11 @@ field ...@@ -1614,3 +1614,11 @@ field
429001 429001
429002 429002
429003 429003
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default ''
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default 'b'
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default ''
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default 'b'
) TYPE=MyISAM
This diff is collapsed.
#
# Test of SET with space
#
create table t1 (a set (' ','a','b') not null);
show create table t1;
drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b ');
show create table t1;
drop table t1;
...@@ -35,7 +35,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ ...@@ -35,7 +35,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_error.c errors.c my_div.c my_messnc.c \ my_error.c errors.c my_div.c my_messnc.c \
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c my_symlink2.c \ my_symlink.c my_symlink2.c \
mf_pack.c mf_pack2.c mf_unixpath.c mf_stripp.c \ mf_pack.c mf_pack2.c mf_unixpath.c mf_strip.c \
mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \ mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
mf_qsort.c mf_qsort2.c mf_sort.c \ mf_qsort.c mf_qsort2.c mf_sort.c \
ptr_cmp.c mf_radix.c queues.c \ ptr_cmp.c mf_radix.c queues.c \
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
#include "mysys_priv.h" #include "mysys_priv.h"
/* /*
stripp_sp(my_string str) strip_sp(my_string str)
Strips end-space from string and returns new length. Strips end-space from string and returns new length.
*/ */
size_s stripp_sp(register my_string str) size_s strip_sp(register my_string str)
{ {
reg2 my_string found; reg2 my_string found;
reg3 my_string start; reg3 my_string start;
...@@ -44,4 +44,4 @@ size_s stripp_sp(register my_string str) ...@@ -44,4 +44,4 @@ size_s stripp_sp(register my_string str)
} }
*found= '\0'; /* Stripp at first space */ *found= '\0'; /* Stripp at first space */
return (size_s) (found-start); return (size_s) (found-start);
} /* stripp_sp */ } /* strip_sp */
...@@ -320,7 +320,7 @@ bool mysql_change_db(THD *thd,const char *name) ...@@ -320,7 +320,7 @@ bool mysql_change_db(THD *thd,const char *name)
uint db_access; uint db_access;
DBUG_ENTER("mysql_change_db"); DBUG_ENTER("mysql_change_db");
if (!dbname || !(length=stripp_sp(dbname))) if (!dbname || !(length=strip_sp(dbname)))
{ {
x_free(dbname); /* purecov: inspected */ x_free(dbname); /* purecov: inspected */
send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */ send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */
......
...@@ -880,7 +880,7 @@ bool do_command(THD *thd) ...@@ -880,7 +880,7 @@ bool do_command(THD *thd)
char *db=thd->strdup(packet+1); char *db=thd->strdup(packet+1);
thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count); thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count);
// null test to handle EOM // null test to handle EOM
if (!db || !stripp_sp(db) || check_db_name(db)) if (!db || !strip_sp(db) || check_db_name(db))
{ {
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
break; break;
...@@ -896,7 +896,7 @@ bool do_command(THD *thd) ...@@ -896,7 +896,7 @@ bool do_command(THD *thd)
char *db=thd->strdup(packet+1); char *db=thd->strdup(packet+1);
thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count); thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count);
// null test to handle EOM // null test to handle EOM
if (!db || !stripp_sp(db) || check_db_name(db)) if (!db || !strip_sp(db) || check_db_name(db))
{ {
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
break; break;
...@@ -1905,7 +1905,7 @@ mysql_execute_command(void) ...@@ -1905,7 +1905,7 @@ mysql_execute_command(void)
break; break;
case SQLCOM_CREATE_DB: case SQLCOM_CREATE_DB:
{ {
if (!stripp_sp(lex->name) || check_db_name(lex->name)) if (!strip_sp(lex->name) || check_db_name(lex->name))
{ {
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name); net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
break; break;
...@@ -1917,7 +1917,7 @@ mysql_execute_command(void) ...@@ -1917,7 +1917,7 @@ mysql_execute_command(void)
} }
case SQLCOM_DROP_DB: case SQLCOM_DROP_DB:
{ {
if (!stripp_sp(lex->name) || check_db_name(lex->name)) if (!strip_sp(lex->name) || check_db_name(lex->name))
{ {
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name); net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
break; break;
...@@ -2561,7 +2561,9 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -2561,7 +2561,9 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->interval=interval; new_field->interval=interval;
new_field->length=0; new_field->length=0;
for (const char **pos=interval->type_names; *pos ; pos++) for (const char **pos=interval->type_names; *pos ; pos++)
new_field->length+=(uint) strlen(*pos)+1; {
new_field->length+=(uint) strip_sp((char*) *pos)+1;
}
new_field->length--; new_field->length--;
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
if (default_value) if (default_value)
...@@ -2582,10 +2584,10 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -2582,10 +2584,10 @@ bool add_field_to_list(char *field_name, enum_field_types type,
{ {
new_field->interval=interval; new_field->interval=interval;
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
new_field->length=(uint) strlen(interval->type_names[0]); new_field->length=(uint) strip_sp((char*) interval->type_names[0]);
for (const char **pos=interval->type_names+1; *pos ; pos++) for (const char **pos=interval->type_names+1; *pos ; pos++)
{ {
uint length=(uint) strlen(*pos); uint length=(uint) strip_sp((char*) *pos);
set_if_bigger(new_field->length,length); set_if_bigger(new_field->length,length);
} }
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
......
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