mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/pdo: Convert _pdo_dbh_t query_stmt_zval to a zend_object pointer (#17742)
This saves 8 bytes
This commit is contained in:
parent
bff0ec82a6
commit
5333afa607
3 changed files with 6 additions and 4 deletions
|
@ -1248,7 +1248,7 @@ PHP_METHOD(PDO, query)
|
||||||
}
|
}
|
||||||
/* something broke */
|
/* something broke */
|
||||||
dbh->query_stmt = stmt;
|
dbh->query_stmt = stmt;
|
||||||
ZVAL_OBJ(&dbh->query_stmt_zval, Z_OBJ_P(return_value));
|
dbh->query_stmt_obj = Z_OBJ_P(return_value);
|
||||||
GC_DELREF(stmt->database_object_handle);
|
GC_DELREF(stmt->database_object_handle);
|
||||||
stmt->database_object_handle = NULL;
|
stmt->database_object_handle = NULL;
|
||||||
PDO_HANDLE_STMT_ERR();
|
PDO_HANDLE_STMT_ERR();
|
||||||
|
@ -1468,7 +1468,8 @@ static void dbh_free(pdo_dbh_t *dbh, bool free_persistent)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dbh->query_stmt) {
|
if (dbh->query_stmt) {
|
||||||
zval_ptr_dtor(&dbh->query_stmt_zval);
|
OBJ_RELEASE(dbh->query_stmt_obj);
|
||||||
|
dbh->query_stmt_obj = NULL;
|
||||||
dbh->query_stmt = NULL;
|
dbh->query_stmt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ struct _pdo_dbh_t {
|
||||||
* This will allow us to report the correct error message
|
* This will allow us to report the correct error message
|
||||||
* when PDO::query() fails */
|
* when PDO::query() fails */
|
||||||
pdo_stmt_t *query_stmt;
|
pdo_stmt_t *query_stmt;
|
||||||
zval query_stmt_zval;
|
zend_object *query_stmt_obj;
|
||||||
|
|
||||||
/* defaults for fetches */
|
/* defaults for fetches */
|
||||||
enum pdo_fetch_type default_fetch_type;
|
enum pdo_fetch_type default_fetch_type;
|
||||||
|
|
|
@ -26,7 +26,8 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt);
|
||||||
memcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
|
memcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
|
||||||
if (dbh->query_stmt) { \
|
if (dbh->query_stmt) { \
|
||||||
dbh->query_stmt = NULL; \
|
dbh->query_stmt = NULL; \
|
||||||
zval_ptr_dtor(&dbh->query_stmt_zval); \
|
OBJ_RELEASE(dbh->query_stmt_obj); \
|
||||||
|
dbh->query_stmt_obj = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define PDO_STMT_CLEAR_ERR() do { \
|
#define PDO_STMT_CLEAR_ERR() do { \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue