mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-08 06:38:12 -04:00
DBD::SQLite: cosmetics and squash a warning
This commit is contained in:
parent
1dcd2489c0
commit
bcdce2f1fc
1 changed files with 13 additions and 15 deletions
26
dbdimp.c
26
dbdimp.c
|
@ -99,8 +99,7 @@ sqlite_db_login(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pas
|
|||
if ( rc != SQLITE_OK ) {
|
||||
/* warn("failed to set pragma: %s\n", errmsg); */
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
if (errmsg)
|
||||
sqlite3_free(errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
sqlite3_close(imp_dbh->db); /* we don't use this handle */
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
}
|
||||
|
@ -109,8 +108,7 @@ sqlite_db_login(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pas
|
|||
if ( rc != SQLITE_OK ) {
|
||||
/* warn("failed to set pragma: %s\n", errmsg); */
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
if (errmsg)
|
||||
sqlite3_free(errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
sqlite3_close(imp_dbh->db); /* we don't use this handle */
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
}
|
||||
|
@ -175,7 +173,7 @@ sqlite_db_disconnect(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
** XXX: Putting "warn" here is just for the debugging purpose.
|
||||
*/
|
||||
warn((char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
/* warn("closing dbh with active statement handles"); */
|
||||
}
|
||||
imp_dbh->db = NULL;
|
||||
|
@ -229,8 +227,7 @@ sqlite_db_rollback(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
rc = sqlite3_exec(imp_dbh->db, "ROLLBACK TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
if (errmsg)
|
||||
sqlite3_free(errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
|
@ -261,8 +258,7 @@ sqlite_db_commit(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
rc = sqlite3_exec(imp_dbh->db, "COMMIT TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
if (errmsg)
|
||||
sqlite3_free(errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
|
@ -428,8 +424,7 @@ sqlite_st_execute (SV *sth, imp_sth_t *imp_sth)
|
|||
rc = sqlite3_exec(imp_dbh->db, "BEGIN TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, errmsg);
|
||||
if (errmsg)
|
||||
sqlite3_free(errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return -2; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
|
@ -663,13 +658,17 @@ void
|
|||
sqlite_st_destroy(SV *sth, imp_sth_t *imp_sth)
|
||||
{
|
||||
dTHX;
|
||||
int rc;
|
||||
|
||||
D_imp_dbh_from_sth;
|
||||
/* warn("destroy statement: %s\n", imp_sth->statement); */
|
||||
DBIc_ACTIVE_off(imp_sth);
|
||||
if (DBIc_ACTIVE(imp_dbh)) {
|
||||
/* finalize sth when active connection */
|
||||
sqlite3_finalize(imp_sth->stmt);
|
||||
rc = sqlite3_finalize(imp_sth->stmt);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
}
|
||||
}
|
||||
Safefree(imp_sth->statement);
|
||||
SvREFCNT_dec((SV*)imp_sth->params);
|
||||
|
@ -700,8 +699,7 @@ sqlite_db_STORE_attrib(SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv)
|
|||
rc = sqlite3_exec(imp_dbh->db, "COMMIT TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
if (errmsg)
|
||||
sqlite3_free(errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return TRUE; /* XXX: is this correct? */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue