Overview
Features
Download
Documentation
Community
Add-Ons & Services

SQLite, cannot select

Please post support and help requests here.

SQLite, cannot select

Postby muellerto » 17 May 2009, 17:00

After a lot of experiments with POCO::SQLite I have a mysterious problem now: I cannot select data from a table.

My database has about 10 tables, all not very big but with already several hundred rows. Until now everything worked fine and I was surprised that only very few lines of code had always a great effect. I got a lot of functionality in a short time. But now I came to another part of my application where I use a code sequence like this:
Code: Select all
Statement select(*m_pSession);
select << "select * from TR;";
select.execute();

(I want to use a RecordSet later.) But I don't get this working because select.execute() always throws an exception of type Poco::NotFoundException. The message text of this exception is just "Not found". I have no idea about the reason of this exception or the location of the throw. The table exists. The table has at least one record. The table has a primary key. I can execute exactly the same select using sqlite3 and there it's successful. I can insert, update or delete in the table very well using my own application. Why can't I select?

I tried to select other tables here. I detected that one table works, all others do not. Why? This is very obscure.

Should I really install the sources to debug this?

My SQLite is 3.5.7. Do I need a newer one for POCO 1.3.5?
muellerto
 
Posts: 23
Joined: 13 May 2009, 18:06

Re: SQLite, cannot select

Postby muellerto » 17 May 2009, 17:32

Ah, it's interesting. It depends on the SQL datatype timestamp.

My table is defined as follows:
Code: Select all
create table TR (aa timestamp not null primary key, bb varchar(1024) not null);

This table will not work as I want it.

But if I don't use timestamp, if I change the datatype of aa from timestamp to char(19) the table gets selectable!
I guess POCO cannot bind a timestamp column to anything in C++.

I can indeed change my datatypes but I'm not sure about all consequences. SQLite timestamp comparison will still work, date and time functions do also work on a char(19) column. Do I lose something?
muellerto
 
Posts: 23
Joined: 13 May 2009, 18:06

Re: SQLite, cannot select

Postby alex » 17 May 2009, 19:05

muellerto wrote:I guess POCO cannot bind a timestamp column to anything in C++.

See Data/SQLite/src/Utility.cpp for supported column SQLite column types and Data/src/MetaColumn.h for Poco::Data bindings. Data code in the trunk supports DateTime binding. In 1.3.5 the only way is through string binding.
muellerto wrote:Do I lose something?

No.
SQLite3 wrote:Any column in a version 3 database, except an INTEGER PRIMARY KEY column, may be used to store any type of value.
alex
 
Posts: 1132
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron