Commit 389d730d authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

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
Loading
Loading
Loading
Loading
+41 −31
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ convert_error_code_to_mysql(
extern "C" {
/*****************************************************************
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! */

void
@@ -264,46 +264,55 @@ innobase_mysql_print_thd(
        void*   input_thd)/* in: pointer to a MySQL THD object */
{
  	THD*    thd;
	char*   old_buf = buf;

        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
	not portable to some old non-Posix Unixes, e.g., some old SCO
	Unixes */

  	buf += my_sprintf(buf,
			 (buf, "MySQL thread id %lu",
			  thd->thread_id));
    	if (thd->host)
	{
	  *buf++=' ';
			 (buf, "MySQL thread id %lu, query id %lu",
			  thd->thread_id, thd->query_id));
    	if (thd->host) {
	        *buf = ' ';
		buf++;
	        buf = strnmov(buf, thd->host, 30);
  	}

  	if (thd->ip)
	{
	  *buf++=' ';
  	if (thd->ip) {
	        *buf = ' ';
		buf++;
	        buf=strnmov(buf, thd->ip, 20);
  	}

  	if (thd->user)
	{
	  *buf++=' ';
  	if (thd->user) {
	        *buf = ' ';
		buf++;
	        buf=strnmov(buf, thd->user, 20);
  	}

  	if (thd->proc_info)
	{
	  *buf++=' ';
  	if (thd->proc_info) {
	        *buf = ' ';
		buf++;
	        buf=strnmov(buf, thd->proc_info, 50);
  	}

  	if (thd->query)
	{
	  *buf++='\n';
  	if (thd->query) {
	        *buf = '\n';
		buf++;
	        buf=strnmov(buf, thd->query, 150);
  	}  

	buf[0] = '\n';
	buf[1]=0;
	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(buf) < 400);
 	ut_a(strlen(old_buf) < 400);
}
}

@@ -2470,6 +2479,7 @@ ha_innobase::rnd_pos(
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
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
it. We just guess that the row id must be for the record where the handle
was positioned the last time. */