summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <tsmith@siva.hindu.god>2007-01-18 10:30:39 -0700
committerunknown <tsmith@siva.hindu.god>2007-01-18 10:30:39 -0700
commit73dcec767800c00ce55922d1673da09de13ac54f (patch)
treeed55c77076ebce744a6c2075e3dc2019d85812f0 /client
parent8ea28e3774ebb361bfeb451ec8d11c330c8e67b3 (diff)
parent64b075e67777d20548ba46136fbf3c00d0782220 (diff)
downloadmariadb-git-73dcec767800c00ce55922d1673da09de13ac54f.tar.gz
Merge siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/51
into siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/maint/51 client/mysqlbinlog.cc: Auto merged configure.in: Auto merged include/config-win.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/t/disabled.def: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/log_event.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/table.cc: Auto merged storage/myisam/mi_packrec.c: Use local
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index cd417ea66c7..1dc04d008e7 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -725,6 +725,20 @@ void close_connections()
}
+void close_statements()
+{
+ struct st_connection *con;
+ DBUG_ENTER("close_statements");
+ for (con= connections; con < next_con; con++)
+ {
+ if (con->stmt)
+ mysql_stmt_close(con->stmt);
+ con->stmt= 0;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
void close_files()
{
DBUG_ENTER("close_files");
@@ -1246,7 +1260,9 @@ void var_set(const char *var_name, const char *var_name_end,
v->int_dirty= 0;
v->str_val_len= strlen(v->str_val);
}
- strxmov(buf, v->name, "=", v->str_val, NullS);
+ my_snprintf(buf, sizeof(buf), "%.*s=%.*s",
+ v->name_len, v->name,
+ v->str_val_len, v->str_val);
if (!(v->env_s= my_strdup(buf, MYF(MY_WME))))
die("Out of memory");
putenv(v->env_s);
@@ -2906,6 +2922,10 @@ void do_close_connection(struct st_command *command)
}
}
#endif
+ if (next_con->stmt)
+ mysql_stmt_close(next_con->stmt);
+ next_con->stmt= 0;
+
mysql_close(&con->mysql);
if (con->util_mysql)
mysql_close(con->util_mysql);
@@ -2974,7 +2994,12 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR ||
mysql_errno(mysql) == CR_CONNECTION_ERROR) &&
failed_attempts < opt_max_connect_retries)
+ {
+ verbose_msg("Connect attempt %d/%d failed: %d: %s", failed_attempts,
+ opt_max_connect_retries, mysql_errno(mysql),
+ mysql_error(mysql));
my_sleep(connection_retry_sleep);
+ }
else
{
if (failed_attempts > 0)
@@ -4691,10 +4716,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
}
/*
- Store the result. If res is NULL, use mysql_field_count to
- determine if that was expected
+ Store the result of the query if it will return any fields
*/
- if (!(res= mysql_store_result(mysql)) && mysql_field_count(mysql))
+ if (mysql_field_count(mysql) && ((res= mysql_store_result(mysql)) == 0))
{
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds);
@@ -4746,7 +4770,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
}
if (res)
+ {
mysql_free_result(res);
+ res= 0;
+ }
counter++;
} while (!(err= mysql_next_result(mysql)));
if (err > 0)
@@ -4813,7 +4840,7 @@ void handle_error(struct st_command *command,
err_errno, err_error);
/* Abort the run of this test, pass the failed query as reason */
- abort_not_supported_test("Query '%s' failed, required functionality" \
+ abort_not_supported_test("Query '%s' failed, required functionality " \
"not supported", command->query);
}
@@ -5103,6 +5130,14 @@ end:
dynstr_free(&ds_execute_warnings);
}
+
+ /* Close the statement if - no reconnect, need new prepare */
+ if (mysql->reconnect)
+ {
+ mysql_stmt_close(stmt);
+ cur_con->stmt= NULL;
+ }
+
/*
We save the return code (mysql_stmt_errno(stmt)) from the last call sent
to the server into the mysqltest builtin variable $mysql_errno. This
@@ -5110,10 +5145,7 @@ end:
*/
var_set_errno(mysql_stmt_errno(stmt));
-#ifndef BUG15518_FIXED
- mysql_stmt_close(stmt);
- cur_con->stmt= NULL;
-#endif
+
DBUG_VOID_RETURN;
}
@@ -5900,6 +5932,8 @@ int main(int argc, char **argv)
break;
case Q_DISABLE_PS_PROTOCOL:
ps_protocol_enabled= 0;
+ /* Close any open statements */
+ close_statements();
break;
case Q_ENABLE_PS_PROTOCOL:
ps_protocol_enabled= ps_protocol;
@@ -5909,6 +5943,8 @@ int main(int argc, char **argv)
break;
case Q_ENABLE_RECONNECT:
set_reconnect(&cur_con->mysql, 1);
+ /* Close any open statements - no reconnect, need new prepare */
+ close_statements();
break;
case Q_DISABLE_PARSING:
if (parsing_disabled == 0)