You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
10.2-integration
readded api functions - mysql_debug (dummy) - mysql_get_parameters added low level api functions - mysql_net_field_length - mysql_net_read
This commit is contained in:
@@ -371,6 +371,13 @@ typedef struct st_mysql_res {
|
||||
my_bool is_ps;
|
||||
} MYSQL_RES;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long *p_max_allowed_packet;
|
||||
unsigned long *p_net_buffer_length;
|
||||
void *extension;
|
||||
} MYSQL_PARAMETERS;
|
||||
|
||||
#ifndef _mysql_time_h_
|
||||
enum enum_mysql_timestamp_type
|
||||
{
|
||||
@@ -571,6 +578,12 @@ unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
|
||||
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
|
||||
my_bool STDCALL mariadb_reconnect(MYSQL *mysql);
|
||||
int STDCALL mariadb_cancel(MYSQL *mysql);
|
||||
void STDCALL mysql_debug(const char *debug __attribute__((unused)));
|
||||
ulong STDCALL mysql_net_read_packet(MYSQL *mysql);
|
||||
ulong STDCALL mysql_net_field_length(uchar **packet);
|
||||
my_bool STDCALL mysql_embedded();
|
||||
void STDCALL mysql_debug(const char *debug __attribute__((unused)));
|
||||
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
|
||||
|
||||
/* Async API */
|
||||
int STDCALL mysql_close_start(MYSQL *sock);
|
||||
|
@@ -28,7 +28,9 @@ SET(MARIADB_LIB_SYMBOLS
|
||||
mysql_close
|
||||
mysql_commit
|
||||
mysql_data_seek
|
||||
mysql_debug
|
||||
mysql_dump_debug_info
|
||||
mysql_embedded
|
||||
mysql_eof
|
||||
mysql_errno
|
||||
mysql_error
|
||||
@@ -50,6 +52,7 @@ SET(MARIADB_LIB_SYMBOLS
|
||||
mysql_get_host_info
|
||||
mysql_get_option
|
||||
mysql_get_optionv
|
||||
mysql_get_parameters
|
||||
mysql_get_proto_info
|
||||
mysql_get_server_info
|
||||
mysql_get_server_name
|
||||
@@ -70,6 +73,8 @@ SET(MARIADB_LIB_SYMBOLS
|
||||
mysql_load_plugin
|
||||
mysql_load_plugin_v
|
||||
mysql_more_results
|
||||
mysql_net_field_length
|
||||
mysql_net_read_packet
|
||||
mysql_next_result
|
||||
mysql_num_fields
|
||||
mysql_num_rows
|
||||
|
@@ -77,6 +77,7 @@
|
||||
extern ulong max_allowed_packet; /* net.c */
|
||||
extern ulong net_buffer_length; /* net.c */
|
||||
|
||||
static MYSQL_PARAMETERS mariadb_internal_parameters= {&max_allowed_packet, &net_buffer_length, 0};
|
||||
static my_bool mysql_client_init=0;
|
||||
static void mysql_close_options(MYSQL *mysql);
|
||||
extern my_bool ma_init_done;
|
||||
@@ -3827,6 +3828,42 @@ int STDCALL mariadb_cancel(MYSQL *mysql)
|
||||
return pvio->methods->shutdown(pvio);
|
||||
}
|
||||
}
|
||||
|
||||
/* compatibility functions for MariaDB */
|
||||
void STDCALL
|
||||
mysql_debug(const char *debug __attribute__((unused)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
mysql_net_ functions - low-level API to MySQL protocol
|
||||
*********************************************************************/
|
||||
ulong STDCALL mysql_net_read_packet(MYSQL *mysql)
|
||||
{
|
||||
return ma_net_safe_read(mysql);
|
||||
}
|
||||
|
||||
ulong STDCALL mysql_net_field_length(uchar **packet)
|
||||
{
|
||||
return net_field_length(packet);
|
||||
}
|
||||
|
||||
my_bool STDCALL mysql_embedded(void)
|
||||
{
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
MYSQL_PARAMETERS *STDCALL
|
||||
mysql_get_parameters(void)
|
||||
{
|
||||
return &mariadb_internal_parameters;
|
||||
}
|
||||
|
||||
#undef STDCALL
|
||||
/* API functions for usage in dynamic plugins */
|
||||
struct st_mariadb_api MARIADB_API=
|
||||
|
@@ -267,9 +267,9 @@ static int stmt_cursor_fetch(MYSQL_STMT *stmt, uchar **row)
|
||||
/* do we have some prefetched rows available ? */
|
||||
if (stmt->result_cursor)
|
||||
return(stmt_buffered_fetch(stmt, row));
|
||||
if (stmt->mysql->server_status & SERVER_STATUS_LAST_ROW_SENT)
|
||||
stmt->mysql->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
|
||||
if (!(stmt->upsert_status.server_status & SERVER_STATUS_LAST_ROW_SENT))
|
||||
if (stmt->upsert_status.server_status & SERVER_STATUS_LAST_ROW_SENT)
|
||||
stmt->upsert_status.server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
|
||||
else
|
||||
{
|
||||
int4store(buf, stmt->stmt_id);
|
||||
int4store(buf + STMT_ID_LENGTH, stmt->prefetch_rows);
|
||||
@@ -1089,7 +1089,7 @@ static my_bool net_stmt_close(MYSQL_STMT *stmt, my_bool remove)
|
||||
|
||||
my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
|
||||
{
|
||||
if (stmt && stmt->mysql && stmt->mysql->net.vio)
|
||||
if (stmt && stmt->mysql && stmt->mysql->net.pvio)
|
||||
mysql_stmt_internal_reset(stmt, 1);
|
||||
|
||||
net_stmt_close(stmt, 1);
|
||||
@@ -1791,7 +1791,7 @@ static my_bool madb_reset_stmt(MYSQL_STMT *stmt, unsigned int flags)
|
||||
{
|
||||
/* reset statement on server side */
|
||||
if (stmt->mysql && stmt->mysql->status == MYSQL_STATUS_READY &&
|
||||
stmt->mysql->net.vio)
|
||||
stmt->mysql->net.pvio)
|
||||
{
|
||||
unsigned char cmd_buf[STMT_ID_LENGTH];
|
||||
int4store(cmd_buf, stmt->stmt_id);
|
||||
|
@@ -4338,7 +4338,6 @@ static int test_conc198(MYSQL *mysql)
|
||||
MYSQL_BIND my_bind[1];
|
||||
int32 a;
|
||||
int rc;
|
||||
const char *stmt_text;
|
||||
int num_rows= 0;
|
||||
ulong type;
|
||||
ulong prefetch_rows= 3;
|
||||
@@ -4370,7 +4369,6 @@ static int test_conc198(MYSQL *mysql)
|
||||
rc= mysql_stmt_attr_set(stmt2, STMT_ATTR_PREFETCH_ROWS,
|
||||
(void*) &prefetch_rows);
|
||||
check_stmt_rc(rc, stmt2);
|
||||
stmt_text= "select * from t1";
|
||||
rc= mysql_stmt_prepare(stmt1, "SELECT * FROM t1 ORDER by id ASC" , -1);
|
||||
check_stmt_rc(rc, stmt1);
|
||||
rc= mysql_stmt_prepare(stmt2, "SELECT * FROM t1 ORDER by id DESC", -1);
|
||||
@@ -4389,20 +4387,12 @@ static int test_conc198(MYSQL *mysql)
|
||||
mysql_stmt_bind_result(stmt2, my_bind);
|
||||
|
||||
while ((rc= mysql_stmt_fetch(stmt1)) == 0)
|
||||
{
|
||||
diag("a=%d", a);
|
||||
++num_rows;
|
||||
}
|
||||
FAIL_UNLESS(num_rows == 9, "num_rows != 9");
|
||||
|
||||
diag("---------------");
|
||||
|
||||
num_rows= 0;
|
||||
while ((rc= mysql_stmt_fetch(stmt2)) == 0)
|
||||
{
|
||||
diag("a=%d", a);
|
||||
++num_rows;
|
||||
}
|
||||
FAIL_UNLESS(num_rows == 9, "num_rows != 9");
|
||||
|
||||
rc= mysql_stmt_close(stmt1);
|
||||
|
Reference in New Issue
Block a user