diff options
-rw-r--r-- | mysql-test/r/federated.result | 16 | ||||
-rw-r--r-- | mysql-test/t/federated.test | 19 | ||||
-rwxr-xr-x | netware/BUILD/mwasmnlm | 5 | ||||
-rwxr-xr-x | netware/BUILD/mwccnlm | 5 | ||||
-rwxr-xr-x | netware/BUILD/mwldnlm | 5 | ||||
-rw-r--r-- | sql-common/client.c | 7 | ||||
-rw-r--r-- | sql/ha_federated.cc | 29 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 6 |
9 files changed, 73 insertions, 21 deletions
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 1b9d02a64d0..efdad257172 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1717,6 +1717,22 @@ id c1 c2 9 abc ppc drop table federated.t1, federated.t2; drop table federated.t1, federated.t2; +create table t1 (id int not null auto_increment primary key, val int); +create table t1 +(id int not null auto_increment primary key, val int) engine=federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +insert into t1 values (1,0),(2,0); +update t1 set val = NULL where id = 1; +select * from t1; +id val +1 NULL +2 0 +select * from t1; +id val +1 NULL +2 0 +drop table t1; +drop table t1; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 77ca38b9587..717fca4b158 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1366,6 +1366,25 @@ drop table federated.t1, federated.t2; connection master; --enable_parsing +# +# Bug #16494: Updates that set a column to NULL fail sometimes +# +connection slave; +create table t1 (id int not null auto_increment primary key, val int); +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table t1 + (id int not null auto_increment primary key, val int) engine=federated + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; +insert into t1 values (1,0),(2,0); +update t1 set val = NULL where id = 1; +select * from t1; +connection slave; +select * from t1; +drop table t1; +connection master; +drop table t1; + # # Additional test for bug#18437 "Wrong values inserted with a before # update trigger on NDB table". SQL-layer didn't properly inform diff --git a/netware/BUILD/mwasmnlm b/netware/BUILD/mwasmnlm index 381f84ec0c8..11fc2bc3842 100755 --- a/netware/BUILD/mwasmnlm +++ b/netware/BUILD/mwasmnlm @@ -5,4 +5,7 @@ set -e args=" $*" -wine --debugmsg -all -- mwasmnlm $args +# NOTE: Option 'pipefail' is not standard sh +set -o pipefail +wine --debugmsg -all -- mwasmnlm $args | \ +perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/mwccnlm b/netware/BUILD/mwccnlm index cb2d62fe8cf..e6840e781f8 100755 --- a/netware/BUILD/mwccnlm +++ b/netware/BUILD/mwccnlm @@ -7,4 +7,7 @@ set -e # convert it to "-I../include" args=" "`echo $* | sed -e 's/-I.\/../-I../g'` -wine --debugmsg -all -- mwccnlm $args +# NOTE: Option 'pipefail' is not standard sh +set -o pipefail +wine --debugmsg -all -- mwccnlm $args | \ +perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/mwldnlm b/netware/BUILD/mwldnlm index 28566fc5cb1..cc8c9e63c6e 100755 --- a/netware/BUILD/mwldnlm +++ b/netware/BUILD/mwldnlm @@ -5,4 +5,7 @@ set -e args=" $*" -wine --debugmsg -all -- mwldnlm $args +# NOTE: Option 'pipefail' is not standard sh +set -o pipefail +wine --debugmsg -all -- mwldnlm $args | \ +perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/sql-common/client.c b/sql-common/client.c index 8c0420a27ba..83169db1a06 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1509,6 +1509,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , */ #ifdef HAVE_OPENSSL + static void mysql_ssl_free(MYSQL *mysql __attribute__((unused))) { @@ -1533,6 +1534,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) DBUG_VOID_RETURN; } +#endif /* HAVE_OPENSSL */ /* Return the SSL cipher (if any) used for current @@ -1548,8 +1550,10 @@ const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql) { DBUG_ENTER("mysql_get_ssl_cipher"); +#ifdef HAVE_OPENSSL if (mysql->net.vio && mysql->net.vio->ssl_arg) DBUG_RETURN(SSL_get_cipher_name((SSL*)mysql->net.vio->ssl_arg)); +#endif /* HAVE_OPENSSL */ DBUG_RETURN(NULL); } @@ -1568,6 +1572,9 @@ mysql_get_ssl_cipher(MYSQL *mysql) 1 Failed to validate server */ + +#ifdef HAVE_OPENSSL + static int ssl_verify_server_cert(Vio *vio, const char* server_hostname) { SSL *ssl; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index ea1100938d7..e2d545710f9 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1804,19 +1804,13 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) /* buffers for following strings */ - char old_field_value_buffer[STRING_BUFFER_USUAL_SIZE]; - char new_field_value_buffer[STRING_BUFFER_USUAL_SIZE]; + char field_value_buffer[STRING_BUFFER_USUAL_SIZE]; char update_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char where_buffer[FEDERATED_QUERY_BUFFER_SIZE]; - /* stores the value to be replaced of the field were are updating */ - String old_field_value(old_field_value_buffer, - sizeof(old_field_value_buffer), - &my_charset_bin); - /* stores the new value of the field */ - String new_field_value(new_field_value_buffer, - sizeof(new_field_value_buffer), - &my_charset_bin); + /* Work area for field values */ + String field_value(field_value_buffer, sizeof(field_value_buffer), + &my_charset_bin); /* stores the update query */ String update_string(update_buffer, sizeof(update_buffer), @@ -1829,8 +1823,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) /* set string lengths to 0 to avoid misc chars in string */ - old_field_value.length(0); - new_field_value.length(0); + field_value.length(0); update_string.length(0); where_string.length(0); @@ -1844,8 +1837,8 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) In this loop, we want to match column names to values being inserted (while building INSERT statement). - Iterate through table->field (new data) and share->old_filed (old_data) - using the same index to created an SQL UPDATE statement, new data is + Iterate through table->field (new data) and share->old_field (old_data) + using the same index to create an SQL UPDATE statement. New data is used to create SET field=value and old data is used to create WHERE field=oldvalue */ @@ -1855,13 +1848,15 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) if (bitmap_is_set(table->write_set, (*field)->field_index)) { if ((*field)->is_null()) - new_field_value.append(FEDERATED_NULL); + update_string.append(FEDERATED_NULL); else { my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set); /* otherwise = */ - (*field)->val_str(&new_field_value); - (*field)->quote_data(&new_field_value); + (*field)->val_str(&field_value); + (*field)->quote_data(&field_value); + update_string.append(field_value); + field_value.length(0); tmp_restore_column_map(table->read_set, old_map); } update_string.append((*field)->field_name); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c9c12b154c4..9a3f43c7f05 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -3318,7 +3318,7 @@ longlong Item_func_regex::val_int() } } null_value=0; - return my_regexec(&preg,res->c_ptr(),0,(my_regmatch_t*) 0,0) ? 0 : 1; + return my_regexec(&preg,res->c_ptr_safe(),0,(my_regmatch_t*) 0,0) ? 0 : 1; } diff --git a/tests/Makefile.am b/tests/Makefile.am index 8ee64f8179c..fd7bc5a532e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -50,8 +50,14 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ LIBS = @CLIENT_LIBS@ LDADD = @CLIENT_EXTRA_LDFLAGS@ \ $(LIBMYSQLCLIENT_LA) +if HAVE_NETWARE +mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS) +mysql_client_test_SOURCES= mysql_client_test.c $(yassl_dummy_link_fix) \ + ../mysys/my_memmem.c +else mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS) -L../mysys -lmysys mysql_client_test_SOURCES= mysql_client_test.c $(yassl_dummy_link_fix) +endif insert_test_SOURCES= insert_test.c $(yassl_dummy_link_fix) select_test_SOURCES= select_test.c $(yassl_dummy_link_fix) insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) |