@@ -420,7 +420,7 @@ MYSQLND_METHOD(mysqlnd_stmt, prepare)(MYSQLND_STMT * const s, const char * const
420
420
{
421
421
enum_func_status ret = FAIL ;
422
422
const MYSQLND_CSTRING query_string = {query , query_len };
423
- struct st_mysqlnd_protocol_command * command = mysqlnd_get_command (COM_STMT_PREPARE , stmt_to_prepare -> conn , query_string );
423
+ struct st_mysqlnd_protocol_command * command = stmt_to_prepare -> conn -> command_factory (COM_STMT_PREPARE , stmt_to_prepare -> conn , query_string );
424
424
if (command ) {
425
425
ret = command -> run (command );
426
426
command -> free_command (command );
@@ -734,7 +734,7 @@ MYSQLND_METHOD(mysqlnd_stmt, send_execute)(MYSQLND_STMT * const s, enum_mysqlnd_
734
734
ret = s -> m -> generate_execute_request (s , & request , & request_len , & free_request );
735
735
if (ret == PASS ) {
736
736
const MYSQLND_CSTRING payload = {request , request_len };
737
- struct st_mysqlnd_protocol_command * command = mysqlnd_get_command (COM_STMT_EXECUTE , stmt -> conn , payload );
737
+ struct st_mysqlnd_protocol_command * command = stmt -> conn -> command_factory (COM_STMT_EXECUTE , stmt -> conn , payload );
738
738
ret = FAIL ;
739
739
if (command ) {
740
740
ret = command -> run (command );
@@ -1033,16 +1033,14 @@ MYSQLND_METHOD(mysqlnd_stmt, use_result)(MYSQLND_STMT * s)
1033
1033
/* }}} */
1034
1034
1035
1035
1036
- #define STMT_ID_LENGTH 4
1037
-
1038
1036
/* {{{ mysqlnd_fetch_row_cursor */
1039
1037
enum_func_status
1040
1038
mysqlnd_fetch_stmt_row_cursor (MYSQLND_RES * result , void * param , unsigned int flags , zend_bool * fetched_anything )
1041
1039
{
1042
1040
enum_func_status ret ;
1043
1041
MYSQLND_STMT * s = (MYSQLND_STMT * ) param ;
1044
1042
MYSQLND_STMT_DATA * stmt = s ? s -> data :NULL ;
1045
- zend_uchar buf [STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */ ];
1043
+ zend_uchar buf [MYSQLND_STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */ ];
1046
1044
MYSQLND_PACKET_ROW * row_packet ;
1047
1045
1048
1046
DBG_ENTER ("mysqlnd_fetch_stmt_row_cursor" );
@@ -1069,11 +1067,11 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int f
1069
1067
SET_EMPTY_ERROR (* stmt -> conn -> error_info );
1070
1068
1071
1069
int4store (buf , stmt -> stmt_id );
1072
- int4store (buf + STMT_ID_LENGTH , 1 ); /* for now fetch only one row */
1070
+ int4store (buf + MYSQLND_STMT_ID_LENGTH , 1 ); /* for now fetch only one row */
1073
1071
1074
1072
{
1075
1073
const MYSQLND_CSTRING payload = {buf , sizeof (buf )};
1076
- struct st_mysqlnd_protocol_command * command = mysqlnd_get_command (COM_STMT_FETCH , stmt -> conn , payload );
1074
+ struct st_mysqlnd_protocol_command * command = stmt -> conn -> command_factory (COM_STMT_FETCH , stmt -> conn , payload );
1077
1075
ret = FAIL ;
1078
1076
if (command ) {
1079
1077
ret = command -> run (command );
@@ -1262,7 +1260,6 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s)
1262
1260
{
1263
1261
MYSQLND_STMT_DATA * stmt = s ? s -> data :NULL ;
1264
1262
enum_func_status ret = PASS ;
1265
- zend_uchar cmd_buf [STMT_ID_LENGTH /* statement id */ ];
1266
1263
1267
1264
DBG_ENTER ("mysqlnd_stmt::reset" );
1268
1265
if (!stmt || !stmt -> conn ) {
@@ -1294,11 +1291,9 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s)
1294
1291
be separated before that.
1295
1292
*/
1296
1293
1297
- int4store (cmd_buf , stmt -> stmt_id );
1298
-
1299
1294
if (CONN_GET_STATE (conn ) == CONN_READY ) {
1300
- const MYSQLND_CSTRING payload = { cmd_buf , sizeof ( cmd_buf )} ;
1301
- struct st_mysqlnd_protocol_command * command = mysqlnd_get_command (COM_STMT_RESET , stmt -> conn , payload );
1295
+ size_t stmt_id = stmt -> stmt_id ;
1296
+ struct st_mysqlnd_protocol_command * command = stmt -> conn -> command_factory (COM_STMT_RESET , stmt -> conn , stmt_id );
1302
1297
ret = FAIL ;
1303
1298
if (command ) {
1304
1299
ret = command -> run (command );
@@ -1411,18 +1406,18 @@ MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned in
1411
1406
1412
1407
if (CONN_GET_STATE (conn ) == CONN_READY ) {
1413
1408
size_t packet_len ;
1414
- cmd_buf = mnd_emalloc (packet_len = STMT_ID_LENGTH + 2 + length );
1409
+ cmd_buf = mnd_emalloc (packet_len = MYSQLND_STMT_ID_LENGTH + 2 + length );
1415
1410
if (cmd_buf ) {
1416
1411
stmt -> param_bind [param_no ].flags |= MYSQLND_PARAM_BIND_BLOB_USED ;
1417
1412
1418
1413
int4store (cmd_buf , stmt -> stmt_id );
1419
- int2store (cmd_buf + STMT_ID_LENGTH , param_no );
1420
- memcpy (cmd_buf + STMT_ID_LENGTH + 2 , data , length );
1414
+ int2store (cmd_buf + MYSQLND_STMT_ID_LENGTH , param_no );
1415
+ memcpy (cmd_buf + MYSQLND_STMT_ID_LENGTH + 2 , data , length );
1421
1416
1422
1417
/* COM_STMT_SEND_LONG_DATA doesn't send an OK packet*/
1423
1418
{
1424
1419
const MYSQLND_CSTRING payload = {cmd_buf , packet_len };
1425
- struct st_mysqlnd_protocol_command * command = mysqlnd_get_command (COM_STMT_SEND_LONG_DATA , stmt -> conn , payload );
1420
+ struct st_mysqlnd_protocol_command * command = stmt -> conn -> command_factory (COM_STMT_SEND_LONG_DATA , stmt -> conn , payload );
1426
1421
ret = FAIL ;
1427
1422
if (command ) {
1428
1423
ret = command -> run (command );
@@ -2207,7 +2202,6 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, net_close)(MYSQLND_STMT * const s, zend_boo
2207
2202
{
2208
2203
MYSQLND_STMT_DATA * stmt = s ? s -> data :NULL ;
2209
2204
MYSQLND_CONN_DATA * conn ;
2210
- zend_uchar cmd_buf [STMT_ID_LENGTH /* statement id */ ];
2211
2205
enum_mysqlnd_collected_stats statistic = STAT_LAST ;
2212
2206
2213
2207
DBG_ENTER ("mysqlnd_stmt::net_close" );
@@ -2247,11 +2241,10 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, net_close)(MYSQLND_STMT * const s, zend_boo
2247
2241
MYSQLND_INC_GLOBAL_STATISTIC (implicit == TRUE? STAT_FREE_RESULT_IMPLICIT :
2248
2242
STAT_FREE_RESULT_EXPLICIT );
2249
2243
2250
- int4store (cmd_buf , stmt -> stmt_id );
2251
2244
if (CONN_GET_STATE (conn ) == CONN_READY ) {
2252
2245
enum_func_status ret = FAIL ;
2253
- const MYSQLND_CSTRING payload = { cmd_buf , sizeof ( cmd_buf )} ;
2254
- struct st_mysqlnd_protocol_command * command = mysqlnd_get_command (COM_STMT_CLOSE , conn , payload );
2246
+ size_t stmt_id = stmt -> stmt_id ;
2247
+ struct st_mysqlnd_protocol_command * command = conn -> command_factory (COM_STMT_CLOSE , conn , stmt_id );
2255
2248
if (command ) {
2256
2249
ret = command -> run (command );
2257
2250
command -> free_command (command );
0 commit comments