1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Build fixes for 10.2 integration

This commit is contained in:
Georg Richter
2016-03-01 13:54:33 +01:00
parent c433c30271
commit 89fce625b5
9 changed files with 61 additions and 70 deletions

View File

@@ -35,11 +35,11 @@ extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
extern unsigned int list_length(LIST *list);
extern int list_walk(LIST *list,list_walk_action action,gptr argument);
extern int list_walk(LIST *list,list_walk_action action,char * argument);
#define rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((gptr) old,MYF(MY_FAE)); }
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((char *) old,MYF(MY_FAE)); }
#ifdef __cplusplus
}

View File

@@ -111,8 +111,8 @@ typedef struct st_mysqlnd_upsert_result
{
unsigned int warning_count;
unsigned int server_status;
my_ulonglong affected_rows;
my_ulonglong last_insert_id;
unsigned long long affected_rows;
unsigned long long last_insert_id;
} mysql_upsert_status;
typedef struct st_mysql_cmd_buffer
@@ -137,7 +137,7 @@ struct st_mysqlnd_stmt_methods
MYSQL_RES * (*store_result)(const MYSQL_STMT * stmt);
MYSQL_RES * (*get_result)(const MYSQL_STMT * stmt);
my_bool (*free_result)(const MYSQL_STMT * stmt);
my_bool (*seek_data)(const MYSQL_STMT * stmt, my_ulonglong row);
my_bool (*seek_data)(const MYSQL_STMT * stmt, unsigned long long row);
my_bool (*reset)(const MYSQL_STMT * stmt);
my_bool (*close)(const MYSQL_STMT * stmt); /* private */
my_bool (*dtor)(const MYSQL_STMT * stmt); /* use this for mysqlnd_stmt_close */
@@ -151,9 +151,9 @@ struct st_mysqlnd_stmt_methods
const char * const data, size_t length);
MYSQL_RES *(*get_parameter_metadata)(const MYSQL_STMT * stmt);
MYSQL_RES *(*get_result_metadata)(const MYSQL_STMT * stmt);
my_ulonglong (*get_last_insert_id)(const MYSQL_STMT * stmt);
my_ulonglong (*get_affected_rows)(const MYSQL_STMT * stmt);
my_ulonglong (*get_num_rows)(const MYSQL_STMT * stmt);
unsigned long long (*get_last_insert_id)(const MYSQL_STMT * stmt);
unsigned long long (*get_affected_rows)(const MYSQL_STMT * stmt);
unsigned long long (*get_num_rows)(const MYSQL_STMT * stmt);
unsigned int (*get_param_count)(const MYSQL_STMT * stmt);
unsigned int (*get_field_count)(const MYSQL_STMT * stmt);
@@ -246,10 +246,10 @@ const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, unsigned long long offset);
unsigned long long STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
unsigned long long STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
unsigned long long STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
my_bool STDCALL mysql_stmt_more_results(MYSQL_STMT *stmt);

View File

