Bugs item #1724782, was opened at 2007-05-24 08:06
Message generated for change (Comment added) made by aleksf
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=725709&aid=1724782&group_id=132964
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Data
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Guenter Obiltschnig (obiltschnig)
Assigned to: Nobody/Anonymous (nobody)
Summary: SQLite connector error reporting
Initial Comment:
The SQLite connector fails to report certain errors. This causes e.g. constraints not to work properly.
The error is in SQLiteStatementImpl::hasNext().
Following is a patch that fixes this bug:
==== //poco/Main/Data/SQLite/src/SQLiteStatementImpl.cpp#7 - p:\poco\Data\SQLite\src\SQLiteStatementImpl.cpp ====
@@ -1,7 +1,7 @@
//
// SQLiteStatementImpl.cpp
//
-// $Id: //poco/Main/Data/SQLite/src/SQLiteStatementImpl.cpp#7 $
+// $Id: //poco/Main/Data/SQLite/src/SQLiteStatementImpl.cpp#6 $
//
// Library: SQLite
// Package: SQLite
@@ -177,17 +177,13 @@
// _pStmt is allowed to be null for conditional SQL statements
if (_pStmt == 0)
{
- _stepCalled = true;
+ _stepCalled = true;
_nextResponse = SQLITE_DONE;
return false;
}
- _stepCalled = true;
+ _stepCalled = true;
_nextResponse = sqlite3_step(_pStmt);
- if (_nextResponse != SQLITE_ROW && _nextResponse != SQLITE_OK && _nextResponse != SQLITE_DONE)
- {
- Utility::throwException(_nextResponse);
- }
return (_nextResponse == SQLITE_ROW);
}
----------------------------------------------------------------------
>Comment By: Alex Fabijanic (aleksf)
Date: 2007-09-28 16:44
Message:
Logged In: YES
user_id=1001095
Originator: NO
This looks like the diff was run in reverse (showing added code as
removed).
Anyway, just to clarify, this is the added code to patch 1.3.1:
if (_nextResponse != SQLITE_ROW && _nextResponse != SQLITE_OK &&
_nextResponse != SQLITE_DONE)
{
Utility::throwException(_nextResponse);
}
----------------------------------------------------------------------
Comment By: Peter Schojer (pschojer)
Date: 2007-09-20 09:57
Message:
Logged In: YES
user_id=643330
Originator: NO
fix is in subversion, will be part of 1.3.2
----------------------------------------------------------------------
Comment By: BjCarlsson (bcn)
Date: 2007-09-20 07:56
Message:
Logged In: YES
user_id=687086
Originator: NO
Still doesn't throw any exceptions if you insert a new record with the
same id that already exits:
Poco::Data::SQLite::Connector::registerConnector();
Poco::Data::Session ses
(SessionFactory::instance().create(Connector::KEY, m_FileNameHistorical));
ses << "CREATE TABLE Duplcated (Id INTEGER PRIMARY KEY UNIQUE)", now;
//UNIQUE not neccesary
int id = 1;
Poco::Data::Statement insert = (ses << "INSERT INTO Duplcated (Id)
VALUES (@id)", use(id));
insert.execute();
CPPUNIT_ASSERT_THROW(insert.execute(),
Poco::Data::DataException);//Fails - doesn't throw exception
----------------------------------------------------------------------
Comment By: Guenter Obiltschnig (obiltschnig)
Date: 2007-05-24 08:15
Message:
Logged In: YES
user_id=1148207
Originator: YES
fixed in 1.3.1
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=725709&aid=1724782&group_id=132964
|