1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00
client capabilities included into libmysqld
some API methods became "virtual"
lots of duplicated code removed

IMHO all the above made library's code way more pleasant to look at, didn't it?


BitKeeper/deleted/.del-lib_vio.c~d779731a1e391220:
  Delete: libmysqld/lib_vio.c
BitKeeper/etc/ignore:
  Added libmysqld/client.c libmysqld/client_settings.h libmysqld/libmysql.c libmysqld/pack.c to the ignore list
client/mysqltest.c:
  we don't need this now
include/mysql.h:
  MYSQL and related structures unified
  four methods made "virtual"
  relative wrappers added
include/mysql_com.h:
  todo added
include/mysql_embed.h:
  now we include implementations of Vio structure in libmysqld
include/sql_common.h:
  declarations changed
include/violite.h:
  implementation of Vio included in libmysqld
libmysql/client_settings.h:
  changes to make this working with both client and embedded
libmysql/libmysql.c:
  global variables and my_net_local_init moved to sql-common/pack.c
libmysqld/Makefile.am:
  libmysql.c, client.c, pack.c symlinked and added to sources
  lib_vio.c removed
libmysqld/examples/Makefile.am:
  now we need CLIENT_LIBS here
libmysqld/lib_sql.cc:
  code duplications removed
  emb_advanced_command was made from simple_command
libmysqld/libmysqld.c:
  duplicated code removed
sql-common/client.c:
  code trimmed with new model of calling
sql-common/pack.c:
  some code moved here from libmysql.c and protocol.cc
sql/client_settings.h:
  we don't need mysql_use_result for mini_client
sql/net_serv.cc:
  file included in embedded server
sql/protocol.cc:
  code moved to sql-common/pack.c
This commit is contained in:
unknown
2003-06-17 21:32:31 +05:00
parent 5551e0df2a
commit ef726bbff3
19 changed files with 217 additions and 1568 deletions

View File

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
static my_bool mysql_client_init=0;
extern uint mysql_port;
extern my_string mysql_unix_port;
@ -35,7 +34,7 @@ char *shared_memory_base_name=0;
const char *def_shared_memory_base_name=default_shared_memory_base_name;
#endif
static my_bool org_my_init_done=0;
extern my_bool org_my_init_done;
sig_handler pipe_sig_handler(int sig __attribute__((unused)));
my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list);
@ -56,3 +55,8 @@ my_bool send_file_to_server(MYSQL *mysql, const char *filename);
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
#endif
#define CLI_MYSQL_USE_RESULT cli_mysql_use_result
MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql);

View File

@ -58,13 +58,20 @@
#endif
#include <sql_common.h>
#include "client_settings.h"
#ifdef EMBEDDED_LIBRARY
#ifdef net_flush
#undef net_flush
#endif
my_bool net_flush(NET *net);
#endif
uint mysql_port=0;
my_string mysql_unix_port=0;
ulong net_buffer_length=8192;
ulong max_allowed_packet= 1024L*1024L*1024L;
ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG \
| CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS \
@ -101,8 +108,9 @@ sig_handler pipe_sig_handler(int sig);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const char *from, ulong length);
my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list);
static my_bool org_my_init_done=0;
my_bool org_my_init_done=0;
#ifndef EMBEDDED_LIBRARY
int STDCALL mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)),
char **groups __attribute__((unused)))
@ -119,6 +127,7 @@ void STDCALL mysql_server_end()
else
mysql_thread_end();
}
#endif /*EMBEDDED_LIBRARY*/
my_bool STDCALL mysql_thread_init()
{
@ -140,17 +149,6 @@ void STDCALL mysql_thread_end()
Let the user specify that we don't want SIGPIPE; This doesn't however work
with threaded applications as we can have multiple read in progress.
*/
#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0
#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler)
#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
#else
#define init_sigpipe_variables
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
#endif
static MYSQL* spawn_init(MYSQL* parent, const char* host,
unsigned int port,
const char* user,
@ -846,8 +844,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
have to wait for the client (and will not wait more than 30 sec/packet).
**************************************************************************/
MYSQL_RES * STDCALL
mysql_use_result(MYSQL *mysql)
MYSQL_RES * STDCALL CLI_MYSQL_USE_RESULT(MYSQL *mysql)
{
MYSQL_RES *result;
DBUG_ENTER("mysql_use_result");
@ -1253,19 +1250,6 @@ uint STDCALL mysql_thread_safe(void)
Some support functions
****************************************************************************/
/*
Functions called my my_net_init() to set some application specific variables
*/
void my_net_local_init(NET *net)
{
net->max_packet= (uint) net_buffer_length;
net->read_timeout= (uint) net_read_timeout;
net->write_timeout=(uint) net_write_timeout;
net->retry_count= 1;
net->max_packet_size= max(net_buffer_length, max_allowed_packet);
}
/*
Add escape characters to a string (blob?) to make it suitable for a insert
to should at least have place for length*2+1 chars
@ -1999,8 +1983,9 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length)
mysql->last_used_con= mysql;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
if (advanced_command(mysql, COM_EXECUTE, buff, MYSQL_STMT_HEADER, packet,
length, 1) ||
if ((*mysql->methods->advanced_command)(mysql, COM_EXECUTE, buff,
MYSQL_STMT_HEADER, packet,
length, 1) ||
mysql_read_query_result(mysql))
{
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
@ -2292,8 +2277,9 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
Note that we don't get any ok packet from the server in this case
This is intentional to save bandwidth.
*/
if (advanced_command(mysql, COM_LONG_DATA, extra_data,
MYSQL_LONG_DATA_HEADER, data, length, 1))
if ((*mysql->methods->advanced_command)(mysql, COM_LONG_DATA, extra_data,
MYSQL_LONG_DATA_HEADER, data,
length, 1))
{
set_stmt_errmsg(stmt, mysql->net.last_error,
mysql->net.last_errno, mysql->net.sqlstate);