@@ -31,7 +31,7 @@ extern "C" {
#include <stdarg.h>
#ifndef _global_h /* If not standard header */
#if !defined (_global_h) && !defined (MY_GLOBAL_INCLUDED) /* If not standard header */
#include <sys/types.h>
typedef char my_bool;
@@ -40,7 +40,6 @@ typedef char my_bool;
#else
#define STDCALL __stdcall
#endif
typedef char * gptr;
@@ -120,14 +119,6 @@ extern unsigned int mariadb_deinitialize_ssl;
typedef char **MYSQL_ROW; /* return data as array of strings */
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif defined (_WIN32)
typedef unsigned __int64 my_ulonglong;
#else
typedef unsigned long long my_ulonglong;
#endif
#define SET_CLIENT_ERROR(a, b, c, d) \
{ \
(a)->net.last_errno= (b);\
@@ -146,7 +137,7 @@ extern unsigned int mariadb_deinitialize_ssl;
(a)->net.last_error[0]= '\0';\
}
#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
#define MYSQL_COUNT_ERROR (~(unsigned long long) 0)
typedef struct st_mysql_rows {
@@ -158,7 +149,7 @@ extern unsigned int mariadb_deinitialize_ssl;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
typedef struct st_mysql_data {
my_ulonglong rows;
unsigned long long rows;
unsigned int fields;
MYSQL_ROWS *data;
MA_MEM_ROOT alloc;
@@ -330,9 +321,9 @@ struct st_mysql_options {
const struct ma_charset_info_st *charset; /* character set */
MYSQL_FIELD *fields;
MA_MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */
unsigned long long affected_rows;
unsigned long long insert_id; /* id if insert on table with NEXTNR */
unsigned long long extra_info; /* Used by mysqlshow */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
@@ -360,7 +351,7 @@ struct st_mysql_options {
} MYSQL;
typedef struct st_mysql_res {
my_ulonglong row_count;
unsigned long long row_count;
unsigned int field_count, current_field;
MYSQL_FIELD *fields;
MYSQL_DATA *data;
@@ -463,7 +454,7 @@ void my_set_error(MYSQL *mysql, unsigned int error_nr,
/* Functions to get information from the MYSQL and MYSQL_RES structures */
/* Should definitely be used if one uses shared libraries */
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned long long STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
my_bool STDCALL mysql_eof(MYSQL_RES *res);
MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
@@ -475,11 +466,11 @@ unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
unsigned int STDCALL mysql_field_count(MYSQL *mysql);
my_bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
unsigned long long STDCALL mysql_affected_rows(MYSQL *mysql);
my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode);
my_bool STDCALL mysql_commit(MYSQL *mysql);
my_bool STDCALL mysql_rollback(MYSQL *mysql);
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
unsigned long long STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
char * STDCALL mysql_error(MYSQL *mysql);
char * STDCALL mysql_info(MYSQL *mysql);
@@ -536,7 +527,7 @@ int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option,
const void *arg1, const void *arg2);
void STDCALL mysql_free_result(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result,
my_ulonglong offset);
unsigned long long offset);
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_FIELD_OFFSET offset);
@@ -687,7 +678,7 @@ int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt,
/* API function calls (used by dynmic plugins) */
struct st_mariadb_api {
my_ulonglong (STDCALL *mysql_num_rows)(MYSQL_RES *res);
unsigned long long (STDCALL *mysql_num_rows)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res);
my_bool (STDCALL *mysql_eof)(MYSQL_RES *res);
MYSQL_FIELD *(STDCALL *mysql_fetch_field_direct)(MYSQL_RES *res, unsigned int fieldnr);
@@ -697,11 +688,11 @@ struct st_mariadb_api {
unsigned int (STDCALL *mysql_field_count)(MYSQL *mysql);
my_bool (STDCALL *mysql_more_results)(MYSQL *mysql);
int (STDCALL *mysql_next_result)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_affected_rows)(MYSQL *mysql);
unsigned long long (STDCALL *mysql_affected_rows)(MYSQL *mysql);
my_bool (STDCALL *mysql_autocommit)(MYSQL *mysql, my_bool mode);
my_bool (STDCALL *mysql_commit)(MYSQL *mysql);
my_bool (STDCALL *mysql_rollback)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_insert_id)(MYSQL *mysql);
unsigned long long (STDCALL *mysql_insert_id)(MYSQL *mysql);
unsigned int (STDCALL *mysql_errno)(MYSQL *mysql);
char * (STDCALL *mysql_error)(MYSQL *mysql);
char * (STDCALL *mysql_info)(MYSQL *mysql);
@@ -740,7 +731,7 @@ struct st_mariadb_api {
MYSQL_RES * (STDCALL *mysql_use_result)(MYSQL *mysql);
int (STDCALL *mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg);
void (STDCALL *mysql_free_result)(MYSQL_RES *result);
void (STDCALL *mysql_data_seek)(MYSQL_RES *result, my_ulonglong offset);
void (STDCALL *mysql_data_seek)(MYSQL_RES *result, unsigned long long offset);
MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek)(MYSQL_RES *result, MYSQL_ROW_OFFSET);
MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek)(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset);
MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result);
@@ -793,10 +784,10 @@ struct st_mariadb_api {
const char *(STDCALL *mysql_stmt_sqlstate)(MYSQL_STMT * stmt);
MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_seek)(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_tell)(MYSQL_STMT *stmt);
void (STDCALL *mysql_stmt_data_seek)(MYSQL_STMT *stmt, my_ulonglong offset);
my_ulonglong (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt);
my_ulonglong (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt);
my_ulonglong (STDCALL *mysql_stmt_insert_id)(MYSQL_STMT *stmt);
void (STDCALL *mysql_stmt_data_seek)(MYSQL_STMT *stmt, unsigned long long offset);
unsigned long long (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt);
unsigned long long (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt);
unsigned long long (STDCALL *mysql_stmt_insert_id)(MYSQL_STMT *stmt);
unsigned int (STDCALL *mysql_stmt_field_count)(MYSQL_STMT *stmt);
int (STDCALL *mysql_stmt_next_result)(MYSQL_STMT *stmt);
my_bool (STDCALL *mysql_stmt_more_results)(MYSQL_STMT *stmt);

