mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SCRUM
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:
@ -201,6 +201,7 @@ enum mysql_rpl_type
|
||||
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
|
||||
};
|
||||
|
||||
struct st_mysql_methods;
|
||||
|
||||
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
|
||||
|
||||
@ -247,11 +248,13 @@ typedef struct st_mysql
|
||||
struct st_mysql* last_used_con;
|
||||
|
||||
LIST *stmts; /* list of all statements */
|
||||
const struct st_mysql_methods *methods;
|
||||
#if !defined(CHECK_EMBEDDED_DIFFERENCES)
|
||||
struct st_mysql_res *result;
|
||||
void *thd;
|
||||
unsigned int last_errno;
|
||||
char *last_error;
|
||||
char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */
|
||||
#endif
|
||||
} MYSQL;
|
||||
|
||||
@ -378,12 +381,10 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
|
||||
unsigned int port,
|
||||
const char *unix_socket,
|
||||
unsigned long clientflag);
|
||||
void STDCALL mysql_close(MYSQL *sock);
|
||||
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
|
||||
int STDCALL mysql_query(MYSQL *mysql, const char *q);
|
||||
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned long length);
|
||||
my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
|
||||
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
|
||||
unsigned long length);
|
||||
/* perform query on master */
|
||||
@ -444,8 +445,6 @@ MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
|
||||
MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
|
||||
const char *wild);
|
||||
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
|
||||
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
|
||||
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
|
||||
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
|
||||
const char *arg);
|
||||
void STDCALL mysql_free_result(MYSQL_RES *result);
|
||||
@ -566,6 +565,25 @@ typedef struct st_mysql_stmt
|
||||
} MYSQL_STMT;
|
||||
|
||||
|
||||
#define mysql_close(sock) (*(sock)->methods->close)(sock)
|
||||
#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql)
|
||||
#define mysql_store_result(mysql) (*(mysql)->methods->store_result)(mysql)
|
||||
#define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql)
|
||||
|
||||
typedef struct st_mysql_methods
|
||||
{
|
||||
void STDCALL (*close)(MYSQL *sock);
|
||||
my_bool STDCALL (*read_query_result)(MYSQL *mysql);
|
||||
my_bool STDCALL (*advanced_command)(MYSQL *mysql,
|
||||
enum enum_server_command command,
|
||||
const char *header,
|
||||
ulong header_length,
|
||||
const char *arg,
|
||||
ulong arg_length, my_bool skip_check);
|
||||
MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql);
|
||||
MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql);
|
||||
} MYSQL_METHODS;
|
||||
|
||||
MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
|
||||
unsigned long length);
|
||||
int STDCALL mysql_execute(MYSQL_STMT * stmt);
|
||||
|
Reference in New Issue
Block a user