The problem was due to an older version of the sqlite library. I had
already updated sqlite to the latest revision but an older copy with a
different extension was getting picked up.

There was an error in the way the numbers were decoded by
sqlite_column_text.

In order to work around the sqlite bug, I tried changing soci code to use
sqlite_column_int but it made tests fail with vector<long long>

Right now, fetching from sqlite requires a conversion from int to char *
done inside sqlite and then a conversion from the char* to an int. When
fetching into an array, this gets worse, we also require a temporary
std::string for every row out of which we do .c_str and then convert the
result to int

Having said that, the current behaviour is correct and the test cases did
their job spectacularly well, so hats off to all those that worked on them,
you guys rock! :)

C.

On Mon, May 21, 2012 at 10:18 PM, Claudio Bantaloukas <[email protected]
> wrote:

> Here's some more info.
> I checked that the output of the "shell" sqlite is correct:
> -bash-3.2$ ./mysqlite ../soci-build/temp.db
> SQLite version 3.7.12 2012-05-14 01:41:23
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> select id from soci_test;
> -12345678
>
> Stepping through the test in the debugger,I reach this point,
> Thread:5689479 - main (Runnable)
> soci::sqlite3_standard_into_type_backend::post_fetch(bool,bool,soci::indicator*)
> : standard-into-type.o
>  soci::details::standard_into_type::post_fetch(bool,bool) : into-type.o
> soci::details::statement_impl::post_fetch(bool,bool) : statement.o
>  soci::details::statement_impl::execute(bool) : statement.o
> soci::statement::execute(bool) : ref-counted-statement.o
>  soci::details::ref_counted_statement::final_action() :
> ref-counted-statement.o
> soci::details::ref_counted_statement_base::dec_ref() : once-temp-type.o
>  soci::details::once_temp_type::~once_temp_type() : once-temp-type.o
> soci::tests::common_tests::test6() : test-sqlite3.o
>  soci::tests::common_tests::run(bool) : test-sqlite3.o
> main : test-sqlite3.o
>  __start : crt0main.o
>
> Here,
> buf=="4282621618"
> and this gets converted to val=2147483647
> through this part (Line 100 of standard-into-type.cpp):
>  case x_integer:
>                {
>                    int *dest = static_cast<int*>(data_);
>                    long val = std::strtol(buf, NULL, 10);
>                    *dest = static_cast<int>(val);
>                }
>
> I'll just leave a memo on this and see where this goes:
>  changing this part to
>         case x_integer:
>             {
>                 int *dest = static_cast<int*>(data_);
>                 *dest = sqlite3_column_int(statement_.stmt_,pos);
>             }
>
> makes tests go forward but unit tests fail again when we deal with vectors
> of int's...
>
> we'll see...
> On Mon, May 21, 2012 at 6:45 PM, Claudio Bantaloukas <
> [email protected]> wrote:
>
>> Hi *,
>> I'm getting a test failure on IBM XL C/C++ compiler on AIX PowerPC.
>> I have managed to compile successfully using xlC (i tried before using
>> gcc but it's pretty broken on aix) with the Oracle and SQLite backends.
>>
>> All oracle tests pass.
>> I'm getting a failure on sqlite test 6
>>
>> I tried running the test under the debugger with
>> irmtdbgc -qhost=xx.xx.xx.xx ./bin/soci_sqlite3_test temp.db
>>
>> <snip/>
>>
>> SOCI Common Tests:
>>
>> test 1 passed
>> test 2 passed
>> test 3 passed
>> test 4 passed
>> test 5 passed
>> Assertion failed: i2 == -12345678, file
>>  /compilazioni/soci/src/core/test/common-tests.h, line 1144
>>
>> Going through the debugger shows that i2 == 2147483647
>>
>> I opened the generated table in sqlite and the stored value is -12345678
>>
>> Any suggestions on how to diagnose this?
>> --
>> Claudio Bantaloukas http://www.rdfm.org/ammuzzu/
>>
>
>
>
> --
> Claudio Bantaloukas http://www.rdfm.org/ammuzzu/
>



-- 
Claudio Bantaloukas http://www.rdfm.org/ammuzzu/
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to