Many, many thanks for the extremely helpful and fast reply.
On Thu, Apr 4, 2013 at 1:00 PM, Mateusz Loskot <[email protected]> wrote:
> On 4 April 2013 14:44, Deane Yang <[email protected]> wrote:
> > I was able to get this to work with sqlite, but am having difficulty
> doing
> > this with postgresql. I've confirmed that SOCI is successfully
> connecting to
> > the database. When I ask for the number of rows in the table "trades", it
> > returns the correct number.
> >
> > The code that isn't working looks like this:
> >
> > statement get_trades =
> > (sql.prepare <<
> > "select * from trades where trade_date=20090111",
>
> This query is missing quotes around the date, so it causes
> statement preparation failure. Try this:
>
> "select * from trades where trade_date=\'20090111\'"
>
> > An exception is thrown when executing "get_grades.fetch()" and return the
> > following message:
> >
> > ERROR: prepared statement "st_1" does not exist
>
> This error is misleading, indeed and you should see error like this:
>
> ERROR: operator does not exist: date = integer
> LINE 1: select * from trades where trade_date=20090111
>
> The misleading error is due to a slight bug in PostgreSQL backend:
> - PQprepare is fails due to invalid query
> --- clean_up() is called and statement object deallocated
> ---- deallocation does not check if there is statement exists
> ------ DEALLOCATE command fails with exception
>
> Finally, the exception is reported for DEALLOCATE failure instead of
> for the original cause of error, statement preparation failure.
>
> A tentative fix is to take these two lines from
> postgresql_statement_backend dtor:
>
>
> https://github.com/SOCI/soci/blob/684be04/src/backends/postgresql/statement.cpp#L42-L43
>
> and move into postgresql_statement_backend::clean_up:
>
>
> https://github.com/SOCI/soci/blob/684be04/src/backends/postgresql/statement.cpp#L55
>
> This may not work, as result_ is related to statement
> execution, not statement preparation.
> I'll work on proper fix.
>
> Deane, thanks for reporting this!
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
>
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users