From b2f47a30dba2768e8724c27e5112b15f781d004c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Jul 2002 19:52:51 +0400 Subject: [PATCH 1/3] Allow storing "+456" then decimal declared unsigned mysql-test/r/type_decimal.result: Change test results according to this sql/field.cc: Allow storing "+1234" in unsigned decimal as Monty asked. Old code is left for a while --- mysql-test/r/type_decimal.result | 12 ++++++------ sql/field.cc | 11 +++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 5623482aa7f..a66809b139b 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -199,15 +199,15 @@ select * from t1; a 0.00 0.00 -0.00 -01.00 ++0.00 01.00 ++01.00 0.00 0.00 -0.10 ++0.10 0.10 00000001.00 -00000001.00 ++0000001.00 0.00 99999999.99 99999999.99 @@ -316,9 +316,9 @@ select * from t1; a 0 0 -1 ++1 01 -0000000001 ++000000001 1234567890 9999999999 drop table t1; diff --git a/sql/field.cc b/sql/field.cc index eb3dc7948d4..42ddcc3b9d2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -431,8 +431,9 @@ void Field_decimal::store(const char *from,uint len) { sign_char= *from++; /* - Unsigned can't have any flag. So we'll just drop "+" - and will overflow on "-" + We allow "+" for unsigned decimal unless defined different + Both options allowed as one may wish not to have "+" for unsigned numbers + because of data processing issues */ if (unsigned_flag) { @@ -441,8 +442,14 @@ void Field_decimal::store(const char *from,uint len) Field_decimal::overflow(1); return; } + /* + Defining this will not store "+" for unsigned decimal type even if + it is passed in numeric string. This will make some tests to fail + */ +#ifdef DONT_ALLOW_UNSIGNED_PLUS else sign_char=0; +#endif } } From 3b3d0d74e9d625a6552b12ac534ec63725966103 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 Jul 2002 15:04:22 +0400 Subject: [PATCH 2/3] Do not crash on CTRL-C during then running mysqld --bootstrap I'm not quite sure if this is correct way to fix it so please check sql/sql_parse.cc: Block SIGINT --- sql/sql_parse.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 33229b4cb4c..28e77ecd697 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -706,8 +706,10 @@ pthread_handler_decl(handle_bootstrap,arg) thd->dbug_thread_id=my_thread_id(); #if !defined(__WIN__) && !defined(OS2) sigset_t set; - VOID(sigemptyset(&set)); // Get mask in use - VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); + VOID(sigemptyset(&set)); + VOID(sigaddset(&set,SIGINT)); + // Get mask in use and block SIGINT + VOID(pthread_sigmask(SIG_BLOCK,&set,&thd->block_signals)); #endif if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) From 1ac8636dc0bc1bb4b1571c1265d7bbec611aad59 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 4 Aug 2002 17:14:51 +0400 Subject: [PATCH 3/3] Revert SIGINT patch as Monty requested sql/sql_parse.cc: Revert patch --- sql/sql_parse.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1d7987bbc2f..3aff3255706 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -706,10 +706,10 @@ pthread_handler_decl(handle_bootstrap,arg) thd->dbug_thread_id=my_thread_id(); #if !defined(__WIN__) && !defined(OS2) sigset_t set; - VOID(sigemptyset(&set)); - VOID(sigaddset(&set,SIGINT)); - // Get mask in use and block SIGINT - VOID(pthread_sigmask(SIG_BLOCK,&set,&thd->block_signals)); + VOID(sigemptyset(&set)); // Get mask in use + VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); + + #endif if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)