summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2008-10-15 12:06:44 +0200
committerKristofer Pettersson <kristofer.pettersson@sun.com>2008-10-15 12:06:44 +0200
commit7fa3897e8a424716f3676069f6485bf2db753c7f (patch)
tree0f0fa0c6e014054fed897a6354f8380302e2734b /sql/sql_parse.cc
parent5a3086221d79fc1b6b2c9c2b9bdb154759649063 (diff)
parentf985e787758e3081e18543b5490724d30296aebf (diff)
downloadmariadb-git-7fa3897e8a424716f3676069f6485bf2db753c7f.tar.gz
automerge
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 713aca9de47..005fdcac7f3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1690,8 +1690,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->set_time();
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= global_query_id;
- if (command != COM_STATISTICS && command != COM_PING)
+
+ switch( command ) {
+ /* Ignore these statements. */
+ case COM_STATISTICS:
+ case COM_PING:
+ break;
+ /* Only increase id on these statements but don't count them. */
+ case COM_STMT_PREPARE:
+ case COM_STMT_CLOSE:
+ case COM_STMT_RESET:
+ next_query_id();
+ break;
+ /* Increase id and count all other statements. */
+ default:
+ statistic_increment(thd->status_var.questions, &LOCK_status);
next_query_id();
+ }
+
thread_running++;
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
VOID(pthread_mutex_unlock(&LOCK_thread_count));
@@ -1896,6 +1912,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_length= length;
thd->query= next_packet;
+ /*
+ Count each statement from the client.
+ */
+ statistic_increment(thd->status_var.questions, &LOCK_status);
+
thd->query_id= next_query_id();
thd->set_time(); /* Reset the query start time. */
/* TODO: set thd->lex->sql_command to SQLCOM_END here */