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

DBD::SQLite: more cleanup

This commit is contained in:
Kenichi Ishigaki 2009-10-18 14:18:28 +00:00
parent c377a44184
commit 234d619b21
2 changed files with 23 additions and 21 deletions

View file

@ -676,18 +676,16 @@ sqlite_db_STORE_attrib (SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv)
dTHX;
char *key = SvPV_nolen(keysv);
char *errmsg;
int retval;
int rc;
if (strEQ(key, "AutoCommit")) {
if (SvTRUE(valuesv)) {
/* commit tran? */
if ( (!DBIc_is(imp_dbh, DBIcf_AutoCommit)) && (!sqlite3_get_autocommit(imp_dbh->db)) ) {
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "COMMIT TRAN");
if ((retval = sqlite3_exec(imp_dbh->db, "COMMIT TRANSACTION",
NULL, NULL, &errmsg))
!= SQLITE_OK)
{
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, retval, errmsg);
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);
return TRUE; /* XXX: is this correct? */
@ -698,7 +696,7 @@ sqlite_db_STORE_attrib (SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv)
return TRUE;
}
if (strEQ(key, "unicode")) {
#if (PERL_REVISION <= 5) && ((PERL_VERSION < 8) || (PERL_VERSION == 8 && PERL_SUBVERSION < 5))
#if PERL_UNICODE_DOES_NOT_WORK_WELL
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "Unicode support is disabled for this version of perl.");
imp_dbh->unicode = 0;
#else
@ -719,7 +717,7 @@ sqlite_db_FETCH_attrib (SV *dbh, imp_dbh_t *imp_dbh, SV *keysv)
return newSVpv(sqlite3_version, 0);
}
if (strEQ(key, "unicode")) {
#if (PERL_REVISION <= 5) && ((PERL_VERSION < 8) || (PERL_VERSION == 8 && PERL_SUBVERSION < 5))
#if PERL_UNICODE_DOES_NOT_WORK_WELL
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "Unicode support is disabled for this version of perl.");
return newSViv(0);
#else

View file

@ -5,6 +5,10 @@
#include "SQLiteXS.h"
#include "sqlite3.h"
#define PERL_UNICODE_DOES_NOT_WORK_WELL \
(PERL_REVISION <= 5) && ((PERL_VERSION < 8) \
|| (PERL_VERSION == 8 && PERL_SUBVERSION < 5))
/* 30 second timeout by default */
#define SQL_TIMEOUT 30000