diff options
-rw-r--r-- | ext/mysqlnd/mysqlnd.c | 8 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd.h | 1 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_libmysql_compat.h | 2 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_portability.h | 136 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_priv.h | 2 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_ps.c | 8 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_ps_codec.c | 32 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_result.c | 6 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_statistics.h | 16 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 30 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 32 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.h | 10 |
12 files changed, 135 insertions, 148 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 4920d28b74..a0a13208b9 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -1283,7 +1283,7 @@ MYSQLND_METHOD(mysqlnd_conn, field_count)(const MYSQLND * const conn) /* {{{ mysqlnd_conn::insert_id */ -static mynd_ulonglong +static uint64 MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn) { return conn->upsert_status.last_insert_id; @@ -1292,7 +1292,7 @@ MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn) /* {{{ mysqlnd_conn::affected_rows */ -static mynd_ulonglong +static uint64 MYSQLND_METHOD(mysqlnd_conn, affected_rows)(const MYSQLND * const conn) { return conn->upsert_status.affected_rows; @@ -1371,7 +1371,7 @@ MYSQLND_METHOD(mysqlnd_conn, charset_name)(const MYSQLND * const conn) /* {{{ mysqlnd_conn::thread_id */ -static mynd_ulonglong +static uint64 MYSQLND_METHOD(mysqlnd_conn, thread_id)(const MYSQLND * const conn) { return conn->thread_id; @@ -1425,7 +1425,7 @@ MYSQLND_METHOD(mysqlnd_conn, next_result)(MYSQLND * const conn TSRMLS_DC) } SET_EMPTY_ERROR(conn->error_info); - conn->upsert_status.affected_rows= ~(mynd_ulonglong) 0; + SET_ERROR_AFF_ROWS(conn); /* We are sure that there is a result set, since conn->state is set accordingly in mysqlnd_store_result() or mysqlnd_fetch_row_unbuffered() diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 8e8d1c80ff..92718efc81 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -250,6 +250,7 @@ PHPAPI ulong mysqlnd_old_escape_string(char *newstr, const char *escapestr, int #define mysqlnd_stmt_bind_result(stmt,bind) (stmt)->m->bind_result((stmt), (bind) TSRMLS_CC) #define mysqlnd_stmt_param_metadata(stmt) (stmt)->m->get_parameter_metadata((stmt)) #define mysqlnd_stmt_result_metadata(stmt) (stmt)->m->get_result_metadata((stmt) TSRMLS_CC) +#define mysqlnd_stmt_ronly_result_metadata(stmt) ((stmt)->result) #define mysqlnd_stmt_free_result(stmt) (stmt)->m->free_result((stmt) TSRMLS_CC) #define mysqlnd_stmt_close(stmt, implicit) (stmt)->m->dtor((stmt), (implicit) TSRMLS_CC) diff --git a/ext/mysqlnd/mysqlnd_libmysql_compat.h b/ext/mysqlnd/mysqlnd_libmysql_compat.h index e395418505..3786eece0a 100644 --- a/ext/mysqlnd/mysqlnd_libmysql_compat.h +++ b/ext/mysqlnd/mysqlnd_libmysql_compat.h @@ -31,7 +31,7 @@ #define MYSQL_ROW MYSQLND_ROW #define MYSQL MYSQLND #define my_bool zend_bool -#define my_ulonglong mynd_ulonglong +#define my_ulonglong uint64 #define MYSQL_VERSION_ID MYSQLND_VERSION_ID #define MYSQL_SERVER_VERSION MYSQLND_VERSION diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index 37aeb67e21..687c6d9b1f 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -69,6 +69,7 @@ typedef int8_t int8; /* Signed integer >= 8 bits */ #endif #endif + #ifndef HAVE_UINT8 #ifndef HAVE_UINT8_T typedef unsigned char uint8; /* Unsigned integer >= 8 bits */ @@ -97,47 +98,83 @@ typedef uint16_t uint16; /* Signed integer >= 16 bits */ typedef unsigned char uchar; /* Short for unsigned char */ #endif - -#if defined(HAVE_INT32_T) && defined(HAVE_UINT32_T) +#ifndef HAVE_INT32 +#ifdef HAVE_INT32_T typedef int32_t int32; -typedef uint32_t uint32; - #elif SIZEOF_INT == 4 - -#ifndef HAVE_INT32 typedef signed int int32; -#endif -#ifndef HAVE_UINT32 -typedef unsigned int uint32; -#endif - #elif SIZEOF_LONG == 4 - -#ifndef HAVE_INT32 typedef signed long int32; +#else +error "Neither int nor long is of 4 bytes width" #endif +#endif /* HAVE_INT32 */ + + #ifndef HAVE_UINT32 +#ifdef HAVE_UINT32_T +typedef uint32_t uint32; +#elif SIZEOF_INT == 4 +typedef unsigned int uint32; +#elif SIZEOF_LONG == 4 typedef unsigned long uint32; +#else +#error "Neither int nor long is of 4 bytes width" #endif - +#endif /* HAVE_UINT32 */ + + +#ifndef HAVE_INT64 +#ifdef HAVE_INT64_T +typedef int64_t int64; +#elif SIZEOF_INT == 8 +typedef signed int int64; +#elif SIZEOF_LONG == 8 +typedef signed long int64; +#elif SIZEOF_LONG_LONG == 8 +typedef signed long long int64; #else -error "Neither int or long is of 4 bytes width" +#error "Neither int nor long nor long long is of 8 bytes width" #endif +#endif /* HAVE_INT64 */ + + +#ifndef HAVE_UINT64 +#ifdef HAVE_UINT64_T +typedef uint64_t uint64; +#elif SIZEOF_INT == 8 +typedef unsigned int uint64; +#elif SIZEOF_LONG == 8 +typedef unsigned long uint64; +#elif SIZEOF_LONG_LONG == 8 +typedef unsigned long long uint64; +#else +#error "Neither int nor long nor long long is of 8 bytes width" +#endif +#endif /* HAVE_INT64 */ -#if !defined(HAVE_ULONG) && !defined(__USE_MISC) && !defined(ulong) -typedef unsigned long ulong; /* Short for unsigned long */ + +#ifdef PHP_WIN32 +#define MYSQLND_LLU_SPEC "%I64u" +#define MYSQLND_LL_SPEC "%I64d" +#ifndef L64 +#define L64(x) x##i64 #endif -#ifndef longlong_defined -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 -typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ -typedef long long int longlong; +typedef __int64 int64; +typedef unsigned __int64 uint64; #else -typedef unsigned long ulonglong; /* ulong or unsigned long long */ -typedef long longlong; +#define MYSQLND_LLU_SPEC "%llu" +#define MYSQLND_LL_SPEC "%lld" +#ifndef L64 +#define L64(x) x##LL #endif #endif +typedef int64 longlong; +typedef uint64 ulonglong; + + #define int1store(T,A) do { *((zend_uchar*) (T)) = (A); } while(0) #define uint1korr(A) (*(((uint8*)(A)))) @@ -280,29 +317,9 @@ typedef union { (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[3])) << 24)) -#define bit_uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) ((uchar) (A)[4])) << 32)) -/* From Andrey Hristov, based on uint5korr */ -#define bit_uint6korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[5])) +\ - (((uint32) (((uchar*) (A))[4])) << 8) +\ - (((uint32) (((uchar*) (A))[3])) << 16) +\ - (((uint32) (((uchar*) (A))[2])) << 24)) +\ - (((ulonglong) (((uint32) (((uchar*) (A))[1])) +\ - (((uint32) (((uchar*) (A))[0]) << 8)))) << 32)) -#define bit_uint7korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[6])) +\ - (((uint32) (((uchar*) (A))[5])) << 8) +\ - (((uint32) (((uchar*) (A))[4])) << 16) +\ - (((uint32) (((uchar*) (A))[3])) << 24)) +\ - (((ulonglong) (((uint32) (((uchar*) (A))[2])) +\ - (((uint32) (((uchar*) (A))[1])) << 8) +\ - (((uint32) (((uchar*) (A))[0])) << 16))) << 32)) - -#define bit_uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\ +#define uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\ (((uint32) (((uchar*) (A))[6])) << 8) +\ (((uint32) (((uchar*) (A))[5])) << 16) +\ (((uint32) (((uchar*) (A))[4])) << 24)) +\ @@ -473,37 +490,6 @@ typedef union { #endif /* WORDS_BIGENDIAN */ -#ifdef PHP_WIN32 -#define MYSQLND_LLU_SPEC "%I64u" -#define MYSQLND_LL_SPEC "%I64d" -#ifndef L64 -#define L64(x) x##i64 -#endif -typedef unsigned __int64 my_uint64; -typedef __int64 my_int64; -typedef unsigned __int64 mynd_ulonglong; -typedef __int64 mynd_longlong; -#else -#define MYSQLND_LLU_SPEC "%llu" -#define MYSQLND_LL_SPEC "%lld" -#ifndef L64 -#define L64(x) x##LL -#endif -#ifndef HAVE_UINT64_T -typedef unsigned long long my_uint64; -typedef unsigned long long mynd_ulonglong; -#else -typedef uint64_t my_uint64; -typedef uint64_t mynd_ulonglong; -#endif -#ifndef HAVE_INT64_T -typedef long long my_int64; -typedef long long mynd_longlong; -#else -typedef int64_t my_int64; -typedef int64_t mynd_longlong; -#endif -#endif /* * Local variables: diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h index c1b9a9657a..3a206cb39c 100644 --- a/ext/mysqlnd/mysqlnd_priv.h +++ b/ext/mysqlnd/mysqlnd_priv.h @@ -115,7 +115,7 @@ #define MAX_CHARSET_LEN 32 -#define SET_ERROR_AFF_ROWS(s) (s)->upsert_status.affected_rows = (mynd_ulonglong) ~0 +#define SET_ERROR_AFF_ROWS(s) (s)->upsert_status.affected_rows = (uint64) ~0 /* Error handling */ #define SET_NEW_MESSAGE(buf, buf_len, message, len, persistent) \ diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 5839e0189c..6e4d39ae72 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -1215,7 +1215,7 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_result)(MYSQLND_STMT * const stmt, /* {{{ mysqlnd_stmt::insert_id */ -static mynd_ulonglong +static uint64 MYSQLND_METHOD(mysqlnd_stmt, insert_id)(const MYSQLND_STMT * const stmt) { return stmt->upsert_status.last_insert_id; @@ -1224,7 +1224,7 @@ MYSQLND_METHOD(mysqlnd_stmt, insert_id)(const MYSQLND_STMT * const stmt) /* {{{ mysqlnd_stmt::affected_rows */ -static mynd_ulonglong +static uint64 MYSQLND_METHOD(mysqlnd_stmt, affected_rows)(const MYSQLND_STMT * const stmt) { return stmt->upsert_status.affected_rows; @@ -1233,7 +1233,7 @@ MYSQLND_METHOD(mysqlnd_stmt, affected_rows)(const MYSQLND_STMT * const stmt) /* {{{ mysqlnd_stmt::num_rows */ -static mynd_ulonglong +static uint64 MYSQLND_METHOD(mysqlnd_stmt, num_rows)(const MYSQLND_STMT * const stmt) { return stmt->result? mysqlnd_num_rows(stmt->result):0; @@ -1297,7 +1297,7 @@ MYSQLND_METHOD(mysqlnd_stmt, sqlstate)(const MYSQLND_STMT * const stmt) /* {{{ mysqlnd_stmt::data_seek */ static enum_func_status -MYSQLND_METHOD(mysqlnd_stmt, data_seek)(const MYSQLND_STMT * const stmt, mynd_ulonglong row TSRMLS_DC) +MYSQLND_METHOD(mysqlnd_stmt, data_seek)(const MYSQLND_STMT * const stmt, uint64 row TSRMLS_DC) { return stmt->result? stmt->result->m.seek_data(stmt->result, row TSRMLS_CC) : FAIL; } diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 41c49ab87d..dfc2cecddf 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -73,17 +73,17 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field, size_t tmp_len = 0; zend_bool is_bit = field->type == MYSQL_TYPE_BIT; if (field->flags & UNSIGNED_FLAG) { - my_uint64 uval = 0; + uint64 uval = 0; switch (byte_count) { - case 8:uval = is_bit? (my_uint64) bit_uint8korr(*row):(my_uint64) uint8korr(*row);break; + case 8:uval = is_bit? (uint64) bit_uint8korr(*row):(uint64) uint8korr(*row);break; case 7:uval = bit_uint7korr(*row);break; case 6:uval = bit_uint6korr(*row);break; case 5:uval = bit_uint5korr(*row);break; - case 4:uval = is_bit? (my_uint64) bit_uint4korr(*row):(my_uint64) uint4korr(*row);break; - case 3:uval = is_bit? (my_uint64) bit_uint3korr(*row):(my_uint64) uint3korr(*row);break; - case 2:uval = is_bit? (my_uint64) bit_uint2korr(*row):(my_uint64) uint2korr(*row);break; - case 1:uval = (my_uint64) uint1korr(*row);break; + case 4:uval = is_bit? (uint64) bit_uint4korr(*row):(uint64) uint4korr(*row);break; + case 3:uval = is_bit? (uint64) bit_uint3korr(*row):(uint64) uint3korr(*row);break; + case 2:uval = is_bit? (uint64) bit_uint2korr(*row):(uint64) uint2korr(*row);break; + case 1:uval = (uint64) uint1korr(*row);break; } #if SIZEOF_LONG==4 @@ -100,21 +100,21 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field, } } else { /* SIGNED */ - my_int64 lval = 0; + int64 lval = 0; switch (byte_count) { - case 8:lval = (my_int64) sint8korr(*row);break; + case 8:lval = (int64) sint8korr(*row);break; /* 7, 6 and 5 are not possible. BIT is only unsigned, thus only uint5|6|7 macroses exist */ - case 4:lval = (my_int64) sint4korr(*row);break; - case 3:lval = (my_int64) sint3korr(*row);break; - case 2:lval = (my_int64) sint2korr(*row);break; - case 1:lval = (my_int64) *(my_int8*)*row;break; + case 4:lval = (int64) sint4korr(*row);break; + case 3:lval = (int64) sint3korr(*row);break; + case 2:lval = (int64) sint2korr(*row);break; + case 1:lval = (int64) *(my_int8*)*row;break; } #if SIZEOF_LONG==4 - if ((L64(2147483647) < (my_int64) lval) || (L64(-2147483648) > (my_int64) lval)) { + if ((L64(2147483647) < (int64) lval) || (L64(-2147483648) > (int64) lval)) { tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval); } else #endif /* SIZEOF */ @@ -245,15 +245,15 @@ void ps_fetch_int64(zval *zv, const MYSQLND_FIELD * const field, ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 8 TSRMLS_CC); #if 0 - my_uint64 llval = (my_uint64) sint8korr(*row); + uint64 llval = (uint64) sint8korr(*row); zend_bool uns = field->flags & UNSIGNED_FLAG? TRUE:FALSE; #if SIZEOF_LONG==8 if (uns == TRUE && llval > 9223372036854775807L) { #elif SIZEOF_LONG==4 if ((uns == TRUE && llval > L64(2147483647)) || - (uns == FALSE && ((L64( 2147483647) < (my_int64) llval) || - (L64(-2147483648) > (my_int64) llval)))) + (uns == FALSE && ((L64( 2147483647) < (int64) llval) || + (L64(-2147483648) > (int64) llval)))) { #endif char tmp[22]; diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 1f8b5abb65..ce5322b7ac 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -765,7 +765,7 @@ mysqlnd_store_result_fetch_data(MYSQLND * const conn, MYSQLND_RES *result, zval **current_row; if (!free_rows) { - mynd_ulonglong total_rows = free_rows = next_extend = next_extend * 5 / 3; /* extend with 33% */ + uint64 total_rows = free_rows = next_extend = next_extend * 5 / 3; /* extend with 33% */ total_rows += set->row_count; set->data = mnd_perealloc(set->data, total_rows * sizeof(zval **), set->persistent); @@ -937,7 +937,7 @@ MYSQLND_METHOD(mysqlnd_res, free_result)(MYSQLND_RES *result, zend_bool implicit /* {{{ mysqlnd_res::data_seek */ static enum_func_status -MYSQLND_METHOD(mysqlnd_res, data_seek)(MYSQLND_RES *result, mynd_ulonglong row TSRMLS_DC) +MYSQLND_METHOD(mysqlnd_res, data_seek)(MYSQLND_RES *result, uint64 row TSRMLS_DC) { DBG_ENTER("mysqlnd_res::data_seek"); DBG_INF_FMT("row=%lu", row); @@ -959,7 +959,7 @@ MYSQLND_METHOD(mysqlnd_res, data_seek)(MYSQLND_RES *result, mynd_ulonglong row T /* {{{ mysqlnd_res::num_fields */ -mynd_ulonglong +uint64 MYSQLND_METHOD(mysqlnd_res, num_rows)(const MYSQLND_RES * const res) { /* Be compatible with libmysql. We count row_count, but will return 0 */ diff --git a/ext/mysqlnd/mysqlnd_statistics.h b/ext/mysqlnd/mysqlnd_statistics.h index 371c0353b7..d533d0c52a 100644 --- a/ext/mysqlnd/mysqlnd_statistics.h +++ b/ext/mysqlnd/mysqlnd_statistics.h @@ -86,7 +86,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[]; #define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \ { \ if (MYSQLND_G(collect_statistics)) { \ - my_uint64 v = (my_uint64) (value); \ + uint64 v = (uint64) (value); \ DBG_INF_FMT("Global&Conn stat increase w value [%s]", mysqlnd_stats_values_names[statistic]); \ tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \ mysqlnd_global_stats->values[(statistic)] += v; \ @@ -100,9 +100,9 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[]; #define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \ { \ if (MYSQLND_G(collect_statistics)) { \ - my_uint64 v1 = (my_uint64) (value1); \ - my_uint64 v2 = (my_uint64) (value2); \ - my_uint64 v3 = (my_uint64) (value3); \ + uint64 v1 = (uint64) (value1); \ + uint64 v2 = (uint64) (value2); \ + uint64 v3 = (uint64) (value3); \ \ tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \ mysqlnd_global_stats->values[(statistic1)]+= v1; \ @@ -163,7 +163,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[]; #define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \ { \ - my_uint64 v = (my_uint64) (value); \ + uint64 v = (uint64) (value); \ DBG_INF_FMT("Global&Conn stats increase w value [%s]", mysqlnd_stats_values_names[statistic]); \ if (MYSQLND_G(collect_statistics)) { \ mysqlnd_global_stats->values[(statistic)] += v; \ @@ -176,9 +176,9 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[]; #define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \ { \ if (MYSQLND_G(collect_statistics)) { \ - my_uint64 v1 = (my_uint64) (value1); \ - my_uint64 v2 = (my_uint64) (value2); \ - my_uint64 v3 = (my_uint64) (value3); \ + uint64 v1 = (uint64) (value1); \ + uint64 v2 = (uint64) (value2); \ + uint64 v3 = (uint64) (value3); \ \ mysqlnd_global_stats->values[(statistic1)]+= v1; \ mysqlnd_global_stats->values[(statistic2)]+= v2; \ diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index c178df9b5b..93c91c38d5 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -62,8 +62,8 @@ typedef struct st_mysqlnd_upsert_result { unsigned int warning_count; unsigned int server_status; - mynd_ulonglong affected_rows; - mynd_ulonglong last_insert_id; + uint64 affected_rows; + uint64 last_insert_id; } mysqlnd_upsert_status; @@ -177,7 +177,7 @@ typedef enum_func_status (*mysqlnd_fetch_row_func)(MYSQLND_RES *result, typedef struct st_mysqlnd_stats { - my_uint64 values[STAT_LAST]; + uint64 values[STAT_LAST]; #ifdef ZTS MUTEX_T LOCK_access; #endif @@ -223,7 +223,7 @@ struct st_mysqlnd_conn_methods unsigned int (*get_error_no)(const MYSQLND * const conn); const char * (*get_error_str)(const MYSQLND * const conn); const char * (*get_sqlstate)(const MYSQLND * const conn); - mynd_ulonglong (*get_thread_id)(const MYSQLND * const conn); + uint64 (*get_thread_id)(const MYSQLND * const conn); void (*get_statistics)(const MYSQLND * const conn, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); unsigned long (*get_server_version)(const MYSQLND * const conn); @@ -236,8 +236,8 @@ struct st_mysqlnd_conn_methods MYSQLND_RES * (*list_fields)(MYSQLND *conn, const char *table, const char *achtung_wild TSRMLS_DC); MYSQLND_RES * (*list_method)(MYSQLND *conn, const char *query, const char *achtung_wild, char *par1 TSRMLS_DC); - mynd_ulonglong (*get_last_insert_id)(const MYSQLND * const conn); - mynd_ulonglong (*get_affected_rows)(const MYSQLND * const conn); + uint64 (*get_last_insert_id)(const MYSQLND * const conn); + uint64 (*get_affected_rows)(const MYSQLND * const conn); unsigned int (*get_warning_count)(const MYSQLND * const conn); unsigned int (*get_field_count)(const MYSQLND * const conn); @@ -264,10 +264,10 @@ struct st_mysqlnd_res_methods void (*fetch_into)(MYSQLND_RES *result, unsigned int flags, zval *return_value, enum_mysqlnd_extension ext TSRMLS_DC ZEND_FILE_LINE_DC); void (*fetch_all)(MYSQLND_RES *result, unsigned int flags, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); void (*fetch_field_data)(MYSQLND_RES *result, unsigned int offset, zval *return_value TSRMLS_DC); - mynd_ulonglong (*num_rows)(const MYSQLND_RES * const result); + uint64 (*num_rows)(const MYSQLND_RES * const result); unsigned int (*num_fields)(const MYSQLND_RES * const result); enum_func_status (*skip_result)(MYSQLND_RES * const result TSRMLS_DC); - enum_func_status (*seek_data)(MYSQLND_RES * result, mynd_ulonglong row TSRMLS_DC); + enum_func_status (*seek_data)(MYSQLND_RES * result, uint64 row TSRMLS_DC); MYSQLND_FIELD_OFFSET (*seek_field)(MYSQLND_RES * const result, MYSQLND_FIELD_OFFSET field_offset); MYSQLND_FIELD_OFFSET (*field_tell)(const MYSQLND_RES * const result); MYSQLND_FIELD * (*fetch_field)(MYSQLND_RES * const result TSRMLS_DC); @@ -301,7 +301,7 @@ struct st_mysqlnd_stmt_methods MYSQLND_RES * (*store_result)(MYSQLND_STMT * const stmt TSRMLS_DC); MYSQLND_RES * (*get_result)(MYSQLND_STMT * const stmt TSRMLS_DC); enum_func_status (*free_result)(MYSQLND_STMT * const stmt TSRMLS_DC); - enum_func_status (*seek_data)(const MYSQLND_STMT * const stmt, mynd_ulonglong row TSRMLS_DC); + enum_func_status (*seek_data)(const MYSQLND_STMT * const stmt, uint64 row TSRMLS_DC); enum_func_status (*reset)(MYSQLND_STMT * const stmt TSRMLS_DC); enum_func_status (*close)(MYSQLND_STMT * const stmt, zend_bool implicit TSRMLS_DC); /* private */ enum_func_status (*dtor)(MYSQLND_STMT * const stmt, zend_bool implicit TSRMLS_DC); /* use this for mysqlnd_stmt_close */ @@ -315,9 +315,9 @@ struct st_mysqlnd_stmt_methods MYSQLND_RES * (*get_parameter_metadata)(MYSQLND_STMT * const stmt); MYSQLND_RES * (*get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); - mynd_ulonglong (*get_last_insert_id)(const MYSQLND_STMT * const stmt); - mynd_ulonglong (*get_affected_rows)(const MYSQLND_STMT * const stmt); - mynd_ulonglong (*get_num_rows)(const MYSQLND_STMT * const stmt); + uint64 (*get_last_insert_id)(const MYSQLND_STMT * const stmt); + uint64 (*get_affected_rows)(const MYSQLND_STMT * const stmt); + uint64 (*get_num_rows)(const MYSQLND_STMT * const stmt); unsigned int (*get_param_count)(const MYSQLND_STMT * const stmt); unsigned int (*get_field_count)(const MYSQLND_STMT * const stmt); @@ -344,7 +344,7 @@ struct st_mysqlnd_connection char *passwd; unsigned int *passwd_len; char *scheme; - mynd_ulonglong thread_id; + uint64 thread_id; char *server_version; char *host_info; unsigned char *scramble; @@ -440,7 +440,7 @@ struct st_mysqlnd_buffered_result zval ***data; zval ***data_cursor; zend_uchar **row_buffers; - mynd_ulonglong row_count; + uint64 row_count; zend_bool persistent; MYSQLND_QCACHE *qcache; @@ -457,7 +457,7 @@ struct st_mysqlnd_unbuffered_result zval **last_row_data; zend_uchar *last_row_buffer; - mynd_ulonglong row_count; + uint64 row_count; zend_bool eof_reached; }; diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index a880f55c1e..8c119a769f 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -126,48 +126,48 @@ unsigned long php_mysqlnd_net_field_length(zend_uchar **packet) /* {{{ php_mysqlnd_net_field_length_ll Get next field's length */ -mynd_ulonglong php_mysqlnd_net_field_length_ll(zend_uchar **packet) +uint64 php_mysqlnd_net_field_length_ll(zend_uchar **packet) { register zend_uchar *p= (zend_uchar *)*packet; if (*p < 251) { (*packet)++; - return (mynd_ulonglong) *p; + return (uint64) *p; } switch (*p) { case 251: (*packet)++; - return (mynd_ulonglong) MYSQLND_NULL_LENGTH; + return (uint64) MYSQLND_NULL_LENGTH; case 252: (*packet) += 3; - return (mynd_ulonglong) uint2korr(p + 1); + return (uint64) uint2korr(p + 1); case 253: (*packet) += 4; - return (mynd_ulonglong) uint3korr(p + 1); + return (uint64) uint3korr(p + 1); default: (*packet) += 9; - return (mynd_ulonglong) uint8korr(p + 1); + return (uint64) uint8korr(p + 1); } } /* }}} */ /* {{{ php_mysqlnd_net_store_length */ -zend_uchar *php_mysqlnd_net_store_length(zend_uchar *packet, mynd_ulonglong length) +zend_uchar *php_mysqlnd_net_store_length(zend_uchar *packet, uint64 length) { - if (length < (mynd_ulonglong) L64(251)) { + if (length < (uint64) L64(251)) { *packet = (zend_uchar) length; return packet + 1; } - if (length < (mynd_ulonglong) L64(65536)) { + if (length < (uint64) L64(65536)) { *packet++ = 252; int2store(packet,(uint) length); return packet + 2; } - if (length < (mynd_ulonglong) L64(16777216)) { + if (length < (uint64) L64(16777216)) { *packet++ = 253; int3store(packet,(ulong) length); return packet + 3; @@ -1430,23 +1430,23 @@ void php_mysqlnd_rowp_read_text_protocol(php_mysql_packet_row *packet, MYSQLND * if (perm_bind.pack_len < SIZEOF_LONG) { /* direct conversion */ - my_int64 v = atoll((char *) p); + int64 v = atoll((char *) p); ZVAL_LONG(*current_field, v); } else { - my_uint64 v = (my_uint64) atoll((char *) p); + uint64 v = (uint64) atoll((char *) p); zend_bool uns = packet->fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE; /* We have to make it ASCIIZ temporarily */ #if SIZEOF_LONG==8 if (uns == TRUE && v > 9223372036854775807L) #elif SIZEOF_LONG==4 if ((uns == TRUE && v > L64(2147483647)) || - (uns == FALSE && (( L64(2147483647) < (my_int64) v) || - (L64(-2147483648) > (my_int64) v)))) + (uns == FALSE && (( L64(2147483647) < (int64) v) || + (L64(-2147483648) > (int64) v)))) #endif /* SIZEOF */ { ZVAL_STRINGL(*current_field, (char *)p, len, 0); } else { - ZVAL_LONG(*current_field, (my_int64)v); + ZVAL_LONG(*current_field, (int64)v); } } *(p + len) = save; @@ -1472,7 +1472,7 @@ void php_mysqlnd_rowp_read_text_protocol(php_mysql_packet_row *packet, MYSQLND * p -= len; if (Z_TYPE_PP(current_field) == IS_LONG) { bit_area += 1 + sprintf((char *)start, MYSQLND_LLU_SPEC, - (my_int64) Z_LVAL_PP(current_field)); + (int64) Z_LVAL_PP(current_field)); #if PHP_MAJOR_VERSION >= 6 if (as_unicode) { ZVAL_UTF8_STRINGL(*current_field, start, bit_area - start - 1, 0); diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h index 3219917e06..30d4ab90e5 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.h +++ b/ext/mysqlnd/mysqlnd_wireprotocol.h @@ -173,8 +173,8 @@ typedef struct st_php_mysql_packet_auth { typedef struct st_php_mysql_packet_ok { mysqlnd_packet_header header; mysqlnd_1b field_count; /* always 0x0 */ - mynd_ulonglong affected_rows; - mynd_ulonglong last_insert_id; + uint64 affected_rows; + uint64 last_insert_id; mysqlnd_2b server_status; mysqlnd_2b warning_count; char *message; @@ -225,8 +225,8 @@ typedef struct st_php_mysql_packet_rset_header { */ mysqlnd_2b warning_count; mysqlnd_2b server_status; - mynd_ulonglong affected_rows; - mynd_ulonglong last_insert_id; + uint64 affected_rows; + uint64 last_insert_id; /* This is for both LOAD DATA or info, when no result set */ char *info_or_local_file; size_t info_or_local_file_len; @@ -319,7 +319,7 @@ size_t php_mysqlnd_consume_uneaten_data(MYSQLND * const conn, enum php_mysqlnd_s void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const pass); unsigned long php_mysqlnd_net_field_length(zend_uchar **packet); -zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, mynd_ulonglong length); +zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64 length); extern char * const mysqlnd_empty_string; |