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

DBD-SQLite: Tweaked not to hide a real error by a "not an error" issued by another sqlite3 function between the failed sqlite3 function and the sqlite_error to report.

Note that this change makes some failures issue two relevant errors at a time.
This commit is contained in:
Kenichi Ishigaki 2009-10-06 04:29:05 +00:00
parent 923f031682
commit d6af16bea5
3 changed files with 26 additions and 12 deletions

16
Changes
View file

@ -1,6 +1,14 @@
Changes for Perl extension DBD-SQLite
1.26_04 to be released
*** CHANGES THAT MAY POSSIBLY BREAK YOUR OLD APPLICATIONS ***
- Resolved #49716: Fixed $dbh->column_info to work according to
the spec in DBI and added support for attached databases. (VLYON)
- Tweaked not to hide a real error by a "not an error" issued
by another sqlite3 function between the failed sqlite3 function
and the sqlite_error to report. Note that this change makes
some failures issue two relevant errors at a time. (ISHIGAKI)
- Updated to SQLite 3.6.18 (DUNCAND)
- Resolved #48393: previous effort was not enough; BegunWork
should also be handled properly (ISHIGAKI)
@ -9,8 +17,6 @@ Changes for Perl extension DBD-SQLite
under a very, very slow (virtual) machine. (ISHIGAKI)
- Added a code to look for a compiler from Module::Install::Can.
(ISHIGAKI)
- Resolved #49716: Fixed $dbh->column_info to work according to
the spec in DBI and added support for attached databases. (VLYON)
- Added documentation and an 'Escape' attribute for $sth->table_info.
(VLYON)
- Fixed $sth->primary_key_info to work according to the spec in DBI
@ -40,6 +46,10 @@ Changes for Perl extension DBD-SQLite
(incorrect) PREREQ_PM values by ExtUtils::MakeMaker (ADAMK)
1.26_02 Fri 19 Jun 2009
*** CHANGES THAT MAY POSSIBLY BREAK YOUR OLD APPLICATIONS ***
- Resolved #46831: table_info schema is incorrect and doesn't
work with attached databases (VLYON/ISHIGAKI)
- Updated to SQLite 3.6.15 (DUNCAND)
- Resolved #44882: Use of $h->func() should be deprecated and
replaced with calls to driver-private 'installed methods'
@ -49,8 +59,6 @@ Changes for Perl extension DBD-SQLite
- Now private methods/functions return true after successful
calls (#44871) (ISHIGAKI)
- Removed all of the "croak"s (#44871) (ISHIGAKI)
- Resolved #46831: table_info schema is incorrect and doesn't
work with attached databases (VLYON/ISHIGAKI)
1.26_01 Tue 5 May 2009
- Added ORDINAL_POSITION support for $dbh->column_info (ADAMK)

View file

@ -296,10 +296,12 @@ sqlite_st_prepare (SV *sth, imp_sth_t *imp_sth,
if ((retval = sqlite3_prepare_v2(imp_dbh->db, statement, -1, &(imp_sth->stmt), &extra))
!= SQLITE_OK)
{
if (imp_sth->stmt) {
sqlite3_finalize(imp_sth->stmt);
}
sqlite_error(sth, (imp_xxh_t*)imp_sth, retval, (char*)sqlite3_errmsg(imp_dbh->db));
if (imp_sth->stmt) {
if ((retval = sqlite3_finalize(imp_sth->stmt)) != SQLITE_OK) {
sqlite_error(sth, (imp_xxh_t*)imp_sth, retval, (char*)sqlite3_errmsg(imp_dbh->db));
}
}
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
}
@ -436,8 +438,10 @@ sqlite_st_execute (SV *sth, imp_sth_t *imp_sth)
if (imp_sth->retval == SQLITE_ROW) {
continue;
}
sqlite3_reset(imp_sth->stmt);
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
if (sqlite3_reset(imp_sth->stmt) != SQLITE_OK) {
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
}
return -5; /* -> undef in SQLite.xsi */
}
/* warn("Finalize\n"); */
@ -455,9 +459,11 @@ sqlite_st_execute (SV *sth, imp_sth_t *imp_sth)
case SQLITE_DONE: DBIc_ACTIVE_on(imp_sth);
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 5, "exec ok - %d rows, %d cols\n", imp_sth->nrow, DBIc_NUM_FIELDS(imp_sth));
return 0; /* -> '0E0' in SQLite.xsi */
default: sqlite3_reset(imp_sth->stmt);
default: sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
if (sqlite3_reset(imp_sth->stmt) != SQLITE_OK) {
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
}
imp_sth->stmt = NULL;
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
return -6; /* -> undef in SQLite.xsi */
}
}
@ -549,8 +555,8 @@ sqlite_st_fetch (SV *sth, imp_sth_t *imp_sth)
if (imp_sth->retval != SQLITE_ROW) {
/* error */
sqlite_st_finish(sth, imp_sth);
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
sqlite_st_finish(sth, imp_sth);
return Nullav; /* -> undef in SQLite.xsi */
}

View file

@ -28,4 +28,4 @@ eval {
};
ok($@, 'Statement 2 generated an error');
is( $DBI::err, 19, '$DBI::err ok' );
is( $DBI::errstr, 'column a is not unique', '$DBI::errstr ok' );
like( $DBI::errstr, qr/column a is not unique/, '$DBI::errstr ok' );