I'm trying to read from an sqlite db. The relevant code is (really think I did not omit anything):
- Code: Select all
SQLite::Connector::registerConnector();
Session session(SQLite::Connector::KEY, "db");
int id;
string password;
string username = "john";
try {
session << "SELECT id, password FROM skypeuser WHERE username=:name", into(id), into(password), use(username), now;
} catch (Poco::Exception& e) {
cout << "Exception " << e.displayText() << endl;
}
cout << password << endl;
When I run this by executing the produced executable it seems to work fine, I retrieve the correct password. When I run this from the debugger it actually throws an Poco::Data::SQLite::InvalidSQLStatementException - SQL Statement invalid or database missing and it enters the catch block. Weird.
Alternatively, when I specify a non-existent user (i.e., not "john"), then when I run it outside of the debugger *nothing* happens. It does not enter the catch block. In the debugger the same exception appears.
Two questions:
1. If a record is not found, what should be the expected behaviour? I can't find anything on that in the documentation.
2. Why isn't it entering catch blocks outside of the debugger? Did I compile the Poco libraries in a wrong way? I don't want to switch to release mode just for this.
Please help. Thanks.





