1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

moved utf8::upgrade in dbdimp.c for performance

- and uprade occurs only if imp_dbh->unicode is true so that we can minimize impact on existing applications
This commit is contained in:
Kenichi Ishigaki 2014-07-07 09:42:23 +09:00
parent 6c57a3e2aa
commit 28ea4bfad7
3 changed files with 10 additions and 5 deletions

View file

@ -586,11 +586,12 @@ sqlite_db_last_insert_id(SV *dbh, imp_dbh_t *imp_dbh, SV *catalog, SV *schema, S
}
int
sqlite_st_prepare(SV *sth, imp_sth_t *imp_sth, char *statement, SV *attribs)
sqlite_st_prepare_sv(SV *sth, imp_sth_t *imp_sth, SV *sv_statement, SV *attribs)
{
dTHX;
int rc = 0;
const char *extra;
char *statement;
D_imp_dbh_from_sth;
if (!DBIc_ACTIVE(imp_dbh)) {
@ -598,6 +599,13 @@ sqlite_st_prepare(SV *sth, imp_sth_t *imp_sth, char *statement, SV *attribs)
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
}
/* sqlite3_prepare wants an utf8-encoded SQL statement */
if (imp_dbh->unicode) {
sv_utf8_upgrade(sv_statement);
}
statement = SvPV_nolen(sv_statement);
#if 0
if (*statement == '\0') {
sqlite_error(sth, -2, "attempt to prepare empty statement");

View file

@ -64,7 +64,7 @@ struct imp_sth_st {
#define dbd_db_STORE_attrib sqlite_db_STORE_attrib
#define dbd_db_FETCH_attrib sqlite_db_FETCH_attrib
#define dbd_db_last_insert_id sqlite_db_last_insert_id
#define dbd_st_prepare sqlite_st_prepare
#define dbd_st_prepare_sv sqlite_st_prepare_sv
#define dbd_st_rows sqlite_st_rows
#define dbd_st_execute sqlite_st_execute
#define dbd_st_fetch sqlite_st_fetch

View file

@ -196,9 +196,6 @@ sub prepare {
my $sql = shift;
$sql = '' unless defined $sql;
# sqlite3_prepare wants an utf8-encoded SQL statement
utf8::upgrade($sql);
my $sth = DBI::_new_sth( $dbh, {
Statement => $sql,
} );