Renamed stripp_sp -> strip_sp
Remove end space from ENUM and SET strings mysql-test/t/type_enum.test: Test of end space in enum's Docs/manual.texi: Changelog include/my_sys.h: Renamed stripp_sp -> strip_sp mysql-test/r/type_enum.result: Test of end space in enums mysys/Makefile.am: change stripp_sp -> strip_sp mysys/mf_strip.c: change stripp_sp -> strip_sp sql/sql_db.cc: change stripp_sp -> strip_sp sql/sql_parse.cc: change stripp_sp -> strip_sp Remove end space from ENUM and SET strings
This commit is contained in:
parent
38fad33321
commit
940a8a4020
@ -46916,6 +46916,9 @@ not yet 100% confident in this code.
|
||||
@appendixsubsec Changes in release 3.23.51
|
||||
@itemize @bullet
|
||||
@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.
|
||||
@item
|
||||
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);
|
||||
extern WF_PACK *wf_comp(my_string str);
|
||||
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
|
||||
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 soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage);
|
||||
extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
|
||||
|
@ -1614,3 +1614,11 @@ field
|
||||
429001
|
||||
429002
|
||||
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
|
||||
|
8
mysql-test/r/type_set.result
Normal file
8
mysql-test/r/type_set.result
Normal file
@ -0,0 +1,8 @@
|
||||
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
|
File diff suppressed because one or more lines are too long
10
mysql-test/t/type_set.test
Normal file
10
mysql-test/t/type_set.test
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# 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\
|
||||
my_error.c errors.c my_div.c my_messnc.c \
|
||||
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.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_qsort.c mf_qsort2.c mf_sort.c \
|
||||
ptr_cmp.c mf_radix.c queues.c \
|
||||
|
@ -20,11 +20,11 @@
|
||||
#include "mysys_priv.h"
|
||||
|
||||
/*
|
||||
stripp_sp(my_string str)
|
||||
strip_sp(my_string str)
|
||||
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;
|
||||
reg3 my_string start;
|
||||
@ -44,4 +44,4 @@ size_s stripp_sp(register my_string str)
|
||||
}
|
||||
*found= '\0'; /* Stripp at first space */
|
||||
return (size_s) (found-start);
|
||||
} /* stripp_sp */
|
||||
} /* strip_sp */
|
@ -320,7 +320,7 @@ bool mysql_change_db(THD *thd,const char *name)
|
||||
uint db_access;
|
||||
DBUG_ENTER("mysql_change_db");
|
||||
|
||||
if (!dbname || !(length=stripp_sp(dbname)))
|
||||
if (!dbname || !(length=strip_sp(dbname)))
|
||||
{
|
||||
x_free(dbname); /* purecov: inspected */
|
||||
send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */
|
||||
|
@ -880,7 +880,7 @@ bool do_command(THD *thd)
|
||||
char *db=thd->strdup(packet+1);
|
||||
thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count);
|
||||
// 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");
|
||||
break;
|
||||
@ -896,7 +896,7 @@ bool do_command(THD *thd)
|
||||
char *db=thd->strdup(packet+1);
|
||||
thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count);
|
||||
// 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");
|
||||
break;
|
||||
@ -1905,7 +1905,7 @@ mysql_execute_command(void)
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
@ -1917,7 +1917,7 @@ mysql_execute_command(void)
|
||||
}
|
||||
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);
|
||||
break;
|
||||
@ -2561,7 +2561,9 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
||||
new_field->interval=interval;
|
||||
new_field->length=0;
|
||||
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--;
|
||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||
if (default_value)
|
||||
@ -2582,10 +2584,10 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
||||
{
|
||||
new_field->interval=interval;
|
||||
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++)
|
||||
{
|
||||
uint length=(uint) strlen(*pos);
|
||||
uint length=(uint) strip_sp((char*) *pos);
|
||||
set_if_bigger(new_field->length,length);
|
||||
}
|
||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user