mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-08 06:38:12 -04:00
DBD-SQLite: a bit cleaner way to store a query for later reuse (#45578)
This commit is contained in:
parent
6af1d53c28
commit
8078b09593
1 changed files with 1 additions and 4 deletions
5
dbdimp.c
5
dbdimp.c
|
@ -272,7 +272,7 @@ sqlite_st_prepare (SV *sth, imp_sth_t *imp_sth,
|
||||||
imp_sth->retval = SQLITE_OK;
|
imp_sth->retval = SQLITE_OK;
|
||||||
imp_sth->params = newAV();
|
imp_sth->params = newAV();
|
||||||
imp_sth->col_types = newAV();
|
imp_sth->col_types = newAV();
|
||||||
Newz(0, imp_sth->statement, strlen(statement)+1, char);
|
imp_sth->statement = savepv(statement); /* store the query for later re-use if required */
|
||||||
|
|
||||||
if ((retval = sqlite3_prepare_v2(imp_dbh->db, statement, -1, &(imp_sth->stmt), &extra))
|
if ((retval = sqlite3_prepare_v2(imp_dbh->db, statement, -1, &(imp_sth->stmt), &extra))
|
||||||
!= SQLITE_OK)
|
!= SQLITE_OK)
|
||||||
|
@ -284,9 +284,6 @@ sqlite_st_prepare (SV *sth, imp_sth_t *imp_sth,
|
||||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store the query for later re-use if required */
|
|
||||||
Copy(statement, imp_sth->statement, strlen(statement)+1, char);
|
|
||||||
|
|
||||||
DBIc_NUM_PARAMS(imp_sth) = sqlite3_bind_parameter_count(imp_sth->stmt);
|
DBIc_NUM_PARAMS(imp_sth) = sqlite3_bind_parameter_count(imp_sth->stmt);
|
||||||
DBIc_NUM_FIELDS(imp_sth) = sqlite3_column_count(imp_sth->stmt);
|
DBIc_NUM_FIELDS(imp_sth) = sqlite3_column_count(imp_sth->stmt);
|
||||||
DBIc_IMPSET_on(imp_sth);
|
DBIc_IMPSET_on(imp_sth);
|
||||||
|
|
Loading…
Add table
Reference in a new issue