mirror of
https://github.com/php/php-src.git
synced 2026-04-20 22:41:20 +02:00
CS + WS changes
This commit is contained in:
@@ -224,8 +224,8 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_conn, dtor)(MYSQLND *conn TSRMLS_DC)
|
||||
/* {{{ mysqlnd_conn::simple_command_handle_response */
|
||||
static enum_func_status
|
||||
MYSQLND_METHOD(mysqlnd_conn, simple_command_handle_response)(MYSQLND *conn, enum mysqlnd_packet_type ok_packet,
|
||||
zend_bool silent, enum php_mysqlnd_server_command command,
|
||||
zend_bool ignore_upsert_status TSRMLS_DC)
|
||||
zend_bool silent, enum php_mysqlnd_server_command command,
|
||||
zend_bool ignore_upsert_status TSRMLS_DC)
|
||||
{
|
||||
enum_func_status ret;
|
||||
|
||||
@@ -282,19 +282,17 @@ MYSQLND_METHOD(mysqlnd_conn, simple_command_handle_response)(MYSQLND *conn, enum
|
||||
if (!silent) {
|
||||
DBG_ERR_FMT("Error while reading %s's EOF packet", mysqlnd_command_to_text[command]);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading %s's EOF packet. PID=%d",
|
||||
mysqlnd_command_to_text[command], getpid());
|
||||
mysqlnd_command_to_text[command], getpid());
|
||||
}
|
||||
} else if (0xFF == ok_response->field_count) {
|
||||
/* The server signalled error. Set the error */
|
||||
SET_CLIENT_ERROR(conn->error_info, ok_response->error_no, ok_response->sqlstate, ok_response->error);
|
||||
SET_ERROR_AFF_ROWS(conn);
|
||||
} else if (0xFE != ok_response->field_count) {
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE,
|
||||
"Malformed packet");
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "Malformed packet");
|
||||
if (!silent) {
|
||||
DBG_ERR_FMT("EOF packet expected, field count wasn't 0xFE but 0x%2X", ok_response->field_count);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"EOF packet expected, field count wasn't 0xFE but 0x%2X",
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "EOF packet expected, field count wasn't 0xFE but 0x%2X",
|
||||
ok_response->field_count);
|
||||
}
|
||||
} else {
|
||||
@@ -305,10 +303,8 @@ MYSQLND_METHOD(mysqlnd_conn, simple_command_handle_response)(MYSQLND *conn, enum
|
||||
}
|
||||
default:
|
||||
ret = FAIL;
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE,
|
||||
"Malformed packet");
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrong response packet %d passed to the function",
|
||||
ok_packet);
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "Malformed packet");
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrong response packet %d passed to the function", ok_packet);
|
||||
break;
|
||||
}
|
||||
DBG_INF(ret == PASS ? "PASS":"FAIL");
|
||||
@@ -543,7 +539,7 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND *conn,
|
||||
ok_packet = conn->protocol->m.get_ok_packet(conn->protocol, FALSE TSRMLS_CC);
|
||||
|
||||
if (FAIL == conn->net->m.connect(conn->net, conn->scheme, conn->scheme_len, conn->persistent, &errstr, &errcode TSRMLS_CC)) {
|
||||
goto err;
|
||||
goto err;
|
||||
}
|
||||
|
||||
DBG_INF_FMT("stream=%p", conn->net->stream);
|
||||
@@ -594,9 +590,7 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND *conn,
|
||||
auth_packet->user = user;
|
||||
auth_packet->password = passwd;
|
||||
|
||||
if (conn->options.charset_name &&
|
||||
(charset = mysqlnd_find_charset_name(conn->options.charset_name)))
|
||||
{
|
||||
if (conn->options.charset_name && (charset = mysqlnd_find_charset_name(conn->options.charset_name))) {
|
||||
auth_packet->charset_no = charset->nr;
|
||||
} else {
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
@@ -721,8 +715,7 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND *conn,
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
{
|
||||
unsigned int as_unicode = 1;
|
||||
conn->m->set_client_option(conn, MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE,
|
||||
(char *)&as_unicode TSRMLS_CC);
|
||||
conn->m->set_client_option(conn, MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE, (char *)&as_unicode TSRMLS_CC);
|
||||
DBG_INF("unicode set");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -111,7 +111,7 @@ mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, unsigned int siz
|
||||
chunk->ptr = new_ptr;
|
||||
chunk->size = size;
|
||||
chunk->pool = NULL; /* now we have no pool memory */
|
||||
pool->refcount--;
|
||||
pool->refcount--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -663,7 +663,7 @@ PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const name
|
||||
|
||||
/* {{{ mysqlnd_cset_escape_quotes */
|
||||
PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr,
|
||||
const char *escapestr, size_t escapestr_len TSRMLS_DC)
|
||||
const char * escapestr, size_t escapestr_len TSRMLS_DC)
|
||||
{
|
||||
const char *newstr_s = newstr;
|
||||
const char *newstr_e = newstr + 2 * escapestr_len;
|
||||
@@ -717,7 +717,7 @@ PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char
|
||||
|
||||
/* {{{ mysqlnd_cset_escape_slashes */
|
||||
PHPAPI ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
|
||||
const char *escapestr, size_t escapestr_len TSRMLS_DC)
|
||||
const char * escapestr, size_t escapestr_len TSRMLS_DC)
|
||||
{
|
||||
const char *newstr_s = newstr;
|
||||
const char *newstr_e = newstr + 2 * escapestr_len;
|
||||
|
||||
@@ -116,10 +116,8 @@ MYSQLND_METHOD(mysqlnd_debug, log)(MYSQLND_DEBUG * self,
|
||||
line_buffer[6], level_buffer[7];
|
||||
MYSQLND_ZTS(self);
|
||||
|
||||
if (!self->stream) {
|
||||
if (FAIL == self->m->open(self, FALSE)) {
|
||||
return FAIL;
|
||||
}
|
||||
if (!self->stream && FAIL == self->m->open(self, FALSE)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (level == -1) {
|
||||
@@ -188,10 +186,10 @@ MYSQLND_METHOD(mysqlnd_debug, log)(MYSQLND_DEBUG * self,
|
||||
pipe_buffer, type? type:"", message);
|
||||
|
||||
ret = php_stream_write(self->stream, message_line, message_line_len)? PASS:FAIL;
|
||||
efree(message_line);
|
||||
efree(message_line); /* allocated by spprintf */
|
||||
if (flags & MYSQLND_DEBUG_FLUSH) {
|
||||
self->m->close(self);
|
||||
self->m->open(self, TRUE);
|
||||
self->m->open(self, TRUE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -216,10 +214,8 @@ MYSQLND_METHOD(mysqlnd_debug, log_va)(MYSQLND_DEBUG *self,
|
||||
line_buffer[6], level_buffer[7];
|
||||
MYSQLND_ZTS(self);
|
||||
|
||||
if (!self->stream) {
|
||||
if (FAIL == self->m->open(self, FALSE)) {
|
||||
return FAIL;
|
||||
}
|
||||
if (!self->stream && FAIL == self->m->open(self, FALSE)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (level == -1) {
|
||||
@@ -294,11 +290,11 @@ MYSQLND_METHOD(mysqlnd_debug, log_va)(MYSQLND_DEBUG *self,
|
||||
efree(buffer);
|
||||
|
||||
ret = php_stream_write(self->stream, message_line, message_line_len)? PASS:FAIL;
|
||||
efree(message_line);
|
||||
efree(message_line); /* allocated by spprintf */
|
||||
|
||||
if (flags & MYSQLND_DEBUG_FLUSH) {
|
||||
self->m->close(self);
|
||||
self->m->open(self, TRUE);
|
||||
self->m->open(self, TRUE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -324,7 +320,7 @@ MYSQLND_METHOD(mysqlnd_debug, func_enter)(MYSQLND_DEBUG * self,
|
||||
while (*p) {
|
||||
if (*p == func_name) {
|
||||
zend_stack_push(&self->call_stack, "", sizeof(""));
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
@@ -346,8 +342,7 @@ MYSQLND_METHOD(mysqlnd_debug, func_enter)(MYSQLND_DEBUG * self,
|
||||
|
||||
/* {{{ mysqlnd_res_meta::func_leave */
|
||||
static enum_func_status
|
||||
MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line,
|
||||
const char * const file)
|
||||
MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line, const char * const file)
|
||||
{
|
||||
char *func_name;
|
||||
if ((self->flags & MYSQLND_DEBUG_DUMP_TRACE) == 0 || self->file_name == NULL) {
|
||||
@@ -362,7 +357,7 @@ MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int lin
|
||||
if (func_name[0] == '\0') {
|
||||
; /* don't log that function */
|
||||
} else if (!zend_hash_num_elements(&self->not_filtered_functions) ||
|
||||
1 == zend_hash_exists(&self->not_filtered_functions, func_name, strlen(func_name) + 1))
|
||||
1 == zend_hash_exists(&self->not_filtered_functions, func_name, strlen(func_name) + 1))
|
||||
{
|
||||
self->m->log_va(self, line, file, zend_stack_count(&self->call_stack) - 1, NULL, "<%s", func_name);
|
||||
}
|
||||
@@ -496,7 +491,7 @@ MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const
|
||||
} else {
|
||||
#if 0
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Expected list of functions for '%c' found none", mode[i]);
|
||||
"Expected list of functions for '%c' found none", mode[i]);
|
||||
#endif
|
||||
}
|
||||
state = PARSER_WAIT_COLON;
|
||||
@@ -585,7 +580,7 @@ MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const
|
||||
state = PARSER_WAIT_COLON;
|
||||
} else if (state == PARSER_WAIT_COLON) {
|
||||
#if 0
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Colon expected, '%c' found", mode[i]);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Colon expected, '%c' found", mode[i]);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@@ -719,7 +714,7 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
|
||||
ret = ecalloc(nmemb, REAL_SIZE(size));
|
||||
|
||||
DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
if (collect_memory_statistics) {
|
||||
*(size_t *) ret = size;
|
||||
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 1, STAT_MEM_ECALLOC_AMOUNT, size);
|
||||
@@ -738,7 +733,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M
|
||||
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
|
||||
|
||||
ret = pecalloc(nmemb, REAL_SIZE(size), persistent);
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
|
||||
if (collect_memory_statistics) {
|
||||
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
|
||||
@@ -764,7 +759,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
|
||||
|
||||
ret = erealloc(REAL_PTR(ptr), REAL_SIZE(new_size));
|
||||
|
||||
DBG_INF_FMT("new_ptr=%p", ret);
|
||||
DBG_INF_FMT("new_ptr=%p", (char*)ret);
|
||||
if (collect_memory_statistics) {
|
||||
*(size_t *) ret = new_size;
|
||||
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT, 1, STAT_MEM_EREALLOC_AMOUNT, new_size);
|
||||
@@ -786,7 +781,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL
|
||||
|
||||
ret = perealloc(REAL_PTR(ptr), REAL_SIZE(new_size), persistent);
|
||||
|
||||
DBG_INF_FMT("new_ptr=%p", ret);
|
||||
DBG_INF_FMT("new_ptr=%p", (char*)ret);
|
||||
|
||||
if (collect_memory_statistics) {
|
||||
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
|
||||
@@ -859,7 +854,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
|
||||
|
||||
ret = malloc(REAL_SIZE(size));
|
||||
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
if (collect_memory_statistics) {
|
||||
*(size_t *) ret = size;
|
||||
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMOUNT, size);
|
||||
@@ -879,7 +874,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
|
||||
|
||||
ret = calloc(nmemb, REAL_SIZE(size));
|
||||
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
|
||||
if (collect_memory_statistics) {
|
||||
*(size_t *) ret = size;
|
||||
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMOUNT, size);
|
||||
@@ -901,7 +896,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D)
|
||||
|
||||
ret = realloc(REAL_PTR(ptr), REAL_SIZE(new_size));
|
||||
|
||||
DBG_INF_FMT("new_ptr=%p", ret);
|
||||
DBG_INF_FMT("new_ptr=%p", (char*)ret);
|
||||
|
||||
if (collect_memory_statistics) {
|
||||
*(size_t *) ret = new_size;
|
||||
|
||||
@@ -267,11 +267,11 @@ typedef enum mysqlnd_server_option
|
||||
|
||||
|
||||
/*
|
||||
/-----> CONN_CLOSE <---------------\
|
||||
| ^ \
|
||||
| | \
|
||||
/-----> CONN_CLOSE <---------------\
|
||||
| ^ \
|
||||
| | \
|
||||
CONN_READY -> CONN_QUERY_SENT -> CONN_FETCHING_DATA
|
||||
^ |
|
||||
^ |
|
||||
\-------------------------------------/
|
||||
*/
|
||||
typedef enum mysqlnd_connection_state
|
||||
@@ -548,15 +548,15 @@ enum php_mysqlnd_server_command
|
||||
|
||||
#define MYSQLND_DEFAULT_PREFETCH_ROWS (ulong) 1
|
||||
|
||||
#define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */
|
||||
#define MYSQLND_REFRESH_LOG 2 /* Start on new log file */
|
||||
#define MYSQLND_REFRESH_TABLES 4 /* close all tables */
|
||||
#define MYSQLND_REFRESH_HOSTS 8 /* Flush host cache */
|
||||
#define MYSQLND_REFRESH_STATUS 16 /* Flush status variables */
|
||||
#define MYSQLND_REFRESH_THREADS 32 /* Flush thread cache */
|
||||
#define MYSQLND_REFRESH_SLAVE 64 /* Reset master info and restart slave */
|
||||
#define MYSQLND_REFRESH_MASTER 128 /* Remove all bin logs in the index */
|
||||
#define MYSQLND_REFRESH_BACKUP_LOG 0x200000L
|
||||
#define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */
|
||||
#define MYSQLND_REFRESH_LOG 2 /* Start on new log file */
|
||||
#define MYSQLND_REFRESH_TABLES 4 /* close all tables */
|
||||
#define MYSQLND_REFRESH_HOSTS 8 /* Flush host cache */
|
||||
#define MYSQLND_REFRESH_STATUS 16 /* Flush status variables */
|
||||
#define MYSQLND_REFRESH_THREADS 32 /* Flush thread cache */
|
||||
#define MYSQLND_REFRESH_SLAVE 64 /* Reset master info and restart slave */
|
||||
#define MYSQLND_REFRESH_MASTER 128 /* Remove all bin logs in the index */
|
||||
#define MYSQLND_REFRESH_BACKUP_LOG 0x200000L
|
||||
|
||||
#endif /* MYSQLND_ENUM_N_DEF_H */
|
||||
|
||||
|
||||
@@ -122,14 +122,14 @@
|
||||
#define mysql_warning_count(r) mysqlnd_warning_count((r))
|
||||
#define mysql_eof(r) (((r)->unbuf && (r)->unbuf->eof_reached) || (r)->stored_data)
|
||||
|
||||
#define REFRESH_GRANT MYSQLND_REFRESH_GRANT
|
||||
#define REFRESH_LOG MYSQLND_REFRESH_LOG
|
||||
#define REFRESH_TABLES MYSQLND_REFRESH_TABLES
|
||||
#define REFRESH_HOSTS MYSQLND_REFRESH_HOSTS
|
||||
#define REFRESH_STATUS MYSQLND_REFRESH_STATUS
|
||||
#define REFRESH_THREADS MYSQLND_REFRESH_THREADS
|
||||
#define REFRESH_SLAVE MYSQLND_REFRESH_SLAVE
|
||||
#define REFRESH_MASTER MYSQLND_REFRESH_MASTER
|
||||
#define REFRESH_BACKUP_LOG MYSQLND_REFRESH_BACKUP_LOG
|
||||
#define REFRESH_GRANT MYSQLND_REFRESH_GRANT
|
||||
#define REFRESH_LOG MYSQLND_REFRESH_LOG
|
||||
#define REFRESH_TABLES MYSQLND_REFRESH_TABLES
|
||||
#define REFRESH_HOSTS MYSQLND_REFRESH_HOSTS
|
||||
#define REFRESH_STATUS MYSQLND_REFRESH_STATUS
|
||||
#define REFRESH_THREADS MYSQLND_REFRESH_THREADS
|
||||
#define REFRESH_SLAVE MYSQLND_REFRESH_SLAVE
|
||||
#define REFRESH_MASTER MYSQLND_REFRESH_MASTER
|
||||
#define REFRESH_BACKUP_LOG MYSQLND_REFRESH_BACKUP_LOG
|
||||
|
||||
#endif /* MYSQLND_LIBMYSQL_COMPAT_H */
|
||||
|
||||
@@ -37,7 +37,7 @@ if (c) {\
|
||||
|
||||
#define FREE_CALLBACK_ARGS(a, b, c)\
|
||||
if (a) {\
|
||||
for (i=b; i < c; i++) {\
|
||||
for (i = b; i < c; i++) {\
|
||||
zval_ptr_dtor(a[i]);\
|
||||
mnd_efree(a[i]);\
|
||||
}\
|
||||
@@ -48,8 +48,8 @@ if (a) {\
|
||||
static
|
||||
int mysqlnd_local_infile_init(void **ptr, char *filename, void **userdata TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_INFILE_INFO *info;
|
||||
php_stream_context *context = NULL;
|
||||
MYSQLND_INFILE_INFO *info;
|
||||
php_stream_context *context = NULL;
|
||||
|
||||
DBG_ENTER("mysqlnd_local_infile_init");
|
||||
|
||||
@@ -85,7 +85,7 @@ int mysqlnd_local_infile_read(void *ptr, char *buf, unsigned int buf_len TSRMLS_
|
||||
MYSQLND_INFILE_INFO *info = (MYSQLND_INFILE_INFO *)ptr;
|
||||
int count;
|
||||
|
||||
DBG_ENTER("mysqlnd_local_infile_read");
|
||||
DBG_ENTER("mysqlnd_local_infile_read");
|
||||
|
||||
count = (int)php_stream_read(info->fd, buf, buf_len);
|
||||
|
||||
@@ -171,7 +171,7 @@ mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_w
|
||||
char *buf;
|
||||
char empty_packet[MYSQLND_HEADER_SIZE];
|
||||
enum_func_status result = FAIL;
|
||||
unsigned int buflen = 4096;
|
||||
unsigned int buflen = 4096;
|
||||
void *info = NULL;
|
||||
int bufsize;
|
||||
size_t ret;
|
||||
@@ -199,16 +199,14 @@ mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_w
|
||||
/* error occured */
|
||||
strcpy(conn->error_info.sqlstate, UNKNOWN_SQLSTATE);
|
||||
conn->error_info.error_no =
|
||||
infile.local_infile_error(info, conn->error_info.error,
|
||||
sizeof(conn->error_info.error) TSRMLS_CC);
|
||||
infile.local_infile_error(info, conn->error_info.error, sizeof(conn->error_info.error) TSRMLS_CC);
|
||||
/* write empty packet to server */
|
||||
ret = conn->net->m.send(conn, empty_packet, 0 TSRMLS_CC);
|
||||
goto infile_error;
|
||||
}
|
||||
|
||||
/* read data */
|
||||
while ((bufsize = infile.local_infile_read (info, buf + MYSQLND_HEADER_SIZE,
|
||||
buflen - MYSQLND_HEADER_SIZE TSRMLS_CC)) > 0) {
|
||||
while ((bufsize = infile.local_infile_read (info, buf + MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE TSRMLS_CC)) > 0) {
|
||||
if ((ret = conn->net->m.send(conn, buf, bufsize TSRMLS_CC)) < 0) {
|
||||
DBG_ERR_FMT("Error during read : %d %s %s", CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
|
||||
@@ -227,8 +225,8 @@ mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_w
|
||||
*is_warning = TRUE;
|
||||
DBG_ERR_FMT("Bufsize < 0, warning, %d %s %s", CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
|
||||
strcpy(conn->error_info.sqlstate, UNKNOWN_SQLSTATE);
|
||||
conn->error_info.error_no = infile.local_infile_error(info, conn->error_info.error,
|
||||
sizeof(conn->error_info.error) TSRMLS_CC);
|
||||
conn->error_info.error_no =
|
||||
infile.local_infile_error(info, conn->error_info.error, sizeof(conn->error_info.error) TSRMLS_CC);
|
||||
goto infile_error;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +142,7 @@ MYSQLND_METHOD(mysqlnd_net, connect)(MYSQLND_NET * net, const char * const schem
|
||||
*/
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_len + 1,
|
||||
(void*) &le) == SUCCESS) {
|
||||
if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_len + 1, (void*) &le) == SUCCESS) {
|
||||
/*
|
||||
in_free will let streams code skip destructing - big HACK,
|
||||
but STREAMS suck big time regarding persistent streams.
|
||||
@@ -202,7 +201,7 @@ MYSQLND_METHOD(mysqlnd_net, connect)(MYSQLND_NET * net, const char * const schem
|
||||
/* {{{ mysqlnd_net::send */
|
||||
/*
|
||||
IMPORTANT : It's expected that buf has place in the beginning for MYSQLND_HEADER_SIZE !!!!
|
||||
This is done for performance reasons in the caller of this function.
|
||||
This is done for performance reasons in the caller of this function.
|
||||
Otherwise we will have to do send two TCP packets, or do new alloc and memcpy.
|
||||
Neither are quick, thus the clients of this function are obligated to do
|
||||
what they are asked for.
|
||||
@@ -246,7 +245,9 @@ MYSQLND_METHOD(mysqlnd_net, send)(MYSQLND * const conn, char * const buf, size_t
|
||||
STORE_HEADER_SIZE(safe_storage, uncompressed_payload);
|
||||
int3store(uncompressed_payload, to_be_sent);
|
||||
int1store(uncompressed_payload + 3, net->packet_no);
|
||||
if (PASS == net->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), tmp_complen, uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE TSRMLS_CC)) {
|
||||
if (PASS == net->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), tmp_complen,
|
||||
uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE TSRMLS_CC))
|
||||
{
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, to_be_sent + MYSQLND_HEADER_SIZE);
|
||||
payload_size = tmp_complen;
|
||||
} else {
|
||||
@@ -265,7 +266,8 @@ MYSQLND_METHOD(mysqlnd_net, send)(MYSQLND * const conn, char * const buf, size_t
|
||||
if (res == Z_OK) {
|
||||
size_t decompressed_size = left + MYSQLND_HEADER_SIZE;
|
||||
zend_uchar * decompressed_data = mnd_malloc(decompressed_size);
|
||||
int error = net->m.decode(decompressed_data, decompressed_size, compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, payload_size);
|
||||
int error = net->m.decode(decompressed_data, decompressed_size,
|
||||
compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, payload_size);
|
||||
if (error == Z_OK) {
|
||||
int i;
|
||||
DBG_INF("success decompressing");
|
||||
@@ -725,14 +727,14 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
|
||||
php_stream_context *context = php_stream_context_alloc();
|
||||
DBG_ENTER("mysqlnd_net::enable_ssl");
|
||||
if (!context) {
|
||||
DBG_RETURN(FAIL);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
if (net->options.ssl_key) {
|
||||
zval key_zval;
|
||||
ZVAL_STRING(&key_zval, net->options.ssl_key, 0);
|
||||
DBG_INF("key");
|
||||
php_stream_context_set_option(context, "ssl", "local_pk", &key_zval);
|
||||
php_stream_context_set_option(context, "ssl", "local_pk", &key_zval);
|
||||
}
|
||||
if (net->options.ssl_verify_peer) {
|
||||
zval verify_peer_zval;
|
||||
@@ -746,7 +748,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
|
||||
DBG_INF_FMT("local_cert=%s", net->options.ssl_cert);
|
||||
php_stream_context_set_option(context, "ssl", "local_cert", &cert_zval);
|
||||
if (!net->options.ssl_key) {
|
||||
php_stream_context_set_option(context, "ssl", "local_pk", &cert_zval);
|
||||
php_stream_context_set_option(context, "ssl", "local_pk", &cert_zval);
|
||||
}
|
||||
}
|
||||
if (net->options.ssl_ca) {
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#endif
|
||||
|
||||
#define MYSQLND_CLASS_METHOD_TABLE_NAME(class) mysqlnd_##class##_methods
|
||||
#define MYSQLND_CLASS_METHODS_START(class) struct st_##class##_methods MYSQLND_CLASS_METHOD_TABLE_NAME(class) = {
|
||||
#define MYSQLND_CLASS_METHODS_END }
|
||||
#define MYSQLND_CLASS_METHODS_START(class) struct st_##class##_methods MYSQLND_CLASS_METHOD_TABLE_NAME(class) = {
|
||||
#define MYSQLND_CLASS_METHODS_END }
|
||||
|
||||
#if PHP_MAJOR_VERSION < 6
|
||||
#define mysqlnd_array_init(arg, field_count) \
|
||||
@@ -134,8 +134,8 @@
|
||||
#define CONN_GET_STATE(c) (c)->m->get_state((c) TSRMLS_CC)
|
||||
#define CONN_SET_STATE(c, s) (c)->m->set_state((c), (s) TSRMLS_CC)
|
||||
#else
|
||||
#define CONN_GET_STATE(c) (c)->state
|
||||
#define CONN_SET_STATE(c, s) (c)->state = s
|
||||
#define CONN_GET_STATE(c) ((c)->state)
|
||||
#define CONN_SET_STATE(c, s) ((c)->state = s)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
SET_EMPTY_ERROR(stmt->conn->error_info);
|
||||
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
|
||||
|
||||
result = mysqlnd_result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC);
|
||||
result = mysqlnd_result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC);
|
||||
|
||||
result->meta = stmt->result->meta->m->clone_metadata(stmt->result->meta, FALSE TSRMLS_CC);
|
||||
|
||||
@@ -1283,8 +1283,7 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_parameters)(MYSQLND_STMT * const s, MYSQLND_PA
|
||||
unsigned int i = 0;
|
||||
|
||||
if (!param_bind) {
|
||||
SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
|
||||
"Re-binding (still) not supported");
|
||||
SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, "Re-binding (still) not supported");
|
||||
DBG_ERR("Re-binding (still) not supported");
|
||||
DBG_RETURN(FAIL);
|
||||
} else if (stmt->param_bind) {
|
||||
@@ -1495,7 +1494,7 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_one_result)(MYSQLND_STMT * const s, unsigned i
|
||||
Don't update is_ref !!! it's not our job
|
||||
Otherwise either 009.phpt or mysqli_stmt_bind_result.phpt
|
||||
will fail.
|
||||
*/
|
||||
*/
|
||||
stmt->result_bind[param_no].bound = TRUE;
|
||||
}
|
||||
DBG_INF("PASS");
|
||||
@@ -1799,7 +1798,8 @@ MYSQLND_METHOD(mysqlnd_stmt, free_result)(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ mysqlnd_stmt_separate_result_bind */
|
||||
void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
static void
|
||||
mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_STMT_DATA * stmt = s->data;
|
||||
unsigned int i;
|
||||
@@ -1852,7 +1852,8 @@ void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ mysqlnd_stmt_separate_one_result_bind */
|
||||
void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const s, unsigned int param_no TSRMLS_DC)
|
||||
static void
|
||||
mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const s, unsigned int param_no TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_STMT_DATA * stmt = s->data;
|
||||
DBG_ENTER("mysqlnd_stmt_separate_one_result_bind");
|
||||
@@ -1899,8 +1900,8 @@ void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const s, unsigned int
|
||||
|
||||
|
||||
/* {{{ mysqlnd_internal_free_stmt_content */
|
||||
static
|
||||
void mysqlnd_internal_free_stmt_content(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
static void
|
||||
mysqlnd_internal_free_stmt_content(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_STMT_DATA * stmt = s->data;
|
||||
DBG_ENTER("mysqlnd_internal_free_stmt_content");
|
||||
@@ -2182,7 +2183,6 @@ PHPAPI void ** _mysqlnd_plugin_get_plugin_stmt_data(const MYSQLND_STMT * stmt, u
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/* {{{ _mysqlnd_init_ps_subsystem */
|
||||
void _mysqlnd_init_ps_subsystem()
|
||||
{
|
||||
@@ -2191,6 +2191,7 @@ void _mysqlnd_init_ps_subsystem()
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_conn_get_methods */
|
||||
PHPAPI struct st_mysqlnd_stmt_methods * mysqlnd_stmt_get_methods()
|
||||
{
|
||||
@@ -2198,6 +2199,7 @@ PHPAPI struct st_mysqlnd_stmt_methods * mysqlnd_stmt_get_methods()
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_conn_set_methods */
|
||||
PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods)
|
||||
{
|
||||
|
||||
@@ -106,10 +106,10 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
|
||||
}
|
||||
|
||||
#if SIZEOF_LONG==4
|
||||
if ((L64(2147483647) < (int64_t) lval) || (L64(-2147483648) > (int64_t) lval)) {
|
||||
if ((L64(2147483647) < (int64_t) lval) || (L64(-2147483648) > (int64_t) lval)) {
|
||||
DBG_INF("stringify");
|
||||
tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval);
|
||||
} else
|
||||
} else
|
||||
#endif /* SIZEOF */
|
||||
{
|
||||
ZVAL_LONG(zv, lval);
|
||||
@@ -126,7 +126,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
|
||||
{
|
||||
DBG_INF("stringify");
|
||||
ZVAL_STRINGL(zv, tmp, tmp_len, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
(*row)+= byte_count;
|
||||
DBG_VOID_RETURN;
|
||||
@@ -199,7 +199,7 @@ void ps_fetch_float(zval *zv, const MYSQLND_FIELD * const field,
|
||||
DBG_ENTER("ps_fetch_float");
|
||||
float4get(value, *row);
|
||||
ZVAL_DOUBLE(zv, value);
|
||||
(*row)+= 4;
|
||||
(*row)+= 4;
|
||||
DBG_INF_FMT("value=%f", value);
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
@@ -256,14 +256,13 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
|
||||
} else {
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.time_type = MYSQLND_TIMESTAMP_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
QQ : How to make this unicode without copying two times the buffer -
|
||||
Unicode equivalent of spprintf?
|
||||
*/
|
||||
length = spprintf(&to, 0, "%s%02u:%02u:%02u",
|
||||
(t.neg ? "-" : ""), t.hour, t.minute, t.second);
|
||||
length = spprintf(&to, 0, "%s%02u:%02u:%02u", (t.neg ? "-" : ""), t.hour, t.minute, t.second);
|
||||
|
||||
DBG_INF_FMT("%s", to);
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
@@ -273,7 +272,7 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
|
||||
efree(to); /* allocated by spprintf */
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
} else {
|
||||
ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);
|
||||
ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);
|
||||
}
|
||||
#endif
|
||||
DBG_VOID_RETURN;
|
||||
@@ -324,7 +323,7 @@ void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field,
|
||||
efree(to); /* allocated by spprintf */
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
} else {
|
||||
ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);
|
||||
ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);
|
||||
}
|
||||
#endif
|
||||
DBG_VOID_RETURN;
|
||||
@@ -358,7 +357,7 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
|
||||
t.minute = (unsigned int) to[5];
|
||||
t.second = (unsigned int) to[6];
|
||||
} else {
|
||||
t.hour = t.minute = t.second= 0;
|
||||
t.hour = t.minute = t.second= 0;
|
||||
}
|
||||
t.second_part = (length > 7) ? (unsigned long) sint4korr(to+7) : 0;
|
||||
|
||||
@@ -383,7 +382,7 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
|
||||
efree(to); /* allocated by spprintf */
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
} else {
|
||||
ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);
|
||||
ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);
|
||||
}
|
||||
#endif
|
||||
DBG_VOID_RETURN;
|
||||
@@ -406,7 +405,7 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field,
|
||||
DBG_INF_FMT("len = %lu", length);
|
||||
#if PHP_MAJOR_VERSION < 6
|
||||
DBG_INF("copying from the row buffer");
|
||||
ZVAL_STRINGL(zv, (char *)*row, length, 1);
|
||||
ZVAL_STRINGL(zv, (char *)*row, length, 1);
|
||||
#else
|
||||
if (field->charsetnr == MYSQLND_BINARY_CHARSET_NR) {
|
||||
DBG_INF("Binary charset");
|
||||
@@ -440,92 +439,92 @@ void _mysqlnd_init_ps_fetch_subsystem()
|
||||
{
|
||||
memset(mysqlnd_ps_fetch_functions, 0, sizeof(mysqlnd_ps_fetch_functions));
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].func = ps_fetch_null;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].pack_len = 0;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].php_type = IS_NULL;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].pack_len = 0;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].php_type = IS_NULL;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type = IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_LONG;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].pack_len = 4;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].php_type = IS_DOUBLE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].func = ps_fetch_double;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].pack_len = 8;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].php_type = IS_DOUBLE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].php_type = IS_DOUBLE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].func = ps_fetch_time;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].pack_len = MYSQLND_PS_SKIP_RESULT_W_LEN;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].func = ps_fetch_date;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].pack_len = MYSQLND_PS_SKIP_RESULT_W_LEN;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].func = ps_fetch_date;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].pack_len = MYSQLND_PS_SKIP_RESULT_W_LEN;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].func = ps_fetch_datetime;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].pack_len= MYSQLND_PS_SKIP_RESULT_W_LEN;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].php_type= IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].func = ps_fetch_datetime;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].pack_len= MYSQLND_PS_SKIP_RESULT_W_LEN;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].php_type= IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].pack_len= MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].is_possibly_blob = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].is_possibly_blob = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].pack_len= MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].php_type= IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].is_possibly_blob = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG_BLOB].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG_BLOB].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
@@ -545,23 +544,23 @@ void _mysqlnd_init_ps_fetch_subsystem()
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_VARCHAR].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_VARCHAR].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_VARCHAR].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_VARCHAR].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_VARCHAR].is_possibly_blob = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_STRING].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_STRING].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_STRING].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_STRING].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_STRING].is_possibly_blob = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DECIMAL].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DECIMAL].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DECIMAL].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DECIMAL].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DECIMAL].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDECIMAL].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDECIMAL].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDECIMAL].php_type = IS_STRING;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDECIMAL].can_ret_as_str_in_uni = TRUE;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDECIMAL].can_ret_as_str_in_uni = TRUE;
|
||||
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_ENUM].func = ps_fetch_string;
|
||||
mysqlnd_ps_fetch_functions[MYSQL_TYPE_ENUM].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
|
||||
@@ -583,7 +582,7 @@ static void
|
||||
mysqlnd_stmt_copy_it(zval *** copies, zval *original, unsigned int param_count, unsigned int current TSRMLS_DC)
|
||||
{
|
||||
if (!*copies) {
|
||||
*copies = mnd_ecalloc(param_count, sizeof(zval *));
|
||||
*copies = mnd_ecalloc(param_count, sizeof(zval *));
|
||||
}
|
||||
MAKE_STD_ZVAL((*copies)[current]);
|
||||
*(*copies)[current] = *original;
|
||||
@@ -637,8 +636,7 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
unsigned int j;
|
||||
zval *the_var = stmt->param_bind[i].zv;
|
||||
|
||||
if (!the_var || (stmt->param_bind[i].type != MYSQL_TYPE_LONG_BLOB &&
|
||||
Z_TYPE_P(the_var) == IS_NULL)) {
|
||||
if (!the_var || (stmt->param_bind[i].type != MYSQL_TYPE_LONG_BLOB && Z_TYPE_P(the_var) == IS_NULL)) {
|
||||
continue;
|
||||
}
|
||||
for (j = i + 1; j < stmt->param_count; j++) {
|
||||
@@ -778,7 +776,7 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
zval_ptr_dtor(&copies[i]);
|
||||
}
|
||||
}
|
||||
mnd_efree(copies);
|
||||
mnd_efree(copies);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -87,42 +87,39 @@ void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bo
|
||||
{
|
||||
DBG_ENTER("mysqlnd_palloc_zval_ptr_dtor");
|
||||
*copy_ctor_called = FALSE;
|
||||
{
|
||||
|
||||
/*
|
||||
This zval is not from the cache block.
|
||||
Thus the refcount is -1 than of a zval from the cache,
|
||||
because the zvals from the cache are owned by it.
|
||||
*/
|
||||
if (type == MYSQLND_RES_PS_BUF || type == MYSQLND_RES_PS_UNBUF) {
|
||||
; /* do nothing, zval_ptr_dtor will do the job*/
|
||||
} else if (Z_REFCOUNT_PP(zv) > 1) {
|
||||
/*
|
||||
This zval is not from the cache block.
|
||||
Thus the refcount is -1 than of a zval from the cache,
|
||||
because the zvals from the cache are owned by it.
|
||||
Not a prepared statement, then we have to
|
||||
call copy_ctor and then zval_ptr_dtor()
|
||||
|
||||
In Unicode mode the destruction of the zvals should not call
|
||||
zval_copy_ctor() because then we will leak.
|
||||
I suppose we can use UG(unicode) in mysqlnd.c when freeing a result set
|
||||
to check if we need to call copy_ctor().
|
||||
|
||||
If the type is IS_UNICODE, which can happen with PHP6, then we don't
|
||||
need to copy_ctor, as the data doesn't point to our internal buffers.
|
||||
If it's string (in PHP5 always) and in PHP6 if data is binary, then
|
||||
it still points to internal buffers and has to be copied.
|
||||
*/
|
||||
if (type == MYSQLND_RES_PS_BUF || type == MYSQLND_RES_PS_UNBUF) {
|
||||
; /* do nothing, zval_ptr_dtor will do the job*/
|
||||
} else if (Z_REFCOUNT_PP(zv) > 1) {
|
||||
/*
|
||||
Not a prepared statement, then we have to
|
||||
call copy_ctor and then zval_ptr_dtor()
|
||||
|
||||
In Unicode mode the destruction of the zvals should not call
|
||||
zval_copy_ctor() because then we will leak.
|
||||
I suppose we can use UG(unicode) in mysqlnd.c when freeing a result set
|
||||
to check if we need to call copy_ctor().
|
||||
|
||||
If the type is IS_UNICODE, which can happen with PHP6, then we don't
|
||||
need to copy_ctor, as the data doesn't point to our internal buffers.
|
||||
If it's string (in PHP5 always) and in PHP6 if data is binary, then
|
||||
it still points to internal buffers and has to be copied.
|
||||
*/
|
||||
if (Z_TYPE_PP(zv) == IS_STRING) {
|
||||
zval_copy_ctor(*zv);
|
||||
}
|
||||
*copy_ctor_called = TRUE;
|
||||
} else {
|
||||
if (Z_TYPE_PP(zv) == IS_STRING) {
|
||||
ZVAL_NULL(*zv);
|
||||
}
|
||||
if (Z_TYPE_PP(zv) == IS_STRING) {
|
||||
zval_copy_ctor(*zv);
|
||||
}
|
||||
*copy_ctor_called = TRUE;
|
||||
} else {
|
||||
if (Z_TYPE_PP(zv) == IS_STRING) {
|
||||
ZVAL_NULL(*zv);
|
||||
}
|
||||
zval_ptr_dtor(zv);
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(zv);
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -263,7 +260,7 @@ MYSQLND_METHOD(mysqlnd_res, free_result_buffers)(MYSQLND_RES *result TSRMLS_DC)
|
||||
if (result->result_set_memory_pool) {
|
||||
DBG_INF("Freeing memory pool");
|
||||
mysqlnd_mempool_destroy(result->result_set_memory_pool TSRMLS_CC);
|
||||
result->result_set_memory_pool = NULL;
|
||||
result->result_set_memory_pool = NULL;
|
||||
}
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
@@ -339,9 +336,9 @@ MYSQLND_METHOD(mysqlnd_res, read_result_metadata)(MYSQLND_RES *result, MYSQLND *
|
||||
|
||||
/*
|
||||
2. Follows an EOF packet, which the client of mysqlnd_read_result_metadata()
|
||||
should consume.
|
||||
should consume.
|
||||
3. If there is a result set, it follows. The last packet will have 'eof' set
|
||||
If PS, then no result set follows.
|
||||
If PS, then no result set follows.
|
||||
*/
|
||||
|
||||
DBG_RETURN(PASS);
|
||||
@@ -423,7 +420,7 @@ mysqlnd_query_read_result_set_header(MYSQLND *conn, MYSQLND_STMT * s TSRMLS_DC)
|
||||
ret = PASS;
|
||||
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_NON_RSET_QUERY);
|
||||
break;
|
||||
default:{ /* Result set */
|
||||
default:{ /* Result set */
|
||||
MYSQLND_PACKET_EOF * fields_eof;
|
||||
MYSQLND_RES *result;
|
||||
enum_mysqlnd_collected_stats stat = STAT_LAST;
|
||||
@@ -463,7 +460,7 @@ mysqlnd_query_read_result_set_header(MYSQLND *conn, MYSQLND_STMT * s TSRMLS_DC)
|
||||
Note, that now (4.1.3) we always send metadata in reply to
|
||||
COM_STMT_EXECUTE (even if it is not necessary), so either this or
|
||||
previous branch always works.
|
||||
*/
|
||||
*/
|
||||
}
|
||||
result = stmt->result;
|
||||
}
|
||||
@@ -542,8 +539,8 @@ mysqlnd_query_read_result_set_header(MYSQLND *conn, MYSQLND_STMT * s TSRMLS_DC)
|
||||
of PHP, to be called as separate function. But let's have it for
|
||||
completeness.
|
||||
*/
|
||||
static
|
||||
unsigned long * mysqlnd_fetch_lengths_buffered(MYSQLND_RES * const result TSRMLS_DC)
|
||||
static unsigned long *
|
||||
mysqlnd_fetch_lengths_buffered(MYSQLND_RES * const result TSRMLS_DC)
|
||||
{
|
||||
unsigned int i;
|
||||
zval **previous_row;
|
||||
@@ -573,13 +570,14 @@ unsigned long * mysqlnd_fetch_lengths_buffered(MYSQLND_RES * const result TSRMLS
|
||||
|
||||
|
||||
/* {{{ mysqlnd_fetch_lengths_unbuffered */
|
||||
static
|
||||
unsigned long * mysqlnd_fetch_lengths_unbuffered(MYSQLND_RES * const result TSRMLS_DC)
|
||||
static unsigned long *
|
||||
mysqlnd_fetch_lengths_unbuffered(MYSQLND_RES * const result TSRMLS_DC)
|
||||
{
|
||||
return result->lengths;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#if !defined(MYSQLND_USE_OPTIMISATIONS) || MYSQLND_USE_OPTIMISATIONS == 0
|
||||
/* {{{ mysqlnd_res::fetch_lengths */
|
||||
PHPAPI unsigned long * _mysqlnd_fetch_lengths(MYSQLND_RES * const result TSRMLS_DC)
|
||||
@@ -589,16 +587,17 @@ PHPAPI unsigned long * _mysqlnd_fetch_lengths(MYSQLND_RES * const result TSRMLS_
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ mysqlnd_fetch_row_unbuffered_c */
|
||||
static MYSQLND_ROW_C
|
||||
mysqlnd_fetch_row_unbuffered_c(MYSQLND_RES *result TSRMLS_DC)
|
||||
{
|
||||
enum_func_status ret;
|
||||
MYSQLND_ROW_C retrow = NULL;
|
||||
unsigned int i,
|
||||
field_count = result->field_count;
|
||||
enum_func_status ret;
|
||||
MYSQLND_ROW_C retrow = NULL;
|
||||
unsigned int i,
|
||||
field_count = result->field_count;
|
||||
MYSQLND_PACKET_ROW *row_packet = result->row_packet;
|
||||
unsigned long *lengths = result->lengths;
|
||||
unsigned long *lengths = result->lengths;
|
||||
|
||||
DBG_ENTER("mysqlnd_fetch_row_unbuffered_c");
|
||||
|
||||
@@ -670,7 +669,7 @@ mysqlnd_fetch_row_unbuffered_c(MYSQLND_RES *result TSRMLS_DC)
|
||||
} else if (ret == FAIL) {
|
||||
if (row_packet->error_info.error_no) {
|
||||
result->conn->error_info = row_packet->error_info;
|
||||
DBG_ERR_FMT("errorno=%d error=%s", row_packet->error_info.error_no, row_packet->error_info.error);
|
||||
DBG_ERR_FMT("errorno=%d error=%s", row_packet->error_info.error_no, row_packet->error_info.error);
|
||||
}
|
||||
CONN_SET_STATE(result->conn, CONN_READY);
|
||||
result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
|
||||
@@ -701,8 +700,8 @@ mysqlnd_fetch_row_unbuffered_c(MYSQLND_RES *result TSRMLS_DC)
|
||||
static enum_func_status
|
||||
mysqlnd_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int flags, zend_bool *fetched_anything TSRMLS_DC)
|
||||
{
|
||||
enum_func_status ret;
|
||||
zval *row = (zval *) param;
|
||||
enum_func_status ret;
|
||||
zval *row = (zval *) param;
|
||||
MYSQLND_PACKET_ROW *row_packet = result->row_packet;
|
||||
|
||||
DBG_ENTER("mysqlnd_fetch_row_unbuffered");
|
||||
@@ -714,8 +713,7 @@ mysqlnd_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int flag
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
if (CONN_GET_STATE(result->conn) != CONN_FETCHING_DATA) {
|
||||
SET_CLIENT_ERROR(result->conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
|
||||
UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
SET_CLIENT_ERROR(result->conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
/* Let the row packet fill our buffer and skip additional mnd_malloc + memcpy */
|
||||
@@ -804,7 +802,7 @@ mysqlnd_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int flag
|
||||
} else if (ret == FAIL) {
|
||||
if (row_packet->error_info.error_no) {
|
||||
result->conn->error_info = row_packet->error_info;
|
||||
DBG_ERR_FMT("errorno=%d error=%s", row_packet->error_info.error_no, row_packet->error_info.error);
|
||||
DBG_ERR_FMT("errorno=%d error=%s", row_packet->error_info.error_no, row_packet->error_info.error);
|
||||
}
|
||||
*fetched_anything = FALSE;
|
||||
CONN_SET_STATE(result->conn, CONN_READY);
|
||||
@@ -1139,7 +1137,7 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND * const conn, MYSQL
|
||||
set->error_info = row_packet->error_info;
|
||||
} else {
|
||||
/* Position at the first row */
|
||||
set->data_cursor = set->data;
|
||||
set->data_cursor = set->data;
|
||||
|
||||
/* libmysql's documentation says it should be so for SELECT statements */
|
||||
conn->upsert_status.affected_rows = set->row_count;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_free_field_metadata */
|
||||
static
|
||||
void php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS_DC)
|
||||
static void
|
||||
php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS_DC)
|
||||
{
|
||||
if (meta) {
|
||||
if (meta->root) {
|
||||
@@ -51,10 +51,10 @@ void php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent T
|
||||
The following code is stolen from ZE - HANDLE_NUMERIC() macro from zend_hash.c
|
||||
and modified for the needs of mysqlnd.
|
||||
*/
|
||||
static
|
||||
zend_bool mysqlnd_is_key_numeric(char *key, size_t length, long *idx)
|
||||
static zend_bool
|
||||
mysqlnd_is_key_numeric(char *key, size_t length, long *idx)
|
||||
{
|
||||
register char *tmp=key;
|
||||
register char * tmp = key;
|
||||
|
||||
if (*tmp=='-') {
|
||||
tmp++;
|
||||
@@ -94,10 +94,10 @@ zend_bool mysqlnd_is_key_numeric(char *key, size_t length, long *idx)
|
||||
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
/* {{{ mysqlnd_unicode_is_key_numeric */
|
||||
static
|
||||
zend_bool mysqlnd_unicode_is_key_numeric(UChar *key, size_t length, long *idx)
|
||||
static zend_bool
|
||||
mysqlnd_unicode_is_key_numeric(UChar *key, size_t length, long *idx)
|
||||
{
|
||||
register UChar *tmp=key;
|
||||
register UChar * tmp=key;
|
||||
|
||||
if (*tmp==0x2D /*'-'*/) {
|
||||
tmp++;
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
#ifndef MYSQLND_RESULT_META_H
|
||||
#define MYSQLND_RESULT_META_H
|
||||
|
||||
|
||||
PHPAPI MYSQLND_RES_METADATA * mysqlnd_result_meta_init(unsigned int field_count, zend_bool persistent TSRMLS_DC);
|
||||
|
||||
|
||||
|
||||
#endif /* MYSQLND_RESULT_META_H */
|
||||
|
||||
/*
|
||||
|
||||
@@ -225,7 +225,8 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING
|
||||
|
||||
|
||||
/* {{{ _mysqlnd_get_client_stats */
|
||||
PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC)
|
||||
PHPAPI void
|
||||
_mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC)
|
||||
{
|
||||
MYSQLND_STATS stats, *stats_ptr = mysqlnd_global_stats;
|
||||
DBG_ENTER("_mysqlnd_get_client_stats");
|
||||
|
||||
@@ -44,15 +44,15 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
|
||||
#define MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(stats, statistic, value) \
|
||||
{ \
|
||||
MYSQLND_STATS_LOCK(stats); \
|
||||
MYSQLND_STATS_LOCK(stats); \
|
||||
(stats)->values[(statistic)] += (value); \
|
||||
if ((stats)->triggers[(statistic)] && (stats)->in_trigger == FALSE) { \
|
||||
(stats)->in_trigger = TRUE; \
|
||||
MYSQLND_STATS_UNLOCK(stats); \
|
||||
MYSQLND_STATS_UNLOCK(stats); \
|
||||
\
|
||||
(stats)->triggers[(statistic)]((stats), (statistic), (value) TSRMLS_CC); \
|
||||
\
|
||||
MYSQLND_STATS_LOCK(stats); \
|
||||
MYSQLND_STATS_LOCK(stats); \
|
||||
(stats)->in_trigger = FALSE; \
|
||||
} \
|
||||
MYSQLND_STATS_UNLOCK(_p_s); \
|
||||
@@ -62,7 +62,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
{ \
|
||||
enum_mysqlnd_collected_stats _s = (statistic);\
|
||||
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
|
||||
if ((enabler) && _p_s && _s != _p_s->count) { \
|
||||
if ((enabler) && _p_s && _s != _p_s->count) { \
|
||||
MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s, -1); \
|
||||
}\
|
||||
}
|
||||
@@ -71,7 +71,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
{ \
|
||||
enum_mysqlnd_collected_stats _s = (statistic);\
|
||||
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
|
||||
if ((enabler) && _p_s && _s != _p_s->count) { \
|
||||
if ((enabler) && _p_s && _s != _p_s->count) { \
|
||||
MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s, 1); \
|
||||
}\
|
||||
}
|
||||
@@ -80,7 +80,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
{ \
|
||||
enum_mysqlnd_collected_stats _s = (statistic);\
|
||||
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
|
||||
if ((enabler) && _p_s && _s != _p_s->count) { \
|
||||
if ((enabler) && _p_s && _s != _p_s->count) { \
|
||||
uint64_t v = (uint64_t) (value); \
|
||||
MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s, v); \
|
||||
}\
|
||||
@@ -89,7 +89,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
#define MYSQLND_INC_STATISTIC_W_VALUE2(enabler, stats, statistic1, value1, statistic2, value2) \
|
||||
{ \
|
||||
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
|
||||
if ((enabler) && _p_s) { \
|
||||
if ((enabler) && _p_s) { \
|
||||
uint64_t v1 = (uint64_t) (value1); \
|
||||
uint64_t v2 = (uint64_t) (value2); \
|
||||
enum_mysqlnd_collected_stats _s1 = (statistic1);\
|
||||
@@ -102,7 +102,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
#define MYSQLND_INC_STATISTIC_W_VALUE3(enabler, stats, statistic1, value1, statistic2, value2, statistic3, value3) \
|
||||
{ \
|
||||
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
|
||||
if ((enabler) && _p_s) { \
|
||||
if ((enabler) && _p_s) { \
|
||||
uint64_t v1 = (uint64_t) (value1); \
|
||||
uint64_t v2 = (uint64_t) (value2); \
|
||||
uint64_t v3 = (uint64_t) (value3); \
|
||||
@@ -117,29 +117,29 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
|
||||
|
||||
|
||||
#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
|
||||
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic))
|
||||
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic))
|
||||
|
||||
#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic) \
|
||||
MYSQLND_DEC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic))
|
||||
MYSQLND_DEC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic))
|
||||
|
||||
#define MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(statistic1, value1, statistic2, value2) \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE2(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2))
|
||||
MYSQLND_INC_STATISTIC_W_VALUE2(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2))
|
||||
|
||||
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
|
||||
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic)); \
|
||||
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), (conn_stats), (statistic));
|
||||
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic)); \
|
||||
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), (conn_stats), (statistic));
|
||||
|
||||
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic), (value)); \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE(MYSQLND_G(collect_statistics), (conn_stats), (statistic), (value));
|
||||
MYSQLND_INC_STATISTIC_W_VALUE(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic), (value)); \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE(MYSQLND_G(collect_statistics), (conn_stats), (statistic), (value));
|
||||
|
||||
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn_stats, statistic1, value1, statistic2, value2) \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE2(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2)); \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE2(MYSQLND_G(collect_statistics), (conn_stats), (statistic1), (value1), (statistic2), (value2));
|
||||
MYSQLND_INC_STATISTIC_W_VALUE2(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2)); \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE2(MYSQLND_G(collect_statistics), (conn_stats), (statistic1), (value1), (statistic2), (value2));
|
||||
|
||||
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2), (statistic3), (value3)); \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), (conn_stats), (statistic1), (value1), (statistic2), (value2), (statistic3), (value3));
|
||||
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2), (statistic3), (value3)); \
|
||||
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), (conn_stats), (statistic1), (value1), (statistic2), (value2), (statistic3), (value3));
|
||||
|
||||
|
||||
PHPAPI void mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING * names, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC);
|
||||
@@ -150,10 +150,8 @@ PHPAPI void mysqlnd_stats_end(MYSQLND_STATS * stats);
|
||||
PHPAPI mysqlnd_stat_trigger mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger TSRMLS_DC);
|
||||
PHPAPI mysqlnd_stat_trigger mysqlnd_stats_reset_triggers(MYSQLND_STATS * const stats TSRMLS_DC);
|
||||
|
||||
|
||||
#endif /* MYSQLND_STATISTICS_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
@@ -48,7 +48,7 @@ struct st_mysqlnd_memory_pool
|
||||
struct st_mysqlnd_memory_pool_chunk
|
||||
{
|
||||
uint64_t app;
|
||||
MYSQLND_MEMORY_POOL *pool;
|
||||
MYSQLND_MEMORY_POOL *pool;
|
||||
zend_uchar *ptr;
|
||||
unsigned int size;
|
||||
void (*resize_chunk)(MYSQLND_MEMORY_POOL_CHUNK * chunk, unsigned int size TSRMLS_DC);
|
||||
@@ -91,7 +91,6 @@ typedef struct st_mysqlnd_field
|
||||
} MYSQLND_FIELD;
|
||||
|
||||
|
||||
|
||||
typedef struct st_mysqlnd_upsert_result
|
||||
{
|
||||
unsigned int warning_count;
|
||||
@@ -111,24 +110,24 @@ typedef struct st_mysqlnd_error_info
|
||||
|
||||
typedef struct st_mysqlnd_infile_info
|
||||
{
|
||||
php_stream *fd;
|
||||
int error_no;
|
||||
char error_msg[MYSQLND_ERRMSG_SIZE + 1];
|
||||
const char *filename;
|
||||
php_stream *fd;
|
||||
int error_no;
|
||||
char error_msg[MYSQLND_ERRMSG_SIZE + 1];
|
||||
const char *filename;
|
||||
} MYSQLND_INFILE_INFO;
|
||||
|
||||
|
||||
/* character set information */
|
||||
typedef struct st_mysqlnd_charset
|
||||
{
|
||||
unsigned int nr;
|
||||
const char *name;
|
||||
const char *collation;
|
||||
unsigned int char_minlen;
|
||||
unsigned int char_maxlen;
|
||||
const char *comment;
|
||||
unsigned int (*mb_charlen)(unsigned int c);
|
||||
unsigned int (*mb_valid)(const char *start, const char *end);
|
||||
unsigned int nr;
|
||||
const char *name;
|
||||
const char *collation;
|
||||
unsigned int char_minlen;
|
||||
unsigned int char_maxlen;
|
||||
const char *comment;
|
||||
unsigned int (*mb_charlen)(unsigned int c);
|
||||
unsigned int (*mb_valid)(const char *start, const char *end);
|
||||
} MYSQLND_CHARSET;
|
||||
|
||||
|
||||
@@ -148,8 +147,8 @@ typedef struct st_mysqlnd_options
|
||||
ulong flags;
|
||||
|
||||
/* init commands - we need to send them to server directly after connect */
|
||||
unsigned int num_commands;
|
||||
char **init_commands;
|
||||
unsigned int num_commands;
|
||||
char **init_commands;
|
||||
|
||||
/* configuration file information */
|
||||
char *cfg_file;
|
||||
@@ -231,7 +230,7 @@ typedef void (*mysqlnd_stat_trigger)(MYSQLND_STATS * stats, enum_mysqlnd_collect
|
||||
struct st_mysqlnd_stats
|
||||
{
|
||||
uint64_t *values;
|
||||
mysqlnd_stat_trigger *triggers;
|
||||
mysqlnd_stat_trigger *triggers;
|
||||
size_t count;
|
||||
zend_bool in_trigger;
|
||||
#ifdef ZTS
|
||||
@@ -258,7 +257,7 @@ typedef size_t (*func_mysqlnd_net__send)(MYSQLND * const conn, char * const b
|
||||
typedef size_t (*func_mysqlnd_net__receive)(MYSQLND * conn, zend_uchar * buffer, size_t count TSRMLS_DC);
|
||||
typedef enum_func_status (*func_mysqlnd_net__set_client_option)(MYSQLND_NET * const net, enum_mysqlnd_option option, const char * const value TSRMLS_DC);
|
||||
typedef enum_func_status (*func_mysqlnd_net__network_read)(MYSQLND * conn, zend_uchar * buffer, size_t count TSRMLS_DC);
|
||||
typedef size_t (*func_mysqlnd_net__network_write)(MYSQLND * const conn, const zend_uchar * const buf, size_t count TSRMLS_DC);
|
||||
typedef size_t (*func_mysqlnd_net__network_write)(MYSQLND * const conn, const zend_uchar * const buf, size_t count TSRMLS_DC);
|
||||
typedef enum_func_status (*func_mysqlnd_net__decode)(zend_uchar * uncompressed_data, size_t uncompressed_data_len, const zend_uchar * const compressed_data, size_t compressed_data_len TSRMLS_DC);
|
||||
typedef enum_func_status (*func_mysqlnd_net__encode)(zend_uchar * compress_buffer, size_t compress_buffer_len, const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC);
|
||||
typedef size_t (*func_mysqlnd_net__consume_uneaten_data)(MYSQLND_NET * const net, enum php_mysqlnd_server_command cmd TSRMLS_DC);
|
||||
@@ -671,7 +670,7 @@ struct st_mysqlnd_net
|
||||
/* cmd buffer */
|
||||
MYSQLND_CMD_BUFFER cmd_buffer;
|
||||
|
||||
MYSQLND_NET_OPTIONS options;
|
||||
MYSQLND_NET_OPTIONS options;
|
||||
|
||||
zend_bool persistent;
|
||||
};
|
||||
@@ -707,7 +706,7 @@ struct st_mysqlnd_connection
|
||||
unsigned char *scramble;
|
||||
const MYSQLND_CHARSET *charset;
|
||||
const MYSQLND_CHARSET *greet_charset;
|
||||
char *connect_or_select_db;
|
||||
char *connect_or_select_db;
|
||||
unsigned int connect_or_select_db_len;
|
||||
MYSQLND_INFILE infile;
|
||||
unsigned int protocol_version;
|
||||
@@ -833,7 +832,7 @@ struct st_mysqlnd_res
|
||||
|
||||
struct st_mysqlnd_packet_row * row_packet;
|
||||
|
||||
MYSQLND_MEMORY_POOL * result_set_memory_pool;
|
||||
MYSQLND_MEMORY_POOL * result_set_memory_pool;
|
||||
zend_bool persistent;
|
||||
};
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L
|
||||
|
||||
/* {{{ php_mysqlnd_net_field_length
|
||||
Get next field's length */
|
||||
unsigned long php_mysqlnd_net_field_length(zend_uchar **packet)
|
||||
unsigned long
|
||||
php_mysqlnd_net_field_length(zend_uchar **packet)
|
||||
{
|
||||
register zend_uchar *p= (zend_uchar *)*packet;
|
||||
|
||||
@@ -149,7 +150,8 @@ unsigned long php_mysqlnd_net_field_length(zend_uchar **packet)
|
||||
|
||||
/* {{{ php_mysqlnd_net_field_length_ll
|
||||
Get next field's length */
|
||||
uint64_t php_mysqlnd_net_field_length_ll(zend_uchar **packet)
|
||||
uint64_t
|
||||
php_mysqlnd_net_field_length_ll(zend_uchar **packet)
|
||||
{
|
||||
register zend_uchar *p= (zend_uchar *)*packet;
|
||||
|
||||
@@ -177,7 +179,8 @@ uint64_t php_mysqlnd_net_field_length_ll(zend_uchar **packet)
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_net_store_length */
|
||||
zend_uchar *php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length)
|
||||
zend_uchar *
|
||||
php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length)
|
||||
{
|
||||
if (length < (uint64_t) L64(251)) {
|
||||
*packet = (zend_uchar) length;
|
||||
@@ -383,8 +386,8 @@ void php_mysqlnd_greet_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_crypt */
|
||||
static
|
||||
void php_mysqlnd_crypt(zend_uchar *buffer, const zend_uchar *s1, const zend_uchar *s2, size_t len)
|
||||
static void
|
||||
php_mysqlnd_crypt(zend_uchar *buffer, const zend_uchar *s1, const zend_uchar *s2, size_t len)
|
||||
{
|
||||
const zend_uchar *s1_end = s1 + len;
|
||||
while (s1 < s1_end) {
|
||||
@@ -395,8 +398,7 @@ void php_mysqlnd_crypt(zend_uchar *buffer, const zend_uchar *s1, const zend_ucha
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_scramble */
|
||||
void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble,
|
||||
const zend_uchar * const password)
|
||||
void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const password)
|
||||
{
|
||||
PHP_SHA1_CTX context;
|
||||
zend_uchar sha1[SHA1_MAX_LENGTH];
|
||||
@@ -427,7 +429,7 @@ void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const sc
|
||||
|
||||
/* {{{ php_mysqlnd_auth_write */
|
||||
static
|
||||
size_t php_mysqlnd_auth_write(void *_packet, MYSQLND *conn TSRMLS_DC)
|
||||
size_t php_mysqlnd_auth_write(void *_packet, MYSQLND * conn TSRMLS_DC)
|
||||
{
|
||||
char buffer[1024];
|
||||
register char *p= buffer + MYSQLND_HEADER_SIZE; /* start after the header */
|
||||
@@ -567,8 +569,8 @@ php_mysqlnd_ok_read(void *_packet, MYSQLND *conn TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_ok_free_mem */
|
||||
static
|
||||
void php_mysqlnd_ok_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
static void
|
||||
php_mysqlnd_ok_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_PACKET_OK *p= (MYSQLND_PACKET_OK *) _packet;
|
||||
if (p->message) {
|
||||
@@ -1028,7 +1030,7 @@ void php_mysqlnd_rset_field_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
|
||||
/* {{{ php_mysqlnd_read_row_ex */
|
||||
static enum_func_status
|
||||
php_mysqlnd_read_row_ex(MYSQLND *conn, MYSQLND_MEMORY_POOL * result_set_memory_pool,
|
||||
php_mysqlnd_read_row_ex(MYSQLND * conn, MYSQLND_MEMORY_POOL * result_set_memory_pool,
|
||||
MYSQLND_MEMORY_POOL_CHUNK **buffer,
|
||||
uint64_t *data_size, zend_bool persistent_alloc,
|
||||
unsigned int prealloc_more_bytes TSRMLS_DC)
|
||||
@@ -1103,11 +1105,12 @@ php_mysqlnd_read_row_ex(MYSQLND *conn, MYSQLND_MEMORY_POOL * result_set_memory_p
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_rowp_read_binary_protocol */
|
||||
void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
|
||||
unsigned int field_count, MYSQLND_FIELD *fields_metadata,
|
||||
zend_bool persistent,
|
||||
zend_bool as_unicode, zend_bool as_int_or_float,
|
||||
MYSQLND_STATS * stats TSRMLS_DC)
|
||||
void
|
||||
php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
|
||||
unsigned int field_count, MYSQLND_FIELD *fields_metadata,
|
||||
zend_bool persistent,
|
||||
zend_bool as_unicode, zend_bool as_int_or_float,
|
||||
MYSQLND_STATS * stats TSRMLS_DC)
|
||||
{
|
||||
int i;
|
||||
zend_uchar *p = row_buffer->ptr;
|
||||
@@ -1122,8 +1125,8 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
|
||||
/* skip the first byte, not EODATA_MARKER -> 0x0, status */
|
||||
p++;
|
||||
null_ptr= p;
|
||||
p += (field_count + 9)/8; /* skip null bits */
|
||||
bit = 4; /* first 2 bits are reserved */
|
||||
p += (field_count + 9)/8; /* skip null bits */
|
||||
bit = 4; /* first 2 bits are reserved */
|
||||
|
||||
for (i = 0; current_field < end_field; current_field++, i++) {
|
||||
DBG_INF("Directly creating zval");
|
||||
@@ -1139,8 +1142,7 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
|
||||
MYSQLND_INC_CONN_STATISTIC(stats, STAT_BINARY_TYPE_FETCHED_NULL);
|
||||
} else {
|
||||
enum_mysqlnd_field_types type = fields_metadata[i].type;
|
||||
mysqlnd_ps_fetch_functions[type].func(*current_field, &fields_metadata[i],
|
||||
0, &p, as_unicode TSRMLS_CC);
|
||||
mysqlnd_ps_fetch_functions[type].func(*current_field, &fields_metadata[i], 0, &p, as_unicode TSRMLS_CC);
|
||||
|
||||
if (MYSQLND_G(collect_statistics)) {
|
||||
enum_mysqlnd_collected_stats statistic;
|
||||
@@ -1189,11 +1191,12 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_rowp_read_text_protocol */
|
||||
void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
|
||||
unsigned int field_count, MYSQLND_FIELD *fields_metadata,
|
||||
zend_bool persistent,
|
||||
zend_bool as_unicode, zend_bool as_int_or_float,
|
||||
MYSQLND_STATS * stats TSRMLS_DC)
|
||||
void
|
||||
php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
|
||||
unsigned int field_count, MYSQLND_FIELD *fields_metadata,
|
||||
zend_bool persistent,
|
||||
zend_bool as_unicode, zend_bool as_int_or_float,
|
||||
MYSQLND_STATS * stats TSRMLS_DC)
|
||||
{
|
||||
int i;
|
||||
zend_bool last_field_was_string = FALSE;
|
||||
@@ -1332,8 +1335,7 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
|
||||
Definitely not nice, _hackish_ :(, but works.
|
||||
*/
|
||||
zend_uchar *start = bit_area;
|
||||
ps_fetch_from_1_to_8_bytes(*current_field, &(fields_metadata[i]),
|
||||
0, &p, as_unicode, len TSRMLS_CC);
|
||||
ps_fetch_from_1_to_8_bytes(*current_field, &(fields_metadata[i]), 0, &p, as_unicode, len TSRMLS_CC);
|
||||
/*
|
||||
We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
|
||||
later in this function there will be an advancement.
|
||||
@@ -1382,8 +1384,8 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
|
||||
because then we will leak.
|
||||
|
||||
XXX: Keep in mind that up there there is an open `else` in
|
||||
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
|
||||
which will make with this `if` an `else if`.
|
||||
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
|
||||
which will make with this `if` an `else if`.
|
||||
*/
|
||||
if ((perm_bind.is_possibly_blob == TRUE &&
|
||||
fields_metadata[i].charsetnr == MYSQLND_BINARY_CHARSET_NR) ||
|
||||
@@ -1429,8 +1431,7 @@ php_mysqlnd_rowp_read(void *_packet, MYSQLND *conn TSRMLS_DC)
|
||||
|
||||
if (!packet->binary_protocol && packet->bit_fields_count) {
|
||||
/* For every field we need terminating \0 */
|
||||
post_alloc_for_bit_fields =
|
||||
packet->bit_fields_total_len + packet->bit_fields_count;
|
||||
post_alloc_for_bit_fields = packet->bit_fields_total_len + packet->bit_fields_count;
|
||||
}
|
||||
|
||||
ret = php_mysqlnd_read_row_ex(conn, packet->result_set_memory_pool, &packet->row_buffer, &data_size,
|
||||
@@ -1511,8 +1512,8 @@ end:
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_rowp_free_mem */
|
||||
static
|
||||
void php_mysqlnd_rowp_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
static void
|
||||
php_mysqlnd_rowp_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_PACKET_ROW *p;
|
||||
|
||||
@@ -1526,9 +1527,9 @@ void php_mysqlnd_rowp_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
/*
|
||||
Don't free packet->fields :
|
||||
- normal queries -> store_result() | fetch_row_unbuffered() will transfer
|
||||
the ownership and NULL it.
|
||||
the ownership and NULL it.
|
||||
- PS will pass in it the bound variables, we have to use them! and of course
|
||||
not free the array. As it is passed to us, we should not clean it ourselves.
|
||||
not free the array. As it is passed to us, we should not clean it ourselves.
|
||||
*/
|
||||
if (!alloca) {
|
||||
mnd_pefree(p, p->header.persistent);
|
||||
@@ -1651,8 +1652,8 @@ php_mysqlnd_prepare_read(void *_packet, MYSQLND *conn TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_prepare_free_mem */
|
||||
static
|
||||
void php_mysqlnd_prepare_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
static void
|
||||
php_mysqlnd_prepare_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_PACKET_PREPARE_RESPONSE *p= (MYSQLND_PACKET_PREPARE_RESPONSE *) _packet;
|
||||
if (!alloca) {
|
||||
@@ -1712,8 +1713,8 @@ php_mysqlnd_chg_user_read(void *_packet, MYSQLND *conn TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ php_mysqlnd_chg_user_free_mem */
|
||||
static
|
||||
void php_mysqlnd_chg_user_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
static void
|
||||
php_mysqlnd_chg_user_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
{
|
||||
if (!alloca) {
|
||||
mnd_pefree(_packet, ((MYSQLND_PACKET_CHG_USER_RESPONSE *)_packet)->header.persistent);
|
||||
@@ -1722,8 +1723,7 @@ void php_mysqlnd_chg_user_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ packet_methods
|
||||
*/
|
||||
/* {{{ packet_methods */
|
||||
static
|
||||
mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
{
|
||||
@@ -1797,7 +1797,6 @@ mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::get_greet_packet */
|
||||
static struct st_mysqlnd_packet_greet *
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_greet_packet)(MYSQLND_PROTOCOL * const protocol, zend_bool persistent TSRMLS_DC)
|
||||
@@ -1986,7 +1985,8 @@ mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)
|
||||
|
||||
|
||||
/* {{{ _mysqlnd_plugin_get_plugin_protocol_data */
|
||||
PHPAPI void ** _mysqlnd_plugin_get_plugin_protocol_data(const MYSQLND_PROTOCOL * protocol, unsigned int plugin_id TSRMLS_DC)
|
||||
PHPAPI void **
|
||||
_mysqlnd_plugin_get_plugin_protocol_data(const MYSQLND_PROTOCOL * protocol, unsigned int plugin_id TSRMLS_DC)
|
||||
{
|
||||
DBG_ENTER("_mysqlnd_plugin_get_plugin_protocol_data");
|
||||
DBG_INF_FMT("plugin_id=%u", plugin_id);
|
||||
|
||||
@@ -49,8 +49,8 @@ PHPAPI void mysqlnd_minfo_print_hash(zval *values)
|
||||
zstr string_key;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
int s_len;
|
||||
char *s = NULL;
|
||||
int s_len;
|
||||
char *s = NULL;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, &string_key_len, &num_key, 0, &pos_values);
|
||||
|
||||
@@ -27,3 +27,12 @@
|
||||
extern zend_module_entry mysqlnd_module_entry;
|
||||
|
||||
#endif /* PHP_MYSQLND_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user