SQLite Extraction Error [SOLVED]

Please post support and help requests here.
hahaha
Posts: 16
Joined: 09 Nov 2010, 10:14

SQLite Extraction Error [SOLVED]

Postby hahaha » 03 Jul 2012, 09:26

code just like bellow:

Code: Select all

std::string aName;
std::string match("Peter");
ses << "SELECT NAME FROM FORENAME WHERE NAME=:name", into(aName), use(match), now;
poco_assert (aName == match);


will throw a Extraction Error exception.

but this

Code: Select all

Poco::Uint32 count;
std::string match("Peter");
ses << "SELECT count(*) FROM FORENAME WHERE NAME=:name", into(count), use(match), now;

will run successfully,why?

alex
Posts: 1250
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: SQLite Extraction Error!!!!!

Postby alex » 03 Jul 2012, 14:25

hahaha wrote:code just like bellow:

Code: Select all

std::string aName;
std::string match("Peter");
ses << "SELECT NAME FROM FORENAME WHERE NAME=:name", into(aName), use(match), now;
poco_assert (aName == match);


will throw a Extraction Error exception.

How many rows does the first query return? If it's more than one, there is no room for al the return values in the supplied storage, thus exception.
Try

Code: Select all

std::vector<std::string> aName
.

hahaha
Posts: 16
Joined: 09 Nov 2010, 10:14

Re: SQLite Extraction Error!!!!!

Postby hahaha » 04 Jul 2012, 03:02

It works,thank you!


Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests

cron