mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Some code improvements
libmysqld/lib_sql.cc: embedded_send_row function trimmed libmysqld/libmysqld.c: code trimming process sql/ha_myisam.cc: SEND_ROW simplified sql/mysql_priv.h: SEND_ROW simplified sql/mysqld.cc: main() code trimming sql/sql_handler.cc: SEND_ROW macro simplified sql/sql_show.cc: SEND_ROW macro simplified sql/sql_table.cc: SEND_ROW macro simplified
This commit is contained in:
parent
a62ee2202f
commit
cda34818c1
8 changed files with 514 additions and 51 deletions
|
|
@ -23,6 +23,11 @@
|
|||
#define mysql_unix_port mysql_inix_port1
|
||||
#define mysql_port mysql_port1
|
||||
|
||||
static int fake_argc= 1;
|
||||
static char *fake_argv[]= {(char *)"", 0};
|
||||
static const char *fake_groups[] = { "server", "embedded", 0 };
|
||||
static char inited, org_my_init_done;
|
||||
|
||||
#if defined (__WIN__)
|
||||
#include "../sql/mysqld.cpp"
|
||||
#else
|
||||
|
|
@ -302,9 +307,9 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
|
|||
extern "C"
|
||||
{
|
||||
|
||||
static my_bool inited, org_my_init_done;
|
||||
ulong max_allowed_packet, net_buffer_length;
|
||||
|
||||
|
||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
||||
{
|
||||
char glob_hostname[FN_REFLEN];
|
||||
|
|
@ -587,7 +592,6 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void STDCALL mysql_server_end()
|
||||
{
|
||||
clean_up(0);
|
||||
|
|
@ -1009,14 +1013,12 @@ int embedded_send_row(THD *thd, int n_fields, char *data, int data_len)
|
|||
DBUG_ENTER("embedded_send_row");
|
||||
|
||||
result->rows++;
|
||||
if (!(cur= (MYSQL_ROWS *)alloc_root(alloc, sizeof(MYSQL_ROWS))) ||
|
||||
!(cur->data=
|
||||
(MYSQL_ROW)alloc_root(alloc,
|
||||
(n_fields + 1) * sizeof(char *) + data_len)))
|
||||
if (!(cur= (MYSQL_ROWS *)alloc_root(alloc, sizeof(MYSQL_ROWS) + (n_fields + 1) * sizeof(char *) + data_len)))
|
||||
{
|
||||
my_error(ER_OUT_OF_RESOURCES,MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
cur->data= (MYSQL_ROW)((char *)cur) + sizeof(MYSQL_ROWS);
|
||||
|
||||
*result->prev_ptr= cur;
|
||||
result->prev_ptr= &cur->next;
|
||||
|
|
@ -1024,7 +1026,7 @@ int embedded_send_row(THD *thd, int n_fields, char *data, int data_len)
|
|||
cp= (uchar *)data;
|
||||
end_field= cur->data + n_fields;
|
||||
|
||||
for (cur_field=cur->data; cur_field<end_field; ++cur_field, ++mysql_fields)
|
||||
for (cur_field=cur->data; cur_field<end_field; cur_field++, mysql_fields++)
|
||||
{
|
||||
if ((len= (ulong) net_field_length(&cp)) == NULL_LENGTH)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -723,6 +723,7 @@ static void mysql_once_init()
|
|||
if (!mysql_client_init)
|
||||
{
|
||||
mysql_client_init=1;
|
||||
|
||||
my_init(); /* Will init threads */
|
||||
init_client_errs();
|
||||
mysql_port = MYSQL_PORT;
|
||||
|
|
@ -1131,24 +1132,6 @@ my_bool my_connect(my_socket s, const struct sockaddr *name, uint namelen,
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
int STDCALL
|
||||
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
|
||||
{
|
||||
if (mysql->options.separate_thread)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
mysql->result= NULL;
|
||||
|
||||
free_old_query(mysql);
|
||||
|
||||
return simple_command(mysql, COM_QUERY, query, length, 1);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
||||
{
|
||||
|
|
@ -1250,12 +1233,6 @@ mysql_store_result(MYSQL *mysql)
|
|||
return result;
|
||||
}
|
||||
|
||||
void _0dummy()
|
||||
{
|
||||
send_file_to_server(NULL, NULL);
|
||||
net_field_length_ll(NULL);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
** Alloc struct for use with unbuffered reads. Data is fetched by domand
|
||||
** when calling to mysql_fetch_row.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue