1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 22:28:47 -04:00

DBD-SQLite: use form()/Perl_form() instead of sqlite3_snprintf() (#45578)

This commit is contained in:
Kenichi Ishigaki 2009-04-30 06:37:27 +00:00
parent 974ebde43c
commit 89831ec6b1

View file

@ -55,10 +55,9 @@ _sqlite_tracef(char *file, int line, SV *h, imp_xxh_t *imp_xxh, int level, const
{
dTHX;
va_list ap;
if ( DBIc_TRACE_LEVEL(imp_xxh) >= level ) {
char format[8192];
sqlite3_snprintf(8191, format, "sqlite trace: %s at %s line %d\n", fmt, file, line);
va_list ap;
const char* format = form("sqlite trace: %s at %s line %d\n", fmt, file, line);
va_start(ap, fmt);
PerlIO_vprintf(DBIc_LOGPIO(imp_xxh), format, ap);
va_end(ap);
@ -70,10 +69,9 @@ _sqlite_tracef_noline(SV *h, imp_xxh_t *imp_xxh, int level, const char *fmt, ...
{
dTHX;
va_list ap;
if ( DBIc_TRACE_LEVEL(imp_xxh) >= level ) {
char format[8192];
sqlite3_snprintf(8191, format, "sqlite trace: %s\n", fmt);
va_list ap;
const char* format = form("sqlite trace: %s\n", fmt);
va_start(ap, fmt);
PerlIO_vprintf(DBIc_LOGPIO(imp_xxh), format, ap);
va_end(ap);
@ -480,8 +478,7 @@ sqlite_bind_ph (SV *sth, imp_sth_t *imp_sth,
if(paramstring[len] == 0 && strlen(paramstring) == len) {
pos = sqlite3_bind_parameter_index(imp_sth->stmt, paramstring);
if (pos==0) {
char errmsg[8192];
sqlite3_snprintf(8191, errmsg, "Unknown named parameter: %s", paramstring);
const char* errmsg = form("Unknown named parameter: %s", paramstring);
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, errmsg);
return FALSE; /* -> &sv_no in SQLite.xsi */
}
@ -972,8 +969,7 @@ sqlite3_db_create_function(pTHX_ SV *dbh, const char *name, int argc, SV *func )
NULL, NULL );
if ( retval != SQLITE_OK )
{
char errmsg[8192];
sqlite3_snprintf(8191, errmsg, "sqlite_create_function failed with error %s", sqlite3_errmsg(imp_dbh->db));
const char* errmsg = form("sqlite_create_function failed with error %s", sqlite3_errmsg(imp_dbh->db));
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, retval, errmsg);
}
}
@ -987,8 +983,7 @@ sqlite3_db_enable_load_extension(pTHX_ SV *dbh, int onoff )
retval = sqlite3_enable_load_extension( imp_dbh->db, onoff );
if ( retval != SQLITE_OK )
{
char errmsg[8192];
sqlite3_snprintf(8191, errmsg, "sqlite_enable_load_extension failed with error %s", sqlite3_errmsg(imp_dbh->db));
const char* errmsg = form("sqlite_enable_load_extension failed with error %s", sqlite3_errmsg(imp_dbh->db));
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, retval, errmsg);
}
}
@ -1207,8 +1202,7 @@ sqlite3_db_create_aggregate(pTHX_ SV *dbh, const char *name, int argc, SV *aggr_
if ( retval != SQLITE_OK )
{
char errmsg[8192];
sqlite3_snprintf(8191, errmsg, "sqlite_create_aggregate failed with error %s", sqlite3_errmsg(imp_dbh->db));
const char* errmsg = form("sqlite_create_aggregate failed with error %s", sqlite3_errmsg(imp_dbh->db));
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, retval, errmsg);
}
}
@ -1309,8 +1303,7 @@ sqlite3_db_create_collation(pTHX_ SV *dbh, const char *name, SV *func )
if ( rv != SQLITE_OK )
{
char errmsg[8192];
sqlite3_snprintf(8191, errmsg, "sqlite_create_collation failed with error %s", sqlite3_errmsg(imp_dbh->db));
const char* errmsg = form("sqlite_create_collation failed with error %s", sqlite3_errmsg(imp_dbh->db));
}
}