From e2aa2abd725ea04c2809374e1125d3309b94b88e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Jul 2005 15:54:02 -0700 Subject: Typo for debug code. Bug #11705 vio/viossl.c: Typo for dbug code BitKeeper/etc/config: turned off openlogging --- BitKeeper/etc/config | 2 +- vio/viossl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index c609fcdbd49..6ddd492ebc4 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -24,7 +24,7 @@ description: MySQL - fast and reliable SQL database # repository is commercial it can be an internal email address or "none" # to disable logging. # -logging: logging@openlogging.org +logging: none # # If this field is set, all checkins will appear to be made by this user, # in effect making this a single user package. Single user packages are diff --git a/vio/viossl.c b/vio/viossl.c index 043d23f0238..2f608209a53 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -315,7 +315,7 @@ int sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout) vio_blocking(vio, net_blocking, &unused); DBUG_RETURN(1); } -#ifndef DBUF_OFF +#ifndef DBUG_OFF DBUG_PRINT("info",("SSL_get_cipher_name() = '%s'" ,SSL_get_cipher_name((SSL*) vio->ssl_arg))); client_cert = SSL_get_peer_certificate ((SSL*) vio->ssl_arg); -- cgit v1.2.1 From 6fcb956277ec9cf29f2b2e42417e5dff640064d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jul 2005 15:36:57 +0200 Subject: mysql_client_test.dsp: Corrected libs and lib search path for debug target VC++Files/tests/mysql_client_test.dsp: Corrected libs and lib search path for debug target --- VC++Files/tests/mysql_client_test.dsp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/VC++Files/tests/mysql_client_test.dsp b/VC++Files/tests/mysql_client_test.dsp index d862425d602..012129a208b 100644 --- a/VC++Files/tests/mysql_client_test.dsp +++ b/VC++Files/tests/mysql_client_test.dsp @@ -41,8 +41,8 @@ RSC=rc.exe # PROP Output_Dir ".\Debug" # PROP Intermediate_Dir ".\Debug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX -# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX +# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX +# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX # ADD BASE MTL /nologo /tlb".\Debug\mysql_client_test.tlb" /win32 # ADD MTL /nologo /tlb".\Debug\mysql_client_test.tlb" /win32 # ADD BASE RSC /l 1033 @@ -66,8 +66,8 @@ LINK32=link.exe # PROP Output_Dir ".\Release" # PROP Intermediate_Dir ".\Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX -# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX +# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX +# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX # ADD BASE MTL /nologo /tlb".\Release\mysql_client_test.tlb" /win32 # ADD MTL /nologo /tlb".\Release\mysql_client_test.tlb" /win32 # ADD BASE RSC /l 1033 @@ -76,8 +76,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console !ENDIF -- cgit v1.2.1 From dce0304a42a7bcecc9db59a3ea7225bd8a56fe89 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jul 2005 13:20:07 +0500 Subject: field_conv.cc: Bug#11591 CHAR column with utf8 does not work properly (more chars than expected) do_cut_string didn't call well_formed_length, and copied all data, which was wrong in the case of multibyte character set. ctype_utf8.result, ctype_utf8.test: adding test case sql/field_conv.cc: Bug#11591 CHAR column with utf8 does not work properly (more chars than expected) do_cut_string didn't call well_formed_length, and copied all data, which was wrong in the case of multibyte character set. mysql-test/t/ctype_utf8.test: adding test case mysql-test/r/ctype_utf8.result: adding test caser --- mysql-test/r/ctype_utf8.result | 11 +++++++++++ mysql-test/t/ctype_utf8.test | 10 ++++++++++ sql/field_conv.cc | 33 ++++++++++++++++++++------------- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index d4e12ea84b7..665387e476c 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -939,6 +939,17 @@ content msisdn ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми 1234567890 11 g 1234567890 DROP TABLE t1,t2; +create table t1 (a char(20) character set utf8); +insert into t1 values ('123456'),('андрей'); +alter table t1 modify a char(2) character set utf8; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +select char_length(a), length(a), a from t1 order by a; +char_length(a) length(a) a +2 2 12 +2 4 ан +drop table t1; CREATE TABLE t1 ( a varchar(255) NOT NULL default '', KEY a (a) diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 0a847057258..737dcbcf1ed 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -789,6 +789,16 @@ SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890'; DROP TABLE t1,t2; +# +# Bug#11591: CHAR column with utf8 does not work properly +# (more chars than expected) +# +create table t1 (a char(20) character set utf8); +insert into t1 values ('123456'),('андрей'); +alter table t1 modify a char(2) character set utf8; +select char_length(a), length(a), a from t1 order by a; +drop table t1; + # # Bug#9557 MyISAM utf8 table crash # diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 8b362bbf807..625586d8c9b 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -326,21 +326,28 @@ static void do_field_real(Copy_field *copy) static void do_cut_string(Copy_field *copy) { // Shorter string field - memcpy(copy->to_ptr,copy->from_ptr,copy->to_length); - - /* Check if we loosed any important characters */ - char *ptr,*end; - for (ptr=copy->from_ptr+copy->to_length,end=copy->from_ptr+copy->from_length ; - ptr != end ; - ptr++) + int well_formed_error; + CHARSET_INFO *cs= copy->from_field->charset(); + const char *from_end= copy->from_ptr + copy->from_length; + uint copy_length= cs->cset->well_formed_len(cs, copy->from_ptr, from_end, + copy->to_length / cs->mbmaxlen, + &well_formed_error); + if (copy->to_length < copy_length) + copy_length= copy->to_length; + memcpy(copy->to_ptr, copy->from_ptr, copy_length); + + /* Check if we lost any important characters */ + if (well_formed_error || + cs->cset->scan(cs, copy->from_ptr + copy_length, from_end, + MY_SEQ_SPACES) < (copy->from_length - copy_length)) { - if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible - { - copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, - ER_WARN_DATA_TRUNCATED, 1); - break; - } + copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DATA_TRUNCATED, 1); } + + if (copy_length < copy->to_length) + cs->cset->fill(cs, copy->to_ptr + copy_length, + copy->to_length - copy_length, ' '); } -- cgit v1.2.1 From b18b97aace1ad49ce4fcb2ad634bc171ce289869 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jul 2005 16:51:39 +0500 Subject: field_conv.cc: Identation fix sql/field_conv.cc: Identation fix --- sql/field_conv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 625586d8c9b..a447716a818 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -347,7 +347,7 @@ static void do_cut_string(Copy_field *copy) if (copy_length < copy->to_length) cs->cset->fill(cs, copy->to_ptr + copy_length, - copy->to_length - copy_length, ' '); + copy->to_length - copy_length, ' '); } -- cgit v1.2.1