mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
SCRUM
Including client code into embedded library fixes
This commit is contained in:
parent
11de0b35f7
commit
cbff55a59d
4 changed files with 18 additions and 24 deletions
|
@ -3388,7 +3388,7 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
|
||||||
|
|
||||||
mysql= stmt->mysql->last_used_con;
|
mysql= stmt->mysql->last_used_con;
|
||||||
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
|
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
|
||||||
if (advanced_command(mysql, COM_RESET_STMT,buff,MYSQL_STMT_HEADER,0,0,1))
|
if ((*mysql->methods->advanced_command)(mysql, COM_RESET_STMT,buff,MYSQL_STMT_HEADER,0,0,1))
|
||||||
{
|
{
|
||||||
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
|
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
|
||||||
mysql->net.sqlstate);
|
mysql->net.sqlstate);
|
||||||
|
|
|
@ -38,6 +38,7 @@ static char inited, org_my_init_done;
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include "errmsg.h"
|
#include "errmsg.h"
|
||||||
|
#include <sql_common.h>
|
||||||
|
|
||||||
static int check_connections1(THD * thd);
|
static int check_connections1(THD * thd);
|
||||||
static int check_connections2(THD * thd);
|
static int check_connections2(THD * thd);
|
||||||
|
@ -66,8 +67,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||||
/* Clear result variables */
|
/* Clear result variables */
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
mysql->affected_rows= ~(my_ulonglong) 0;
|
mysql->affected_rows= ~(my_ulonglong) 0;
|
||||||
|
mysql->field_count= 0;
|
||||||
|
|
||||||
thd->store_globals(); // Fix if more than one connect
|
thd->store_globals(); // Fix if more than one connect
|
||||||
|
free_old_query(mysql);
|
||||||
result= dispatch_command(command, thd, (char *) arg, arg_length + 1);
|
result= dispatch_command(command, thd, (char *) arg, arg_length + 1);
|
||||||
|
|
||||||
if (!skip_check)
|
if (!skip_check)
|
||||||
|
|
|
@ -72,6 +72,8 @@ cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
||||||
const char *passwd, const char *db,
|
const char *passwd, const char *db,
|
||||||
uint port, const char *unix_socket,ulong client_flag);
|
uint port, const char *unix_socket,ulong client_flag);
|
||||||
|
|
||||||
|
void STDCALL cli_mysql_close(MYSQL *mysql);
|
||||||
|
|
||||||
#ifdef HAVE_GETPWUID
|
#ifdef HAVE_GETPWUID
|
||||||
struct passwd *getpwuid(uid_t);
|
struct passwd *getpwuid(uid_t);
|
||||||
char* getlogin(void);
|
char* getlogin(void);
|
||||||
|
@ -166,14 +168,12 @@ static inline int mysql_init_charset(MYSQL *mysql)
|
||||||
** before calling mysql_real_connect !
|
** before calling mysql_real_connect !
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void STDCALL emb_mysql_close(MYSQL *mysql);
|
|
||||||
static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql);
|
static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql);
|
||||||
static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql);
|
static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql);
|
||||||
static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql);
|
static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql);
|
||||||
|
|
||||||
static MYSQL_METHODS embedded_methods=
|
static MYSQL_METHODS embedded_methods=
|
||||||
{
|
{
|
||||||
emb_mysql_close,
|
|
||||||
emb_mysql_read_query_result,
|
emb_mysql_read_query_result,
|
||||||
emb_advanced_command,
|
emb_advanced_command,
|
||||||
emb_mysql_store_result,
|
emb_mysql_store_result,
|
||||||
|
@ -276,9 +276,15 @@ error:
|
||||||
** If handle is alloced by mysql connect free it.
|
** If handle is alloced by mysql connect free it.
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
static void STDCALL emb_mysql_close(MYSQL *mysql)
|
void STDCALL mysql_close(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("mysql_close");
|
DBUG_ENTER("mysql_close");
|
||||||
|
if (mysql->methods != &embedded_methods)
|
||||||
|
{
|
||||||
|
cli_mysql_close(mysql);
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
if (mysql) /* Some simple safety */
|
if (mysql) /* Some simple safety */
|
||||||
{
|
{
|
||||||
my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
|
|
@ -48,12 +48,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect
|
#define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect
|
||||||
|
#define CLI_MYSQL_CLOSE cli_mysql_close
|
||||||
|
|
||||||
#undef net_flush
|
#undef net_flush
|
||||||
my_bool net_flush(NET *net);
|
my_bool net_flush(NET *net);
|
||||||
|
|
||||||
#else /*EMBEDDED_LIBRARY*/
|
#else /*EMBEDDED_LIBRARY*/
|
||||||
#define CLI_MYSQL_REAL_CONNECT mysql_real_connect
|
#define CLI_MYSQL_REAL_CONNECT mysql_real_connect
|
||||||
|
#define CLI_MYSQL_CLOSE mysql_close
|
||||||
#endif /*EMBEDDED_LIBRARY*/
|
#endif /*EMBEDDED_LIBRARY*/
|
||||||
|
|
||||||
#if !defined(MYSQL_SERVER) && (defined(__WIN__) || defined(_WIN32) || defined(_WIN64))
|
#if !defined(MYSQL_SERVER) && (defined(__WIN__) || defined(_WIN32) || defined(_WIN64))
|
||||||
|
@ -965,26 +967,11 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
||||||
|
|
||||||
void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count)
|
void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count)
|
||||||
{
|
{
|
||||||
ulong *prev_length;
|
|
||||||
byte *start=0;
|
|
||||||
MYSQL_ROW end;
|
MYSQL_ROW end;
|
||||||
|
for (end=column + field_count; column != end ; column++, to++)
|
||||||
prev_length=0; /* Keep gcc happy */
|
*to= *column ? strlen(*column) : 0;
|
||||||
for (end=column + field_count + 1 ; column != end ; column++, to++)
|
|
||||||
{
|
|
||||||
if (!*column)
|
|
||||||
{
|
|
||||||
*to= 0; /* Null */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (start) /* Found end of prev string */
|
|
||||||
*prev_length= (ulong) (*column-start-1);
|
|
||||||
start= *column;
|
|
||||||
prev_length= to;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Change field rows to field structs
|
Change field rows to field structs
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
@ -1422,14 +1409,12 @@ error:
|
||||||
before calling mysql_real_connect !
|
before calling mysql_real_connect !
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void STDCALL cli_mysql_close(MYSQL *mysql);
|
|
||||||
static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql);
|
static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql);
|
||||||
static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql);
|
static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql);
|
||||||
static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql);
|
static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql);
|
||||||
|
|
||||||
static MYSQL_METHODS client_methods=
|
static MYSQL_METHODS client_methods=
|
||||||
{
|
{
|
||||||
cli_mysql_close,
|
|
||||||
cli_mysql_read_query_result,
|
cli_mysql_read_query_result,
|
||||||
cli_advanced_command,
|
cli_advanced_command,
|
||||||
cli_mysql_store_result,
|
cli_mysql_store_result,
|
||||||
|
@ -2140,7 +2125,7 @@ static void mysql_close_free(MYSQL *mysql)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void STDCALL cli_mysql_close(MYSQL *mysql)
|
void STDCALL CLI_MYSQL_CLOSE(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("mysql_close");
|
DBUG_ENTER("mysql_close");
|
||||||
if (mysql) /* Some simple safety */
|
if (mysql) /* Some simple safety */
|
||||||
|
|
Loading…
Add table
Reference in a new issue