ha_innobase.cc:

  Cleanup of latest rewrite of innobase_mysql_print_thd; from now on changing this code is forbidden unless a written permission is received from Heikki 3 days in advance
parent 48619398
...@@ -253,7 +253,7 @@ convert_error_code_to_mysql( ...@@ -253,7 +253,7 @@ convert_error_code_to_mysql(
extern "C" { extern "C" {
/***************************************************************** /*****************************************************************
Prints info of a THD object (== user session thread) to the Prints info of a THD object (== user session thread) to the
standard output. NOTE that mysql/innobase/trx/trx0trx.c must contain standard output. NOTE that /mysql/innobase/trx/trx0trx.c must contain
the prototype for this function! */ the prototype for this function! */
void void
...@@ -264,46 +264,55 @@ innobase_mysql_print_thd( ...@@ -264,46 +264,55 @@ innobase_mysql_print_thd(
void* input_thd)/* in: pointer to a MySQL THD object */ void* input_thd)/* in: pointer to a MySQL THD object */
{ {
THD* thd; THD* thd;
char* old_buf = buf;
thd = (THD*) input_thd; thd = (THD*) input_thd;
/* We can't use value of sprintf() as this is not portable */ /* We cannot use the return value of normal sprintf() as this is
buf+= my_sprintf(buf, not portable to some old non-Posix Unixes, e.g., some old SCO
(buf, "MySQL thread id %lu", Unixes */
thd->thread_id));
if (thd->host) buf += my_sprintf(buf,
{ (buf, "MySQL thread id %lu, query id %lu",
*buf++=' '; thd->thread_id, thd->query_id));
buf=strnmov(buf, thd->host, 30); if (thd->host) {
*buf = ' ';
buf++;
buf = strnmov(buf, thd->host, 30);
} }
if (thd->ip) if (thd->ip) {
{ *buf = ' ';
*buf++=' '; buf++;
buf=strnmov(buf, thd->ip, 20); buf=strnmov(buf, thd->ip, 20);
} }
if (thd->user) if (thd->user) {
{ *buf = ' ';
*buf++=' '; buf++;
buf=strnmov(buf, thd->user, 20); buf=strnmov(buf, thd->user, 20);
} }
if (thd->proc_info) if (thd->proc_info) {
{ *buf = ' ';
*buf++=' '; buf++;
buf=strnmov(buf, thd->proc_info, 50); buf=strnmov(buf, thd->proc_info, 50);
} }
if (thd->query) if (thd->query) {
{ *buf = '\n';
*buf++='\n'; buf++;
buf=strnmov(buf, thd->query, 150); buf=strnmov(buf, thd->query, 150);
} }
buf[0]='\n';
buf[1]=0;
ut_a(strlen(buf) < 400); buf[0] = '\n';
buf[1] = '\0'; /* Note that we must put a null character here to end
the printed string */
/* We test the printed length did not overrun the buffer length of
400 bytes */
ut_a(strlen(old_buf) < 400);
} }
} }
...@@ -2470,6 +2479,7 @@ ha_innobase::rnd_pos( ...@@ -2470,6 +2479,7 @@ ha_innobase::rnd_pos(
Stores a reference to the current row to 'ref' field of the handle. Note Stores a reference to the current row to 'ref' field of the handle. Note
that in the case where we have generated the clustered index for the that in the case where we have generated the clustered index for the
table, the function parameter is illogical: we MUST ASSUME that 'record' table, the function parameter is illogical: we MUST ASSUME that 'record'
is the current 'position' of the handle, because if row ref is actually
the row id internally generated in InnoDB, then 'record' does not contain the row id internally generated in InnoDB, then 'record' does not contain
it. We just guess that the row id must be for the record where the handle it. We just guess that the row id must be for the record where the handle
was positioned the last time. */ was positioned the last time. */
......
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