View File

@@ -320,35 +320,35 @@ net_field_length(uchar **packet)
/* Same as above, but returns ulonglong values */
static my_ulonglong
static unsigned long long
net_field_length_ll(uchar **packet)
{
reg1 uchar *pos= *packet;
if (*pos < 251)
{
(*packet)++;
return (my_ulonglong) *pos;
return (unsigned long long) *pos;
}
if (*pos == 251)
{
(*packet)++;
return (my_ulonglong) NULL_LENGTH;
return (unsigned long long) NULL_LENGTH;
}
if (*pos == 252)
{
(*packet)+=3;
return (my_ulonglong) uint2korr(pos+1);
return (unsigned long long) uint2korr(pos+1);
}
if (*pos == 253)
{
(*packet)+=4;
return (my_ulonglong) uint3korr(pos+1);
return (unsigned long long) uint3korr(pos+1);
}
(*packet)+=9; /* Must be 254 when here */
#ifdef NO_CLIENT_LONGLONG
return (my_ulonglong) uint4korr(pos+1);
return (unsigned long long) uint4korr(pos+1);
#else
return (my_ulonglong) uint8korr(pos+1);
return (unsigned long long) uint8korr(pos+1);
#endif
}
@@ -403,7 +403,7 @@ mthd_my_send_cmd(MYSQL *mysql,enum enum_server_command command, const char *arg,
CLEAR_CLIENT_ERROR(mysql);
mysql->info=0;
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->affected_rows= ~(unsigned long long) 0;
ma_net_clear(net); /* Clear receive buffer */
if (!arg)
arg="";
@@ -1636,7 +1636,7 @@ my_bool STDCALL mariadb_reconnect(MYSQL *mysql)
*mysql=tmp_mysql;
mysql->net.pvio->mysql= mysql;
ma_net_clear(&mysql->net);
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->affected_rows= ~(unsigned long long) 0;
mysql->info= 0;
return(0);
}
@@ -2182,7 +2182,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
**************************************************************************/
void STDCALL
mysql_data_seek(MYSQL_RES *result, my_ulonglong row)
mysql_data_seek(MYSQL_RES *result, unsigned long long row)
{
MYSQL_ROWS *tmp=0;
if (result->data)
@@ -3093,7 +3093,7 @@ mysql_options4(MYSQL *mysql,enum mysql_option option, const void *arg1, const vo
****************************************************************************/
/* MYSQL_RES */
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res)
unsigned long long STDCALL mysql_num_rows(MYSQL_RES *res)
{
return res->row_count;
}
@@ -3136,7 +3136,7 @@ unsigned int STDCALL mysql_field_count(MYSQL *mysql)
return mysql->field_count;
}
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
unsigned long long STDCALL mysql_affected_rows(MYSQL *mysql)
{
return (mysql)->affected_rows;
}
@@ -3157,7 +3157,7 @@ my_bool STDCALL mysql_rollback(MYSQL *mysql)
return((my_bool)mysql_real_query(mysql, "ROLLBACK", sizeof("ROLLBACK")));
}
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
unsigned long long STDCALL mysql_insert_id(MYSQL *mysql)
{
return (mysql)->insert_id;
}

View File

@@ -380,18 +380,18 @@ MYSQL_RES *_mysql_stmt_use_result(MYSQL_STMT *stmt)
unsigned char *mysql_net_store_length(unsigned char *packet, size_t length)
{
if (length < (my_ulonglong) L64(251)) {
if (length < (unsigned long long) L64(251)) {
*packet = (unsigned char) length;
return packet + 1;
}
if (length < (my_ulonglong) L64(65536)) {
if (length < (unsigned long long) L64(65536)) {
*packet++ = 252;
int2store(packet,(uint) length);
return packet + 2;
}
if (length < (my_ulonglong) L64(16777216)) {
if (length < (unsigned long long) L64(16777216)) {
*packet++ = 253;
int3store(packet,(ulong) length);
return packet + 3;
@@ -422,7 +422,7 @@ int store_param(MYSQL_STMT *stmt, int column, unsigned char **p)
(*p) += 8;
break;
case MYSQL_TYPE_LONGLONG:
int8store(*p, *(my_ulonglong *)stmt->params[column].buffer);
int8store(*p, *(unsigned long long *)stmt->params[column].buffer);
(*p) += 8;
break;
case MYSQL_TYPE_LONG:
@@ -695,14 +695,14 @@ mem_error:
/*!
*******************************************************************************
\fn my_ulonglong mysql_stmt_affected_rows
\fn unsigned long long mysql_stmt_affected_rows
\brief returns the number of affected rows from last mysql_stmt_execute
call
\param[in] stmt The statement handle
*******************************************************************************
*/
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
unsigned long long STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
{
return stmt->upsert_status.affected_rows;
}
@@ -1006,9 +1006,9 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
return(0);
}
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset)
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, unsigned long long offset)
{
my_ulonglong i= offset;
unsigned long long i= offset;
MYSQL_ROWS *ptr= stmt->result.data;
while(i-- && ptr)
@@ -1235,7 +1235,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t lengt
/* clear flags */
CLEAR_CLIENT_STMT_ERROR(stmt);
CLEAR_CLIENT_ERROR(stmt->mysql);
stmt->upsert_status.affected_rows= mysql->affected_rows= (my_ulonglong) ~0;
stmt->upsert_status.affected_rows= mysql->affected_rows= (unsigned long long) ~0;
/* check if we have to clear results */
if (stmt->state > MYSQL_STMT_INITTED)
@@ -1859,12 +1859,12 @@ my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
return(0);
}
my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt)
unsigned long long STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt)
{
return stmt->upsert_status.last_insert_id;
}
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt)
unsigned long long STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt)
{
return stmt->result.rows;
}

View File

@@ -395,7 +395,7 @@ static int test_bad_union(MYSQL *mysql)
*/
static int test_mysql_insert_id(MYSQL *mysql)
{
my_ulonglong res;
unsigned long long res;
int rc;
if (mysql_get_server_version(mysql) < 50100) {

View File

@@ -51,7 +51,7 @@ static int test_bug28075(MYSQL *mysql)
static int test_bug28505(MYSQL *mysql)
{
my_ulonglong res;
unsigned long long res;
int rc;
rc= mysql_query(mysql, "drop table if exists t1");

View File

@@ -1260,7 +1260,7 @@ static int test_bug23383(MYSQL *mysql)
const char *insert_query= "INSERT INTO t1 VALUES (1), (2)";
const char *update_query= "UPDATE t1 SET i= 4 WHERE i = 3";
MYSQL_STMT *stmt;
my_ulonglong row_count;
unsigned long long row_count;
int rc;
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
@@ -1277,7 +1277,7 @@ static int test_bug23383(MYSQL *mysql)
rc= mysql_query(mysql, insert_query);
FAIL_IF(!rc, "Error expected");
row_count= mysql_affected_rows(mysql);
FAIL_UNLESS(row_count == (my_ulonglong)-1, "rowcount != -1");
FAIL_UNLESS(row_count == (unsigned long long)-1, "rowcount != -1");
rc= mysql_query(mysql, update_query);
check_mysql_rc(rc, mysql);
@@ -1300,7 +1300,7 @@ static int test_bug23383(MYSQL *mysql)
rc= mysql_stmt_execute(stmt);
FAIL_UNLESS(rc != 0, "");
row_count= mysql_stmt_affected_rows(stmt);
FAIL_UNLESS(row_count == (my_ulonglong)-1, "rowcount != -1");
FAIL_UNLESS(row_count == (unsigned long long)-1, "rowcount != -1");
rc= mysql_stmt_prepare(stmt, update_query, strlen(update_query));
check_stmt_rc(rc, stmt);

View File

@@ -586,7 +586,7 @@ static int test_bug21726(MYSQL *mysql)
};
const char *update_query= "UPDATE t1 SET i= LAST_INSERT_ID(i + 1)";
int rc;
my_ulonglong insert_id;
unsigned long long insert_id;
const char *select_query= "SELECT * FROM t1";
MYSQL_RES *result;