Commit 542f003c authored by unknown's avatar unknown

Merge myvenu.com:/home/venu/bk/src-4.1

into myvenu.com:/home/venu/work/sql/dev-4.1


sql/sql_parse.cc:
  Auto merged
parents 65a4b622 ae4a9ea8
...@@ -1225,6 +1225,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1225,6 +1225,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
} }
thd->query_length= length; thd->query_length= length;
thd->query= packet; thd->query= packet;
thd->net.last_error[0]= '\0';
VOID(pthread_mutex_lock(&LOCK_thread_count)); VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= query_id++; thd->query_id= query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count)); VOID(pthread_mutex_unlock(&LOCK_thread_count));
......
...@@ -80,10 +80,10 @@ static void print_error(const char *msg) ...@@ -80,10 +80,10 @@ static void print_error(const char *msg)
if (mysql) if (mysql)
{ {
if (mysql->server_version) if (mysql->server_version)
fprintf(stderr,"\n [MySQL-%s]",mysql->server_version); fprintf(stdout,"\n [MySQL-%s]",mysql->server_version);
else else
fprintf(stderr,"\n [MySQL]"); fprintf(stdout,"\n [MySQL]");
fprintf(stderr,"[%d] %s\n",mysql_errno(mysql),mysql_error(mysql)); fprintf(stdout,"[%d] %s\n",mysql_errno(mysql),mysql_error(mysql));
} }
else if (msg) fprintf(stderr, " [MySQL] %s\n", msg); else if (msg) fprintf(stderr, " [MySQL] %s\n", msg);
} }
...@@ -93,11 +93,11 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg) ...@@ -93,11 +93,11 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
if (stmt) if (stmt)
{ {
if (stmt->mysql && stmt->mysql->server_version) if (stmt->mysql && stmt->mysql->server_version)
fprintf(stderr,"\n [MySQL-%s]",stmt->mysql->server_version); fprintf(stdout,"\n [MySQL-%s]",stmt->mysql->server_version);
else else
fprintf(stderr,"\n [MySQL]"); fprintf(stdout,"\n [MySQL]");
fprintf(stderr,"[%d] %s\n",mysql_stmt_errno(stmt), fprintf(stdout,"[%d] %s\n",mysql_stmt_errno(stmt),
mysql_stmt_error(stmt)); mysql_stmt_error(stmt));
} }
else if (msg) fprintf(stderr, " [MySQL] %s\n", msg); else if (msg) fprintf(stderr, " [MySQL] %s\n", msg);
...@@ -4425,6 +4425,9 @@ static void test_multi_query() ...@@ -4425,6 +4425,9 @@ static void test_multi_query()
int rc; int rc;
const char *query= "DROP TABLE IF EXISTS test_multi_tab;\ const char *query= "DROP TABLE IF EXISTS test_multi_tab;\
CREATE TABLE test_multi_tab(id int,name char(20));\
INSERT INTO test_multi_tab(xxxx) VALUES(10);\
UPDATE test_multi_tab SET id=10 WHERE unkown_col=10;\
CREATE TABLE test_multi_tab(id int,name char(20));\ CREATE TABLE test_multi_tab(id int,name char(20));\
INSERT INTO test_multi_tab(id) VALUES(10),(20);\ INSERT INTO test_multi_tab(id) VALUES(10),(20);\
INSERT INTO test_multi_tab VALUES(20,'insert;comma');\ INSERT INTO test_multi_tab VALUES(20,'insert;comma');\
...@@ -4434,9 +4437,12 @@ static void test_multi_query() ...@@ -4434,9 +4437,12 @@ static void test_multi_query()
DELETE FROM test_multi_tab WHERE name='new;name';\ DELETE FROM test_multi_tab WHERE name='new;name';\
SELECT * FROM test_multi_tab;\ SELECT * FROM test_multi_tab;\
DELETE FROM test_multi_tab WHERE id=10;\ DELETE FROM test_multi_tab WHERE id=10;\
SELECT * FROM test_multi_tab"; SELECT * FROM test_multi_tab;\
uint count, rows[10]={0,2,1,3,0,2,2,1,1,0}; DROP TABLE test_multi_tab;\
DROP TABLE test_multi_tab;\
DROP TABLE IF EXISTS test_multi_tab";
uint count, rows[16]={0,1054,1054,1050,2,1,3,1054,2,2,1,1,0,0,1051,0}, exp_value;
myheader("test_multi_query"); myheader("test_multi_query");
rc = mysql_query(mysql, query); /* syntax error */ rc = mysql_query(mysql, query); /* syntax error */
...@@ -4463,19 +4469,25 @@ static void test_multi_query() ...@@ -4463,19 +4469,25 @@ static void test_multi_query()
rc = mysql_query(mysql, query); rc = mysql_query(mysql, query);
myquery(rc); myquery(rc);
count= 0; count= exp_value= 0;
while (mysql_more_results(mysql) && count < sizeof(rows)/sizeof(uint)) while (mysql_more_results(mysql) && count < array_elements(rows))
{ {
fprintf(stdout,"\n query %d", count); fprintf(stdout,"\n Query %d: ", count);
if ((rc= mysql_next_result(mysql))) if ((rc= mysql_next_result(mysql)))
fprintf(stdout, "\n\t failed(%s)", mysql_error(mysql)); {
exp_value= mysql_errno(mysql);
fprintf(stdout, "ERROR %d: %s", exp_value, mysql_error(mysql));
}
else else
fprintf(stdout,"\n\t affected rows: %lld", mysql_affected_rows(mysql)); {
if ((result= mysql_store_result(mysql))) if ((result= mysql_store_result(mysql)))
my_process_result_set(result); my_process_result_set(result);
if (!rc) else
myassert(rows[count] == (uint)mysql_affected_rows(mysql)); fprintf(stdout,"OK, %d row(s) affected, %d warning(s)", exp_value,
count++; mysql_warning_count(mysql));
exp_value= (uint) mysql_affected_rows(mysql);
}
myassert(rows[count++] == exp_value);
} }
mysql= org_mysql; mysql= org_mysql;
} }
...@@ -4932,7 +4944,7 @@ static void test_bind_date_conv(uint row_count) ...@@ -4932,7 +4944,7 @@ static void test_bind_date_conv(uint row_count)
for (i= 0; i < array_elements(bind); i++) for (i= 0; i < array_elements(bind); i++)
{ {
fprintf(stdout, "\n"); fprintf(stdout, "\n");
fprintf(stdout,"time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu", fprintf(stdout," time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu",
i, tm[i].year, tm[i].month, tm[i].day, i, tm[i].year, tm[i].month, tm[i].day,
tm[i].hour, tm[i].minute, tm[i].second, tm[i].hour, tm[i].minute, tm[i].second,
tm[i].second_part); tm[i].second_part);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment