From 2d51c203f09551323ed595514e03ab206fd93129 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 11 Dec 2020 17:13:38 +0100 Subject: PDO: Store/pass query_string as zend_string Rather than storing char* + size_t, use a zend_string*. Also avoid various copies of the query string. --- ext/pdo_sqlite/sqlite_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/pdo_sqlite') diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index a8a96c7a13..fcf82c62bf 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -175,7 +175,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */ } /* }}} */ -static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) +static int sqlite_handle_preparer(pdo_dbh_t *dbh, zend_string *sql, pdo_stmt_t *stmt, zval *driver_options) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt)); @@ -193,7 +193,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_le return 0; } - i = sqlite3_prepare_v2(H->db, sql, sql_len, &S->stmt, &tail); + i = sqlite3_prepare_v2(H->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &S->stmt, &tail); if (i == SQLITE_OK) { return 1; } -- cgit v1.2.1