diff options
author | andrey <andrey@php.net> | 2012-04-30 17:01:56 +0200 |
---|---|---|
committer | andrey <andrey@php.net> | 2012-04-30 17:01:56 +0200 |
commit | 174bf906f8cf96cf0c1c1719bde9c7a7f1fa7064 (patch) | |
tree | 2f5f5908bed578759d0152af283e57b48abcd2ea /ext/mysqlnd/mysqlnd_structs.h | |
parent | 743a74a3c5aaffbaa3a5248ca310d6ca8b41015f (diff) | |
download | php-git-174bf906f8cf96cf0c1c1719bde9c7a7f1fa7064.tar.gz |
refactor MYSQLND_NET, split it two parts for easy resharing
Diffstat (limited to 'ext/mysqlnd/mysqlnd_structs.h')
-rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 43eba40a20..7b8386a3f6 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -213,6 +213,7 @@ typedef struct st_mysqlnd_net_options typedef struct st_mysqlnd_connection MYSQLND; typedef struct st_mysqlnd_connection_data MYSQLND_CONN_DATA; typedef struct st_mysqlnd_net MYSQLND_NET; +typedef struct st_mysqlnd_net_data MYSQLND_NET_DATA; typedef struct st_mysqlnd_protocol MYSQLND_PROTOCOL; typedef struct st_mysqlnd_res MYSQLND_RES; typedef char** MYSQLND_ROW_C; /* return data as array of strings */ @@ -285,6 +286,9 @@ typedef void (*func_mysqlnd_net__close_stream)(MYSQLND_NET * const net, MYSQL typedef enum_func_status (*func_mysqlnd_net__open_stream)(MYSQLND_NET * const net, const char * const scheme, const size_t scheme_len, const zend_bool persistent, MYSQLND_STATS * const conn_stats, MYSQLND_ERROR_INFO * const error_info TSRMLS_DC); typedef void (*func_mysqlnd_net__post_connect_set_opt)(MYSQLND_NET * const net, const char * const scheme, const size_t scheme_len, MYSQLND_STATS * const conn_stats, MYSQLND_ERROR_INFO * const error_info TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_net__read_compressed_packet_from_stream_and_fill_read_buffer)(MYSQLND_NET * net, size_t net_payload_size, MYSQLND_STATS * conn_stats, MYSQLND_ERROR_INFO * error_info TSRMLS_DC); +typedef php_stream * (*func_mysqlnd_net__get_stream)(const MYSQLND_NET * const net TSRMLS_DC); +typedef php_stream * (*func_mysqlnd_net__set_stream)(MYSQLND_NET * const net, php_stream * net_stream TSRMLS_DC); +typedef func_mysqlnd_net__open_stream (*func_mysqlnd_net__get_open_stream)(MYSQLND_NET * const net, const char * const scheme, const size_t scheme_len, MYSQLND_ERROR_INFO * const error_info TSRMLS_DC); struct st_mysqlnd_net_methods { @@ -314,9 +318,9 @@ struct st_mysqlnd_net_methods func_mysqlnd_net__read_compressed_packet_from_stream_and_fill_read_buffer read_compressed_packet_from_stream_and_fill_read_buffer; - void * unused3; - void * unused4; - void * unused5; + func_mysqlnd_net__get_stream get_stream; + func_mysqlnd_net__set_stream set_stream; + func_mysqlnd_net__get_open_stream get_open_stream; void * unused6; void * unused7; }; @@ -768,31 +772,43 @@ struct st_mysqlnd_stmt_methods }; -struct st_mysqlnd_net +struct st_mysqlnd_net_data { php_stream *stream; + zend_bool compressed; +#ifdef MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND + zend_uchar last_command; +#else + zend_uchar unused_pad1; +#endif + MYSQLND_NET_OPTIONS options; + + unsigned int refcount; + + zend_bool persistent; + + struct st_mysqlnd_net_methods m; +}; + + +struct st_mysqlnd_net +{ + struct st_mysqlnd_net_data * data; + /* sequence for simple checking of correct packets */ zend_uchar packet_no; - zend_bool compressed; zend_uchar compressed_envelope_packet_no; + #ifdef MYSQLND_COMPRESSION_ENABLED MYSQLND_READ_BUFFER * uncompressed_data; #else void * unused_pad1; #endif -#ifdef MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND - zend_uchar last_command; -#else - zend_uchar unused_pad2; -#endif + /* cmd buffer */ MYSQLND_CMD_BUFFER cmd_buffer; - MYSQLND_NET_OPTIONS options; - - zend_bool persistent; - - struct st_mysqlnd_net_methods m; + zend_bool persistent; }; |