Commit 4f4b786d authored by unknown's avatar unknown

Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1

into deer.(none):/home/hf/work/mysql-4.1.stmt


sql/sql_parse.cc:
  Auto merged
parents 867f1d28 759aabf7
...@@ -565,6 +565,7 @@ typedef struct st_mysql_methods ...@@ -565,6 +565,7 @@ typedef struct st_mysql_methods
MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt); MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt);
int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row); int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row);
void (STDCALL *free_embedded_thd)(MYSQL *mysql); void (STDCALL *free_embedded_thd)(MYSQL *mysql);
const char *(STDCALL *read_statistic)(MYSQL *mysql);
#endif #endif
} MYSQL_METHODS; } MYSQL_METHODS;
......
...@@ -57,3 +57,4 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, ...@@ -57,3 +57,4 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
int STDCALL cli_stmt_execute(MYSQL_STMT *stmt); int STDCALL cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt); MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt);
int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row); int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row);
const char * STDCALL cli_read_statistic(MYSQL *mysql);
...@@ -1102,12 +1102,8 @@ mysql_dump_debug_info(MYSQL *mysql) ...@@ -1102,12 +1102,8 @@ mysql_dump_debug_info(MYSQL *mysql)
DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0)); DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0));
} }
const char * STDCALL const char * STDCALL cli_read_statistic(MYSQL *mysql)
mysql_stat(MYSQL *mysql)
{ {
DBUG_ENTER("mysql_stat");
if (simple_command(mysql,COM_STATISTICS,0,0,0))
return mysql->net.last_error;
mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */ mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
if (!mysql->net.read_pos[0]) if (!mysql->net.read_pos[0])
{ {
...@@ -1116,7 +1112,16 @@ mysql_stat(MYSQL *mysql) ...@@ -1116,7 +1112,16 @@ mysql_stat(MYSQL *mysql)
strmov(mysql->net.last_error, ER(mysql->net.last_errno)); strmov(mysql->net.last_error, ER(mysql->net.last_errno));
return mysql->net.last_error; return mysql->net.last_error;
} }
DBUG_RETURN((char*) mysql->net.read_pos); return (char*) mysql->net.read_pos;
}
const char * STDCALL
mysql_stat(MYSQL *mysql)
{
DBUG_ENTER("mysql_stat");
if (simple_command(mysql,COM_STATISTICS,0,0,0))
return mysql->net.last_error;
DBUG_RETURN((*mysql->methods->read_statistic)(mysql));
} }
......
...@@ -217,9 +217,16 @@ static void STDCALL emb_free_embedded_thd(MYSQL *mysql) ...@@ -217,9 +217,16 @@ static void STDCALL emb_free_embedded_thd(MYSQL *mysql)
THD *thd= (THD*)mysql->thd; THD *thd= (THD*)mysql->thd;
if (thd->data) if (thd->data)
free_rows(thd->data); free_rows(thd->data);
thread_count--;
delete thd; delete thd;
} }
static const char * STDCALL emb_read_statistic(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
return thd->net.last_error;
}
MYSQL_METHODS embedded_methods= MYSQL_METHODS embedded_methods=
{ {
emb_mysql_read_query_result, emb_mysql_read_query_result,
...@@ -232,7 +239,8 @@ MYSQL_METHODS embedded_methods= ...@@ -232,7 +239,8 @@ MYSQL_METHODS embedded_methods=
emb_stmt_execute, emb_stmt_execute,
emb_read_binary_rows, emb_read_binary_rows,
emb_unbuffered_fetch, emb_unbuffered_fetch,
emb_free_embedded_thd emb_free_embedded_thd,
emb_read_statistic
}; };
C_MODE_END C_MODE_END
...@@ -431,6 +439,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db) ...@@ -431,6 +439,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
{ {
THD *thd = (THD *)mysql->thd; THD *thd = (THD *)mysql->thd;
thd->mysql= mysql; thd->mysql= mysql;
mysql->server_version= server_version;
} }
void *create_embedded_thd(int client_flag, char *db) void *create_embedded_thd(int client_flag, char *db)
...@@ -465,6 +474,7 @@ void *create_embedded_thd(int client_flag, char *db) ...@@ -465,6 +474,7 @@ void *create_embedded_thd(int client_flag, char *db)
thd->data= 0; thd->data= 0;
thread_count++;
return thd; return thd;
} }
......
...@@ -1410,7 +1410,8 @@ static MYSQL_METHODS client_methods= ...@@ -1410,7 +1410,8 @@ static MYSQL_METHODS client_methods=
cli_stmt_execute, cli_stmt_execute,
cli_read_binary_rows, cli_read_binary_rows,
cli_unbuffered_fetch, cli_unbuffered_fetch,
NULL NULL,
cli_read_statistic
#endif #endif
}; };
......
...@@ -1473,12 +1473,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1473,12 +1473,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
error=TRUE; error=TRUE;
break; break;
#endif #endif
#ifndef EMBEDDED_LIBRARY
case COM_STATISTICS: case COM_STATISTICS:
{ {
mysql_log.write(thd,command,NullS); mysql_log.write(thd,command,NullS);
statistic_increment(com_stat[SQLCOM_SHOW_STATUS],&LOCK_status); statistic_increment(com_stat[SQLCOM_SHOW_STATUS],&LOCK_status);
#ifndef EMBEDDED_LIBRARY
char buff[200]; char buff[200];
#else
char *buff= thd->net.last_error;
#endif
ulong uptime = (ulong) (thd->start_time - start_time); ulong uptime = (ulong) (thd->start_time - start_time);
sprintf((char*) buff, sprintf((char*) buff,
"Uptime: %ld Threads: %d Questions: %lu Slow queries: %ld Opens: %ld Flush tables: %ld Open tables: %u Queries per second avg: %.3f", "Uptime: %ld Threads: %d Questions: %lu Slow queries: %ld Opens: %ld Flush tables: %ld Open tables: %u Queries per second avg: %.3f",
...@@ -1491,12 +1494,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1491,12 +1494,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK", sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK",
(sf_malloc_cur_memory+1023L)/1024L, (sf_malloc_cur_memory+1023L)/1024L,
(sf_malloc_max_memory+1023L)/1024L); (sf_malloc_max_memory+1023L)/1024L);
#endif #endif
#ifndef EMBEDDED_LIBRARY
VOID(my_net_write(net, buff,(uint) strlen(buff))); VOID(my_net_write(net, buff,(uint) strlen(buff)));
VOID(net_flush(net)); VOID(net_flush(net));
#endif
break; break;
} }
#endif
case COM_PING: case COM_PING:
statistic_increment(com_other,&LOCK_status); statistic_increment(com_other,&LOCK_status);
send_ok(thd); // Tell client we are alive send_ok(thd); // Tell client we are alive
......
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