diff options
| author | Andrey Hristov <andrey@php.net> | 2015-10-12 14:57:48 +0200 |
|---|---|---|
| committer | Andrey Hristov <andrey@php.net> | 2015-11-12 16:19:16 +0100 |
| commit | cfd868651a321fbfd84ed98e33669c5f94a7098a (patch) | |
| tree | 5ba7809e4adcf207b94d64964ee98358a53f9e8b /ext/mysqlnd/mysqlnd_structs.h | |
| parent | 75dc67c6ae620f1262d8233594dae2f7ed77a19a (diff) | |
| download | php-git-cfd868651a321fbfd84ed98e33669c5f94a7098a.tar.gz | |
MDNR:
- removed init() method from mysqlnd_conn_data and moved the initialization
to the object factory->get_connection(). Now it is unified as with the prepared
statement which doesn't have any init() method
- the protocol decoder factory now takes connection as parameter at creation and
thus there is no need to pass the connection as parameter when calling the read
or the write method of a packet.
- saved the protocol payload decoder factory as pointer in every packet (read/write)
so the connection doesn't need to be passed on every call of read/write (dependency
has been already injected at creation). This will alow to move protocol specific
code from MYSQLND_NET (send_ex()) to make MYSQLND_NET leaner and free from protocol
stuff.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_structs.h')
| -rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 03a341baba..cfd8c1e4f4 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -357,6 +357,7 @@ struct st_mysqlnd_packet_auth_pam; struct st_mysqlnd_packet_sha256_pk_request; struct st_mysqlnd_packet_sha256_pk_request_response; +typedef MYSQLND_CONN_DATA * (*func_mysqlnd_protocol_payload_decoder_factory__get_mysqlnd_conn_data)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory); typedef struct st_mysqlnd_packet_greet * (*func_mysqlnd_protocol_payload_decoder_factory__get_greet_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, zend_bool persistent); typedef struct st_mysqlnd_packet_auth * (*func_mysqlnd_protocol_payload_decoder_factory__get_auth_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, zend_bool persistent); typedef struct st_mysqlnd_packet_auth_response *(*func_mysqlnd_protocol_payload_decoder_factory__get_auth_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, zend_bool persistent); @@ -375,6 +376,7 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response *(*func_mysqlnd_prot struct st_mysqlnd_protocol_payload_decoder_factory_methods { + func_mysqlnd_protocol_payload_decoder_factory__get_mysqlnd_conn_data get_mysqlnd_conn_data; func_mysqlnd_protocol_payload_decoder_factory__get_greet_packet get_greet_packet; func_mysqlnd_protocol_payload_decoder_factory__get_auth_packet get_auth_packet; func_mysqlnd_protocol_payload_decoder_factory__get_auth_response_packet get_auth_response_packet; @@ -401,7 +403,7 @@ typedef MYSQLND * (*func_mysqlnd_object_factory__get_connection)(zend_bool persi typedef MYSQLND * (*func_mysqlnd_object_factory__clone_connection_object)(MYSQLND * conn); typedef MYSQLND_STMT * (*func_mysqlnd_object_factory__get_prepared_statement)(MYSQLND_CONN_DATA * conn); typedef MYSQLND_NET * (*func_mysqlnd_object_factory__get_io_channel)(zend_bool persistent, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info); -typedef MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * (*func_mysqlnd_object_factory__get_protocol_payload_decoder_factory)(zend_bool persistent); +typedef MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * (*func_mysqlnd_object_factory__get_protocol_payload_decoder_factory)(MYSQLND_CONN_DATA * conn, zend_bool persistent); struct st_mysqlnd_object_factory_methods @@ -414,7 +416,6 @@ struct st_mysqlnd_object_factory_methods }; -typedef enum_func_status (*func_mysqlnd_conn_data__init)(MYSQLND_CONN_DATA * conn); typedef enum_func_status (*func_mysqlnd_conn_data__connect)(MYSQLND_CONN_DATA * conn, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags); typedef zend_ulong (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len); typedef enum_func_status (*func_mysqlnd_conn_data__set_charset)(MYSQLND_CONN_DATA * const conn, const char * const charset); @@ -510,7 +511,6 @@ typedef unsigned int (*func_mysqlnd_conn_data__get_client_api_capabilities)(con struct st_mysqlnd_conn_data_methods { - func_mysqlnd_conn_data__init init; func_mysqlnd_conn_data__connect connect; func_mysqlnd_conn_data__escape_string escape_string; func_mysqlnd_conn_data__set_charset set_charset; @@ -894,6 +894,7 @@ struct st_mysqlnd_net struct st_mysqlnd_protocol_payload_decoder_factory { + MYSQLND_CONN_DATA * conn; zend_bool persistent; struct st_mysqlnd_protocol_payload_decoder_factory_methods m; }; |
