Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::Data Statement problem

Please post support and help requests here.

Poco::Data Statement problem

Postby quest » 23 Dec 2008, 19:42

Using the Statement class explicitly allows you to reuse the statement when you do inserts, which is great. However, this reuse pattern breaks if during the execution an exception is thrown. When that happens the state (in the "_state" member of the StatementImpl class) is not reset to anything good, so when you try to call execute on the statement again the statement will not execute and simply return.

I'm seeing this when I try to recover from the SQLite::DBLockedException exeption. The statement's state remains to be "bound", so the next time around when I call execute nothing happens. I would classify this as a bug, but I don't claim to have the grand vision of the design...

Just to make it more visual here's a code snippet (note that "record" is a structure with a TypeHandler defined for it):

string addCommand = "INSERT INTO MyTable VALUES(?, ?, ?, ?, ?, ?)";
Statement statement(mySession);
statement << addCommand, use(record);

bool retry = false;
do
{
try
{
statement.execute();
retry = false;
}
catch(SQLite::DBLockedException& unused)
{
retry = true;
Thread::sleep(500);
}
}while(retry);

Kyle
quest
 
Posts: 6
Joined: 23 Dec 2008, 19:30

Re: Poco::Data Statement problem

Postby alex » 23 Dec 2008, 22:52

I'll have to look into this, so I have opened a bug report as a reminder:

https://sourceforge.net/tracker2/?func= ... tid=725709
alex
 
Posts: 1156
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron