summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore17
-rwxr-xr-xBitKeeper/triggers/post-commit18
-rw-r--r--client/mysql.cc6
-rw-r--r--mysql-test/r/mysql.result17
-rw-r--r--mysql-test/r/type_bit.result30
-rw-r--r--mysql-test/t/case.test3
-rw-r--r--mysql-test/t/func_test.test5
-rw-r--r--mysql-test/t/mysql.test7
-rw-r--r--mysql-test/t/type_bit.test15
-rw-r--r--mysql-test/t/user_var.test5
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/item_strfunc.cc32
-rw-r--r--sql/log_event.cc2
-rw-r--r--vio/viosocket.c29
15 files changed, 166 insertions, 34 deletions
diff --git a/.bzrignore b/.bzrignore
index 555199fd166..1d0184fb0f5 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -4,6 +4,7 @@
*.bb
*.bbg
*.bin
+*.cmake
*.core
*.d
*.da
@@ -17,6 +18,7 @@
*.map
*.o
*.obj
+*.old
*.pch
*.pdb
*.reject
@@ -25,11 +27,21 @@
*.so
*.so.*
*.spec
+*.user
+*.vcproj
+*/*.dir/*
*/*_pure_*warnings
*/.pure
+*/debug/*
+*/release/*
*~
.*.swp
+./CMakeCache.txt
+./MySql.ncb
+./MySql.sln
+./MySql.suo
./README.build-files
+./cmakecache.txt
./config.h
./copy_mysql_files.bat
./fix-project-files
@@ -65,6 +77,7 @@ BitKeeper/post-commit-manual
BitKeeper/tmp/*
BitKeeper/tmp/bkr3sAHD
BitKeeper/tmp/gone
+CMakeFiles/*
COPYING
COPYING.LIB
Docs/#manual.texi#
@@ -1195,6 +1208,7 @@ strings/ctype_autoconf.c
strings/ctype_extra_sources.c
strings/str_test
strings/test_decimal
+support-files/*.ini
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
support-files/MacOSX/ReadMe.txt
@@ -1297,5 +1311,8 @@ vio/test-sslserver
vio/viotest-ssl
vio/viotest-sslconnect.cpp
vio/viotest.cpp
+win/configure.data
+win/vs71cache.txt
+win/vs8cache.txt
zlib/*.ds?
zlib/*.vcproj
diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit
index 22d183eae3a..981b55c66ec 100755
--- a/BitKeeper/triggers/post-commit
+++ b/BitKeeper/triggers/post-commit
@@ -6,6 +6,13 @@ COMMITS=commits@lists.mysql.com
DOCS=docs-commit@mysql.com
LIMIT=10000
VERSION="5.0"
+BKROOT=`bk root`
+
+if [ -x /usr/sbin/sendmail ]; then
+ SENDMAIL=/usr/sbin/sendmail
+else
+ SENDMAIL=sendmail
+fi
if [ "$REAL_EMAIL" = "" ]
then
@@ -58,7 +65,9 @@ $BH
EOF
bk changes -v -r+
bk cset -r+ -d
- ) | /usr/sbin/sendmail -t
+ ) > $BKROOT/BitKeeper/tmp/dev_public.txt
+
+$SENDMAIL -t < $BKROOT/BitKeeper/tmp/dev_public.txt
#++
# commits@ mail
@@ -82,7 +91,9 @@ see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
EOF
bk changes -v -r+
bk cset -r+ -d
- ) | head -n $LIMIT | /usr/sbin/sendmail -t
+ ) | bk sed -e ${LIMIT}q > $BKROOT/BitKeeper/tmp/commits.txt
+
+$SENDMAIL -t < $BKROOT/BitKeeper/tmp/commits.txt
#++
# docs-commit@ mail
@@ -102,7 +113,8 @@ Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS
EOF
bk changes -v -r+
bk cset -r+ -d
- ) | /usr/sbin/sendmail -t
+ ) > $BKROOT/BitKeeper/tmp/docs.txt
+ $SENDMAIL -t < $BKROOT/BitKeeper/tmp/docs.txt
fi
else
diff --git a/client/mysql.cc b/client/mysql.cc
index 2ba9e896747..5e09c309917 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2321,10 +2321,8 @@ print_table_data(MYSQL_RES *result)
MYSQL_ROW cur;
MYSQL_FIELD *field;
bool *num_flag;
- bool *not_null_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
- not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
if (info_flag)
{
print_field_types(result);
@@ -2363,7 +2361,6 @@ print_table_data(MYSQL_RES *result)
MAX_COLUMN_LENGTH),
field->name);
num_flag[off]= IS_NUM(field->type);
- not_null_flag[off]= IS_NOT_NULL(field->flags);
}
(void) tee_fputs("\n", PAGER);
tee_puts((char*) separator.ptr(), PAGER);
@@ -2384,7 +2381,7 @@ print_table_data(MYSQL_RES *result)
uint extra_padding;
/* If this column may have a null value, use "NULL" for empty. */
- if (! not_null_flag[off] && (cur[off] == NULL))
+ if (cur[off] == NULL)
{
buffer= "NULL";
data_length= 4;
@@ -2424,7 +2421,6 @@ print_table_data(MYSQL_RES *result)
}
tee_puts((char*) separator.ptr(), PAGER);
my_afree((gptr) num_flag);
- my_afree((gptr) not_null_flag);
}
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 99633f5e12a..7dbff4beca5 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -85,6 +85,12 @@ c_cp932
| NULL | NULL | Τη γλώσσα |
| NULL | NULL | ᛖᚴ ᚷᛖᛏ |
+------+------+---------------------------+
+i j k
+NULL 1 NULL
+Field Type Null Key Default Extra
+i int(11) YES NULL
+j int(11) NO
+k int(11) YES NULL
+------+---+------+
| i | j | k |
+------+---+------+
@@ -97,6 +103,10 @@ c_cp932
| j | int(11) | NO | | | |
| k | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
+i s1
+1 x
+2 NULL
+3
+------+------+
| i | s1 |
+------+------+
@@ -104,6 +114,13 @@ c_cp932
| 2 | NULL |
| 3 | |
+------+------+
+unhex('zz')
+NULL
++-------------+
+| unhex('zz') |
++-------------+
+| NULL |
++-------------+
create table t1(a int, b varchar(255), c int);
Field Type Null Key Default Extra
a int(11) YES NULL
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index 2281ed44e3f..f0ac00cedfa 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -572,4 +572,34 @@ def test t1 t1 a a 16 7 1 Y 0 0 63
a
`
drop table t1;
+create table bug15583(b BIT(8), n INT);
+insert into bug15583 values(128, 128);
+insert into bug15583 values(null, null);
+insert into bug15583 values(0, 0);
+insert into bug15583 values(255, 255);
+select hex(b), bin(b), oct(b), hex(n), bin(n), oct(n) from bug15583;
+hex(b) bin(b) oct(b) hex(n) bin(n) oct(n)
+80 10000000 200 80 10000000 200
+NULL NULL NULL NULL NULL NULL
+0 0 0 0 0 0
+FF 11111111 377 FF 11111111 377
+select hex(b)=hex(n) as should_be_onetrue, bin(b)=bin(n) as should_be_onetrue, oct(b)=oct(n) as should_be_onetrue from bug15583;
+should_be_onetrue should_be_onetrue should_be_onetrue
+1 1 1
+NULL NULL NULL
+1 1 1
+1 1 1
+select hex(b + 0), bin(b + 0), oct(b + 0), hex(n), bin(n), oct(n) from bug15583;
+hex(b + 0) bin(b + 0) oct(b + 0) hex(n) bin(n) oct(n)
+80 10000000 200 80 10000000 200
+NULL NULL NULL NULL NULL NULL
+0 0 0 0 0 0
+FF 11111111 377 FF 11111111 377
+select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
+conv(b, 10, 2) conv(b + 0, 10, 2)
+10000000 10000000
+NULL NULL
+0 0
+11111111 11111111
+drop table bug15583;
End of 5.0 tests
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index fbe1ee2b8c8..0e9e141f6d8 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -133,8 +133,6 @@ select min(a), min(case when 1=1 then a else NULL end),
from t1 where b=3 group by b;
drop table t1;
-# End of 4.1 tests
-
#
# Tests for bug #9939: conversion of the arguments for COALESCE and IFNULL
@@ -154,3 +152,4 @@ SELECT IFNULL(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM,
FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
DROP TABLE t1,t2;
+# End of 4.1 tests
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index f2ff47704c9..0ea89cd0913 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -108,9 +108,6 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
-# End of 4.1 tests
-
-#
# Bug#6726: NOT BETWEEN parse failure
#
create table t1 (a int, b int);
@@ -127,3 +124,5 @@ SELECT GREATEST(1,NULL) FROM DUAL;
SELECT LEAST('xxx','aaa',NULL,'yyy') FROM DUAL;
SELECT LEAST(1.1,1.2,NULL,1.0) FROM DUAL;
SELECT GREATEST(1.5E+2,1.3E+2,NULL) FROM DUAL;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index cf4e6f4047c..9e3eabf474b 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -70,14 +70,21 @@ drop table t1;
#
# "DESCRIBE" commands may return strange NULLness flags.
#
+--exec $MYSQL --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
#
# Bug#19564: mysql displays NULL instead of space
#
+--exec $MYSQL test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
#
+# Bug#21618: NULL shown as empty string in client
+#
+--exec $MYSQL test -e "select unhex('zz');"
+--exec $MYSQL -t test -e "select unhex('zz');"
+
# Bug#19265 describe command does not work from mysql prompt
#
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index e028dbc51d9..998f8f18fbe 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -238,4 +238,19 @@ select * from t1;
--disable_metadata
drop table t1;
+#
+# Bug#15583: BIN()/OCT()/CONV() do not work with BIT values
+#
+create table bug15583(b BIT(8), n INT);
+insert into bug15583 values(128, 128);
+insert into bug15583 values(null, null);
+insert into bug15583 values(0, 0);
+insert into bug15583 values(255, 255);
+select hex(b), bin(b), oct(b), hex(n), bin(n), oct(n) from bug15583;
+select hex(b)=hex(n) as should_be_onetrue, bin(b)=bin(n) as should_be_onetrue, oct(b)=oct(n) as should_be_onetrue from bug15583;
+select hex(b + 0), bin(b + 0), oct(b + 0), hex(n), bin(n), oct(n) from bug15583;
+select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
+drop table bug15583;
+
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index b2a9728de00..644ca506eba 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -144,9 +144,6 @@ select @@version;
--replace_column 1 #
select @@global.version;
-# End of 4.1 tests
-
-#
# Bug #6598: problem with cast(NULL as signed integer);
#
@@ -212,3 +209,5 @@ insert into t1 values (1,2),(2,3),(3,1);
select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
select @var;
drop table t1;
+
+# End of 4.1 tests
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 579e7f88ee6..24f5eff197b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3799,13 +3799,13 @@ Item_func_set_user_var::update()
case REAL_RESULT:
{
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
- REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
+ REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
break;
}
case INT_RESULT:
{
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
- INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
+ INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
unsigned_flag);
break;
}
@@ -3813,23 +3813,23 @@ Item_func_set_user_var::update()
{
if (!save_result.vstr) // Null value
res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
- DERIVATION_IMPLICIT);
+ DERIVATION_IMPLICIT, 0);
else
res= update_hash((void*) save_result.vstr->ptr(),
save_result.vstr->length(), STRING_RESULT,
save_result.vstr->charset(),
- DERIVATION_IMPLICIT);
+ DERIVATION_IMPLICIT, 0);
break;
}
case DECIMAL_RESULT:
{
if (!save_result.vdec) // Null value
res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
- DERIVATION_IMPLICIT);
+ DERIVATION_IMPLICIT, 0);
else
res= update_hash((void*) save_result.vdec,
sizeof(my_decimal), DECIMAL_RESULT,
- &my_charset_bin, DERIVATION_IMPLICIT);
+ &my_charset_bin, DERIVATION_IMPLICIT, 0);
break;
}
case ROW_RESULT:
diff --git a/sql/item_func.h b/sql/item_func.h
index c15b0b854b0..8abf5d91cd5 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1173,7 +1173,7 @@ public:
String *val_str(String *str);
my_decimal *val_decimal(my_decimal *);
bool update_hash(void *ptr, uint length, enum Item_result type,
- CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0);
+ CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
bool send(Protocol *protocol, String *str_arg);
void make_field(Send_field *tmp_field);
bool check(bool use_result_field);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 2acd1371ce5..46a96c28d88 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2381,17 +2381,33 @@ String *Item_func_conv::val_str(String *str)
abs(to_base) > 36 || abs(to_base) < 2 ||
abs(from_base) > 36 || abs(from_base) < 2 || !(res->length()))
{
- null_value=1;
- return 0;
+ null_value= 1;
+ return NULL;
}
- null_value=0;
+ null_value= 0;
unsigned_flag= !(from_base < 0);
- if (from_base < 0)
- dec= my_strntoll(res->charset(),res->ptr(),res->length(),-from_base,&endptr,&err);
+
+ if (args[0]->field_type() == MYSQL_TYPE_BIT)
+ {
+ /*
+ Special case: The string representation of BIT doesn't resemble the
+ decimal representation, so we shouldn't change it to string and then to
+ decimal.
+ */
+ dec= args[0]->val_int();
+ }
else
- dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),from_base,&endptr,&err);
- ptr= longlong2str(dec,ans,to_base);
- if (str->copy(ans,(uint32) (ptr-ans), default_charset()))
+ {
+ if (from_base < 0)
+ dec= my_strntoll(res->charset(), res->ptr(), res->length(),
+ -from_base, &endptr, &err);
+ else
+ dec= (longlong) my_strntoull(res->charset(), res->ptr(), res->length(),
+ from_base, &endptr, &err);
+ }
+
+ ptr= longlong2str(dec, ans, to_base);
+ if (str->copy(ans, (uint32) (ptr-ans), default_charset()))
return &my_empty_string;
return str;
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index cf5dbb1e77c..219434ab218 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3846,7 +3846,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
a single record and with a single column. Thus, like
a column value, it could always have IMPLICIT derivation.
*/
- e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT);
+ e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
free_root(thd->mem_root,0);
rli->inc_event_relay_log_pos();
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 1f348c3313d..bd4e1e3c770 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -559,9 +559,13 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
}
+/**
+ Close shared memory and DBUG_PRINT any errors that happen on closing.
+ @return Zero if all closing functions succeed, and nonzero otherwise.
+*/
int vio_close_shared_memory(Vio * vio)
{
- int r;
+ int error_count= 0;
DBUG_ENTER("vio_close_shared_memory");
if (vio->type != VIO_CLOSED)
{
@@ -575,23 +579,44 @@ int vio_close_shared_memory(Vio * vio)
result if they are success.
*/
if (UnmapViewOfFile(vio->handle_map) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("UnmapViewOfFile() failed"));
+ }
if (CloseHandle(vio->event_server_wrote) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->esw) failed"));
+ }
if (CloseHandle(vio->event_server_read) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->esr) failed"));
+ }
if (CloseHandle(vio->event_client_wrote) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->ecw) failed"));
+ }
if (CloseHandle(vio->event_client_read) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->ecr) failed"));
+ }
if (CloseHandle(vio->handle_file_map) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->hfm) failed"));
+ }
if (CloseHandle(vio->event_conn_closed) == 0)
+ {
+ error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->ecc) failed"));
+ }
}
vio->type= VIO_CLOSED;
vio->sd= -1;
- DBUG_RETURN(!r);
+ DBUG_RETURN(error_count);
}
#endif /* HAVE_SMEM */
#endif /* __WIN__ */