mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
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.
This commit is contained in:
parent
c288b5294b
commit
2d51c203f0
15 changed files with 81 additions and 102 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue