mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Fix problems with double definitions
- Clean up a bit a type mess - 4 types less. No need to have aliases for the same thing (unification is the name). - New macro for Johannes mysqlnd_stmt_ro_result_metadata
This commit is contained in:
parent
fc74136a90
commit
fdf20a8287
12 changed files with 140 additions and 153 deletions
|
@ -1283,7 +1283,7 @@ MYSQLND_METHOD(mysqlnd_conn, field_count)(const MYSQLND * const conn)
|
||||||
|
|
||||||
|
|
||||||
/* {{{ mysqlnd_conn::insert_id */
|
/* {{{ mysqlnd_conn::insert_id */
|
||||||
static mynd_ulonglong
|
static uint64
|
||||||
MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn)
|
MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn)
|
||||||
{
|
{
|
||||||
return conn->upsert_status.last_insert_id;
|
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 */
|
/* {{{ mysqlnd_conn::affected_rows */
|
||||||
static mynd_ulonglong
|
static uint64
|
||||||
MYSQLND_METHOD(mysqlnd_conn, affected_rows)(const MYSQLND * const conn)
|
MYSQLND_METHOD(mysqlnd_conn, affected_rows)(const MYSQLND * const conn)
|
||||||
{
|
{
|
||||||
return conn->upsert_status.affected_rows;
|
return conn->upsert_status.affected_rows;
|
||||||
|
@ -1371,7 +1371,7 @@ MYSQLND_METHOD(mysqlnd_conn, charset_name)(const MYSQLND * const conn)
|
||||||
|
|
||||||
|
|
||||||
/* {{{ mysqlnd_conn::thread_id */
|
/* {{{ mysqlnd_conn::thread_id */
|
||||||
static mynd_ulonglong
|
static uint64
|
||||||
MYSQLND_METHOD(mysqlnd_conn, thread_id)(const MYSQLND * const conn)
|
MYSQLND_METHOD(mysqlnd_conn, thread_id)(const MYSQLND * const conn)
|
||||||
{
|
{
|
||||||
return conn->thread_id;
|
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);
|
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
|
We are sure that there is a result set, since conn->state is set accordingly
|
||||||
in mysqlnd_store_result() or mysqlnd_fetch_row_unbuffered()
|
in mysqlnd_store_result() or mysqlnd_fetch_row_unbuffered()
|
||||||
|
|
|
@ -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_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_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_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_free_result(stmt) (stmt)->m->free_result((stmt) TSRMLS_CC)
|
||||||
#define mysqlnd_stmt_close(stmt, implicit) (stmt)->m->dtor((stmt), (implicit) TSRMLS_CC)
|
#define mysqlnd_stmt_close(stmt, implicit) (stmt)->m->dtor((stmt), (implicit) TSRMLS_CC)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define MYSQL_ROW MYSQLND_ROW
|
#define MYSQL_ROW MYSQLND_ROW
|
||||||
#define MYSQL MYSQLND
|
#define MYSQL MYSQLND
|
||||||
#define my_bool zend_bool
|
#define my_bool zend_bool
|
||||||
#define my_ulonglong mynd_ulonglong
|
#define my_ulonglong uint64
|
||||||
|
|
||||||
#define MYSQL_VERSION_ID MYSQLND_VERSION_ID
|
#define MYSQL_VERSION_ID MYSQLND_VERSION_ID
|
||||||
#define MYSQL_SERVER_VERSION MYSQLND_VERSION
|
#define MYSQL_SERVER_VERSION MYSQLND_VERSION
|
||||||
|
|
|
@ -69,6 +69,7 @@ typedef int8_t int8; /* Signed integer >= 8 bits */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_UINT8
|
#ifndef HAVE_UINT8
|
||||||
#ifndef HAVE_UINT8_T
|
#ifndef HAVE_UINT8_T
|
||||||
typedef unsigned char uint8; /* Unsigned integer >= 8 bits */
|
typedef unsigned char uint8; /* Unsigned integer >= 8 bits */
|
||||||
|
@ -97,45 +98,81 @@ typedef uint16_t uint16; /* Signed integer >= 16 bits */
|
||||||
typedef unsigned char uchar; /* Short for unsigned char */
|
typedef unsigned char uchar; /* Short for unsigned char */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_INT32
|
||||||
#if defined(HAVE_INT32_T) && defined(HAVE_UINT32_T)
|
#ifdef HAVE_INT32_T
|
||||||
typedef int32_t int32;
|
typedef int32_t int32;
|
||||||
typedef uint32_t uint32;
|
|
||||||
|
|
||||||
#elif SIZEOF_INT == 4
|
#elif SIZEOF_INT == 4
|
||||||
|
|
||||||
#ifndef HAVE_INT32
|
|
||||||
typedef signed int int32;
|
typedef signed int int32;
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT32
|
|
||||||
typedef unsigned int uint32;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif SIZEOF_LONG == 4
|
#elif SIZEOF_LONG == 4
|
||||||
|
|
||||||
#ifndef HAVE_INT32
|
|
||||||
typedef signed long int32;
|
typedef signed long int32;
|
||||||
|
#else
|
||||||
|
error "Neither int nor long is of 4 bytes width"
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* HAVE_INT32 */
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_UINT32
|
#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;
|
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 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 */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
#define MYSQLND_LLU_SPEC "%I64u"
|
||||||
|
#define MYSQLND_LL_SPEC "%I64d"
|
||||||
|
#ifndef L64
|
||||||
|
#define L64(x) x##i64
|
||||||
|
#endif
|
||||||
|
typedef __int64 int64;
|
||||||
|
typedef unsigned __int64 uint64;
|
||||||
|
#else
|
||||||
|
#define MYSQLND_LLU_SPEC "%llu"
|
||||||
|
#define MYSQLND_LL_SPEC "%lld"
|
||||||
|
#ifndef L64
|
||||||
|
#define L64(x) x##LL
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
error "Neither int or long is of 4 bytes width"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_ULONG) && !defined(__USE_MISC) && !defined(ulong)
|
typedef int64 longlong;
|
||||||
typedef unsigned long ulong; /* Short for unsigned long */
|
typedef uint64 ulonglong;
|
||||||
#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;
|
|
||||||
#else
|
|
||||||
typedef unsigned long ulonglong; /* ulong or unsigned long long */
|
|
||||||
typedef long longlong;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define int1store(T,A) do { *((zend_uchar*) (T)) = (A); } while(0)
|
#define int1store(T,A) do { *((zend_uchar*) (T)) = (A); } while(0)
|
||||||
|
@ -280,29 +317,9 @@ typedef union {
|
||||||
(((uint32) ((uchar) (A)[1])) << 8) +\
|
(((uint32) ((uchar) (A)[1])) << 8) +\
|
||||||
(((uint32) ((uchar) (A)[2])) << 16) +\
|
(((uint32) ((uchar) (A)[2])) << 16) +\
|
||||||
(((uint32) ((uchar) (A)[3])) << 24))
|
(((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))[6])) << 8) +\
|
||||||
(((uint32) (((uchar*) (A))[5])) << 16) +\
|
(((uint32) (((uchar*) (A))[5])) << 16) +\
|
||||||
(((uint32) (((uchar*) (A))[4])) << 24)) +\
|
(((uint32) (((uchar*) (A))[4])) << 24)) +\
|
||||||
|
@ -473,37 +490,6 @@ typedef union {
|
||||||
#endif /* WORDS_BIGENDIAN */
|
#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:
|
* Local variables:
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
#define MAX_CHARSET_LEN 32
|
#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 */
|
/* Error handling */
|
||||||
#define SET_NEW_MESSAGE(buf, buf_len, message, len, persistent) \
|
#define SET_NEW_MESSAGE(buf, buf_len, message, len, persistent) \
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_result)(MYSQLND_STMT * const stmt,
|
||||||
|
|
||||||
|
|
||||||
/* {{{ mysqlnd_stmt::insert_id */
|
/* {{{ mysqlnd_stmt::insert_id */
|
||||||
static mynd_ulonglong
|
static uint64
|
||||||
MYSQLND_METHOD(mysqlnd_stmt, insert_id)(const MYSQLND_STMT * const stmt)
|
MYSQLND_METHOD(mysqlnd_stmt, insert_id)(const MYSQLND_STMT * const stmt)
|
||||||
{
|
{
|
||||||
return stmt->upsert_status.last_insert_id;
|
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 */
|
/* {{{ mysqlnd_stmt::affected_rows */
|
||||||
static mynd_ulonglong
|
static uint64
|
||||||
MYSQLND_METHOD(mysqlnd_stmt, affected_rows)(const MYSQLND_STMT * const stmt)
|
MYSQLND_METHOD(mysqlnd_stmt, affected_rows)(const MYSQLND_STMT * const stmt)
|
||||||
{
|
{
|
||||||
return stmt->upsert_status.affected_rows;
|
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 */
|
/* {{{ mysqlnd_stmt::num_rows */
|
||||||
static mynd_ulonglong
|
static uint64
|
||||||
MYSQLND_METHOD(mysqlnd_stmt, num_rows)(const MYSQLND_STMT * const stmt)
|
MYSQLND_METHOD(mysqlnd_stmt, num_rows)(const MYSQLND_STMT * const stmt)
|
||||||
{
|
{
|
||||||
return stmt->result? mysqlnd_num_rows(stmt->result):0;
|
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 */
|
/* {{{ mysqlnd_stmt::data_seek */
|
||||||
static enum_func_status
|
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;
|
return stmt->result? stmt->result->m.seek_data(stmt->result, row TSRMLS_CC) : FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,17 +73,17 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
|
||||||
size_t tmp_len = 0;
|
size_t tmp_len = 0;
|
||||||
zend_bool is_bit = field->type == MYSQL_TYPE_BIT;
|
zend_bool is_bit = field->type == MYSQL_TYPE_BIT;
|
||||||
if (field->flags & UNSIGNED_FLAG) {
|
if (field->flags & UNSIGNED_FLAG) {
|
||||||
my_uint64 uval = 0;
|
uint64 uval = 0;
|
||||||
|
|
||||||
switch (byte_count) {
|
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 7:uval = bit_uint7korr(*row);break;
|
||||||
case 6:uval = bit_uint6korr(*row);break;
|
case 6:uval = bit_uint6korr(*row);break;
|
||||||
case 5:uval = bit_uint5korr(*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 4:uval = is_bit? (uint64) bit_uint4korr(*row):(uint64) uint4korr(*row);break;
|
||||||
case 3:uval = is_bit? (my_uint64) bit_uint3korr(*row):(my_uint64) uint3korr(*row);break;
|
case 3:uval = is_bit? (uint64) bit_uint3korr(*row):(uint64) uint3korr(*row);break;
|
||||||
case 2:uval = is_bit? (my_uint64) bit_uint2korr(*row):(my_uint64) uint2korr(*row);break;
|
case 2:uval = is_bit? (uint64) bit_uint2korr(*row):(uint64) uint2korr(*row);break;
|
||||||
case 1:uval = (my_uint64) uint1korr(*row);break;
|
case 1:uval = (uint64) uint1korr(*row);break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SIZEOF_LONG==4
|
#if SIZEOF_LONG==4
|
||||||
|
@ -100,21 +100,21 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* SIGNED */
|
/* SIGNED */
|
||||||
my_int64 lval = 0;
|
int64 lval = 0;
|
||||||
switch (byte_count) {
|
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.
|
7, 6 and 5 are not possible.
|
||||||
BIT is only unsigned, thus only uint5|6|7 macroses exist
|
BIT is only unsigned, thus only uint5|6|7 macroses exist
|
||||||
*/
|
*/
|
||||||
case 4:lval = (my_int64) sint4korr(*row);break;
|
case 4:lval = (int64) sint4korr(*row);break;
|
||||||
case 3:lval = (my_int64) sint3korr(*row);break;
|
case 3:lval = (int64) sint3korr(*row);break;
|
||||||
case 2:lval = (my_int64) sint2korr(*row);break;
|
case 2:lval = (int64) sint2korr(*row);break;
|
||||||
case 1:lval = (my_int64) *(my_int8*)*row;break;
|
case 1:lval = (int64) *(my_int8*)*row;break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SIZEOF_LONG==4
|
#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);
|
tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval);
|
||||||
} else
|
} else
|
||||||
#endif /* SIZEOF */
|
#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);
|
ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 8 TSRMLS_CC);
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
my_uint64 llval = (my_uint64) sint8korr(*row);
|
uint64 llval = (uint64) sint8korr(*row);
|
||||||
zend_bool uns = field->flags & UNSIGNED_FLAG? TRUE:FALSE;
|
zend_bool uns = field->flags & UNSIGNED_FLAG? TRUE:FALSE;
|
||||||
|
|
||||||
#if SIZEOF_LONG==8
|
#if SIZEOF_LONG==8
|
||||||
if (uns == TRUE && llval > 9223372036854775807L) {
|
if (uns == TRUE && llval > 9223372036854775807L) {
|
||||||
#elif SIZEOF_LONG==4
|
#elif SIZEOF_LONG==4
|
||||||
if ((uns == TRUE && llval > L64(2147483647)) ||
|
if ((uns == TRUE && llval > L64(2147483647)) ||
|
||||||
(uns == FALSE && ((L64( 2147483647) < (my_int64) llval) ||
|
(uns == FALSE && ((L64( 2147483647) < (int64) llval) ||
|
||||||
(L64(-2147483648) > (my_int64) llval))))
|
(L64(-2147483648) > (int64) llval))))
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
char tmp[22];
|
char tmp[22];
|
||||||
|
|
|
@ -765,7 +765,7 @@ mysqlnd_store_result_fetch_data(MYSQLND * const conn, MYSQLND_RES *result,
|
||||||
zval **current_row;
|
zval **current_row;
|
||||||
|
|
||||||
if (!free_rows) {
|
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;
|
total_rows += set->row_count;
|
||||||
set->data = mnd_perealloc(set->data, total_rows * sizeof(zval **), set->persistent);
|
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 */
|
/* {{{ mysqlnd_res::data_seek */
|
||||||
static enum_func_status
|
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_ENTER("mysqlnd_res::data_seek");
|
||||||
DBG_INF_FMT("row=%lu", row);
|
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 */
|
/* {{{ mysqlnd_res::num_fields */
|
||||||
mynd_ulonglong
|
uint64
|
||||||
MYSQLND_METHOD(mysqlnd_res, num_rows)(const MYSQLND_RES * const res)
|
MYSQLND_METHOD(mysqlnd_res, num_rows)(const MYSQLND_RES * const res)
|
||||||
{
|
{
|
||||||
/* Be compatible with libmysql. We count row_count, but will return 0 */
|
/* Be compatible with libmysql. We count row_count, but will return 0 */
|
||||||
|
|
|
@ -86,7 +86,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||||
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \
|
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \
|
||||||
{ \
|
{ \
|
||||||
if (MYSQLND_G(collect_statistics)) { \
|
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]); \
|
DBG_INF_FMT("Global&Conn stat increase w value [%s]", mysqlnd_stats_values_names[statistic]); \
|
||||||
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
|
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
|
||||||
mysqlnd_global_stats->values[(statistic)] += v; \
|
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) \
|
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \
|
||||||
{ \
|
{ \
|
||||||
if (MYSQLND_G(collect_statistics)) { \
|
if (MYSQLND_G(collect_statistics)) { \
|
||||||
my_uint64 v1 = (my_uint64) (value1); \
|
uint64 v1 = (uint64) (value1); \
|
||||||
my_uint64 v2 = (my_uint64) (value2); \
|
uint64 v2 = (uint64) (value2); \
|
||||||
my_uint64 v3 = (my_uint64) (value3); \
|
uint64 v3 = (uint64) (value3); \
|
||||||
\
|
\
|
||||||
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
|
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
|
||||||
mysqlnd_global_stats->values[(statistic1)]+= v1; \
|
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) \
|
#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]); \
|
DBG_INF_FMT("Global&Conn stats increase w value [%s]", mysqlnd_stats_values_names[statistic]); \
|
||||||
if (MYSQLND_G(collect_statistics)) { \
|
if (MYSQLND_G(collect_statistics)) { \
|
||||||
mysqlnd_global_stats->values[(statistic)] += v; \
|
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) \
|
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \
|
||||||
{ \
|
{ \
|
||||||
if (MYSQLND_G(collect_statistics)) { \
|
if (MYSQLND_G(collect_statistics)) { \
|
||||||
my_uint64 v1 = (my_uint64) (value1); \
|
uint64 v1 = (uint64) (value1); \
|
||||||
my_uint64 v2 = (my_uint64) (value2); \
|
uint64 v2 = (uint64) (value2); \
|
||||||
my_uint64 v3 = (my_uint64) (value3); \
|
uint64 v3 = (uint64) (value3); \
|
||||||
\
|
\
|
||||||
mysqlnd_global_stats->values[(statistic1)]+= v1; \
|
mysqlnd_global_stats->values[(statistic1)]+= v1; \
|
||||||
mysqlnd_global_stats->values[(statistic2)]+= v2; \
|
mysqlnd_global_stats->values[(statistic2)]+= v2; \
|
||||||
|
|
|
@ -62,8 +62,8 @@ typedef struct st_mysqlnd_upsert_result
|
||||||
{
|
{
|
||||||
unsigned int warning_count;
|
unsigned int warning_count;
|
||||||
unsigned int server_status;
|
unsigned int server_status;
|
||||||
mynd_ulonglong affected_rows;
|
uint64 affected_rows;
|
||||||
mynd_ulonglong last_insert_id;
|
uint64 last_insert_id;
|
||||||
} mysqlnd_upsert_status;
|
} mysqlnd_upsert_status;
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ typedef enum_func_status (*mysqlnd_fetch_row_func)(MYSQLND_RES *result,
|
||||||
|
|
||||||
typedef struct st_mysqlnd_stats
|
typedef struct st_mysqlnd_stats
|
||||||
{
|
{
|
||||||
my_uint64 values[STAT_LAST];
|
uint64 values[STAT_LAST];
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
MUTEX_T LOCK_access;
|
MUTEX_T LOCK_access;
|
||||||
#endif
|
#endif
|
||||||
|
@ -223,7 +223,7 @@ struct st_mysqlnd_conn_methods
|
||||||
unsigned int (*get_error_no)(const MYSQLND * const conn);
|
unsigned int (*get_error_no)(const MYSQLND * const conn);
|
||||||
const char * (*get_error_str)(const MYSQLND * const conn);
|
const char * (*get_error_str)(const MYSQLND * const conn);
|
||||||
const char * (*get_sqlstate)(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);
|
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);
|
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_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);
|
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);
|
uint64 (*get_last_insert_id)(const MYSQLND * const conn);
|
||||||
mynd_ulonglong (*get_affected_rows)(const MYSQLND * const conn);
|
uint64 (*get_affected_rows)(const MYSQLND * const conn);
|
||||||
unsigned int (*get_warning_count)(const MYSQLND * const conn);
|
unsigned int (*get_warning_count)(const MYSQLND * const conn);
|
||||||
|
|
||||||
unsigned int (*get_field_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_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_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);
|
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);
|
unsigned int (*num_fields)(const MYSQLND_RES * const result);
|
||||||
enum_func_status (*skip_result)(MYSQLND_RES * const result TSRMLS_DC);
|
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 (*seek_field)(MYSQLND_RES * const result, MYSQLND_FIELD_OFFSET field_offset);
|
||||||
MYSQLND_FIELD_OFFSET (*field_tell)(const MYSQLND_RES * const result);
|
MYSQLND_FIELD_OFFSET (*field_tell)(const MYSQLND_RES * const result);
|
||||||
MYSQLND_FIELD * (*fetch_field)(MYSQLND_RES * const result TSRMLS_DC);
|
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 * (*store_result)(MYSQLND_STMT * const stmt TSRMLS_DC);
|
||||||
MYSQLND_RES * (*get_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 (*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 (*reset)(MYSQLND_STMT * const stmt TSRMLS_DC);
|
||||||
enum_func_status (*close)(MYSQLND_STMT * const stmt, zend_bool implicit TSRMLS_DC); /* private */
|
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 */
|
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_parameter_metadata)(MYSQLND_STMT * const stmt);
|
||||||
MYSQLND_RES * (*get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC);
|
MYSQLND_RES * (*get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC);
|
||||||
|
|
||||||
mynd_ulonglong (*get_last_insert_id)(const MYSQLND_STMT * const stmt);
|
uint64 (*get_last_insert_id)(const MYSQLND_STMT * const stmt);
|
||||||
mynd_ulonglong (*get_affected_rows)(const MYSQLND_STMT * const stmt);
|
uint64 (*get_affected_rows)(const MYSQLND_STMT * const stmt);
|
||||||
mynd_ulonglong (*get_num_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_param_count)(const MYSQLND_STMT * const stmt);
|
||||||
unsigned int (*get_field_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;
|
char *passwd;
|
||||||
unsigned int *passwd_len;
|
unsigned int *passwd_len;
|
||||||
char *scheme;
|
char *scheme;
|
||||||
mynd_ulonglong thread_id;
|
uint64 thread_id;
|
||||||
char *server_version;
|
char *server_version;
|
||||||
char *host_info;
|
char *host_info;
|
||||||
unsigned char *scramble;
|
unsigned char *scramble;
|
||||||
|
@ -440,7 +440,7 @@ struct st_mysqlnd_buffered_result
|
||||||
zval ***data;
|
zval ***data;
|
||||||
zval ***data_cursor;
|
zval ***data_cursor;
|
||||||
zend_uchar **row_buffers;
|
zend_uchar **row_buffers;
|
||||||
mynd_ulonglong row_count;
|
uint64 row_count;
|
||||||
zend_bool persistent;
|
zend_bool persistent;
|
||||||
|
|
||||||
MYSQLND_QCACHE *qcache;
|
MYSQLND_QCACHE *qcache;
|
||||||
|
@ -457,7 +457,7 @@ struct st_mysqlnd_unbuffered_result
|
||||||
zval **last_row_data;
|
zval **last_row_data;
|
||||||
zend_uchar *last_row_buffer;
|
zend_uchar *last_row_buffer;
|
||||||
|
|
||||||
mynd_ulonglong row_count;
|
uint64 row_count;
|
||||||
zend_bool eof_reached;
|
zend_bool eof_reached;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -126,48 +126,48 @@ unsigned long php_mysqlnd_net_field_length(zend_uchar **packet)
|
||||||
|
|
||||||
/* {{{ php_mysqlnd_net_field_length_ll
|
/* {{{ php_mysqlnd_net_field_length_ll
|
||||||
Get next field's length */
|
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;
|
register zend_uchar *p= (zend_uchar *)*packet;
|
||||||
|
|
||||||
if (*p < 251) {
|
if (*p < 251) {
|
||||||
(*packet)++;
|
(*packet)++;
|
||||||
return (mynd_ulonglong) *p;
|
return (uint64) *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 251:
|
case 251:
|
||||||
(*packet)++;
|
(*packet)++;
|
||||||
return (mynd_ulonglong) MYSQLND_NULL_LENGTH;
|
return (uint64) MYSQLND_NULL_LENGTH;
|
||||||
case 252:
|
case 252:
|
||||||
(*packet) += 3;
|
(*packet) += 3;
|
||||||
return (mynd_ulonglong) uint2korr(p + 1);
|
return (uint64) uint2korr(p + 1);
|
||||||
case 253:
|
case 253:
|
||||||
(*packet) += 4;
|
(*packet) += 4;
|
||||||
return (mynd_ulonglong) uint3korr(p + 1);
|
return (uint64) uint3korr(p + 1);
|
||||||
default:
|
default:
|
||||||
(*packet) += 9;
|
(*packet) += 9;
|
||||||
return (mynd_ulonglong) uint8korr(p + 1);
|
return (uint64) uint8korr(p + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ php_mysqlnd_net_store_length */
|
/* {{{ 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;
|
*packet = (zend_uchar) length;
|
||||||
return packet + 1;
|
return packet + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length < (mynd_ulonglong) L64(65536)) {
|
if (length < (uint64) L64(65536)) {
|
||||||
*packet++ = 252;
|
*packet++ = 252;
|
||||||
int2store(packet,(uint) length);
|
int2store(packet,(uint) length);
|
||||||
return packet + 2;
|
return packet + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length < (mynd_ulonglong) L64(16777216)) {
|
if (length < (uint64) L64(16777216)) {
|
||||||
*packet++ = 253;
|
*packet++ = 253;
|
||||||
int3store(packet,(ulong) length);
|
int3store(packet,(ulong) length);
|
||||||
return packet + 3;
|
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)
|
if (perm_bind.pack_len < SIZEOF_LONG)
|
||||||
{
|
{
|
||||||
/* direct conversion */
|
/* direct conversion */
|
||||||
my_int64 v = atoll((char *) p);
|
int64 v = atoll((char *) p);
|
||||||
ZVAL_LONG(*current_field, v);
|
ZVAL_LONG(*current_field, v);
|
||||||
} else {
|
} 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;
|
zend_bool uns = packet->fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE;
|
||||||
/* We have to make it ASCIIZ temporarily */
|
/* We have to make it ASCIIZ temporarily */
|
||||||
#if SIZEOF_LONG==8
|
#if SIZEOF_LONG==8
|
||||||
if (uns == TRUE && v > 9223372036854775807L)
|
if (uns == TRUE && v > 9223372036854775807L)
|
||||||
#elif SIZEOF_LONG==4
|
#elif SIZEOF_LONG==4
|
||||||
if ((uns == TRUE && v > L64(2147483647)) ||
|
if ((uns == TRUE && v > L64(2147483647)) ||
|
||||||
(uns == FALSE && (( L64(2147483647) < (my_int64) v) ||
|
(uns == FALSE && (( L64(2147483647) < (int64) v) ||
|
||||||
(L64(-2147483648) > (my_int64) v))))
|
(L64(-2147483648) > (int64) v))))
|
||||||
#endif /* SIZEOF */
|
#endif /* SIZEOF */
|
||||||
{
|
{
|
||||||
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
|
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
|
||||||
} else {
|
} else {
|
||||||
ZVAL_LONG(*current_field, (my_int64)v);
|
ZVAL_LONG(*current_field, (int64)v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*(p + len) = save;
|
*(p + len) = save;
|
||||||
|
@ -1472,7 +1472,7 @@ void php_mysqlnd_rowp_read_text_protocol(php_mysql_packet_row *packet, MYSQLND *
|
||||||
p -= len;
|
p -= len;
|
||||||
if (Z_TYPE_PP(current_field) == IS_LONG) {
|
if (Z_TYPE_PP(current_field) == IS_LONG) {
|
||||||
bit_area += 1 + sprintf((char *)start, MYSQLND_LLU_SPEC,
|
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 PHP_MAJOR_VERSION >= 6
|
||||||
if (as_unicode) {
|
if (as_unicode) {
|
||||||
ZVAL_UTF8_STRINGL(*current_field, start, bit_area - start - 1, 0);
|
ZVAL_UTF8_STRINGL(*current_field, start, bit_area - start - 1, 0);
|
||||||
|
|
|
@ -173,8 +173,8 @@ typedef struct st_php_mysql_packet_auth {
|
||||||
typedef struct st_php_mysql_packet_ok {
|
typedef struct st_php_mysql_packet_ok {
|
||||||
mysqlnd_packet_header header;
|
mysqlnd_packet_header header;
|
||||||
mysqlnd_1b field_count; /* always 0x0 */
|
mysqlnd_1b field_count; /* always 0x0 */
|
||||||
mynd_ulonglong affected_rows;
|
uint64 affected_rows;
|
||||||
mynd_ulonglong last_insert_id;
|
uint64 last_insert_id;
|
||||||
mysqlnd_2b server_status;
|
mysqlnd_2b server_status;
|
||||||
mysqlnd_2b warning_count;
|
mysqlnd_2b warning_count;
|
||||||
char *message;
|
char *message;
|
||||||
|
@ -225,8 +225,8 @@ typedef struct st_php_mysql_packet_rset_header {
|
||||||
*/
|
*/
|
||||||
mysqlnd_2b warning_count;
|
mysqlnd_2b warning_count;
|
||||||
mysqlnd_2b server_status;
|
mysqlnd_2b server_status;
|
||||||
mynd_ulonglong affected_rows;
|
uint64 affected_rows;
|
||||||
mynd_ulonglong last_insert_id;
|
uint64 last_insert_id;
|
||||||
/* This is for both LOAD DATA or info, when no result set */
|
/* This is for both LOAD DATA or info, when no result set */
|
||||||
char *info_or_local_file;
|
char *info_or_local_file;
|
||||||
size_t info_or_local_file_len;
|
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);
|
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);
|
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;
|
extern char * const mysqlnd_empty_string;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue