Re: [opendbx] Sqlite answering rows all the time?
Brought to you by:
nose
From: Guillermo P. <gui...@gm...> - 2011-09-22 01:17:29
|
Hi Norbert, could you see this? Thanks! On Tue, Aug 23, 2011 at 12:20 PM, Guillermo Polito < gui...@gm...> wrote: > BTW, I've ran the bunch of tests we have for SQLite (about 110) and they > are still working :). So I hope this change does not introduce any strange > behavior. > > > On Tue, Aug 23, 2011 at 12:07 PM, Guillermo Polito < > gui...@gm...> wrote: > >> I've managed to fix this adding these two lines :) >> >> static int sqlite3_odbx_row_fetch( odbx_result_t* result ) >> { >> DEBUGLOG( result->handle->log.write( &(result->handle->log), 1, >> "sqlite3_odbx_row_fetch() called" ); ) >> >> struct sconn* aux = (struct sconn*) result->handle->aux; >> >> if( aux == NULL ) { return -ODBX_ERR_PARAM; } >> >> int err = aux->err; >> >> if( err != -1 ) { aux->err = -1; } // use original error code the >> first time >> else { err = sqlite3_step( (sqlite3_stmt*) result->generic ); } >> >> switch( err ) >> { >> case SQLITE_ROW: >> return ODBX_ROW_NEXT; >> case SQLITE_DONE: >> case SQLITE_OK: >> case SQLITE_MISUSE: // Return DONE if function called more often >> afterwards >> >> sqlite3_finalize( (sqlite3_stmt*) result->generic ); >> >> result->generic = NULL; >> return ODBX_ROW_DONE; >> } >> >> return -ODBX_ERR_BACKEND; >> } >> >> But I don't know if they are correct. Maybe they are bit meant to be >> there and we should manage it on our side, hehe. >> >> Guille >> >> >> On Tue, Aug 23, 2011 at 7:37 AM, Guillermo Polito < >> gui...@gm...> wrote: >> >>> Actually, It answers the ODBX_ROW_DONE, but afterwards, if we continue >>> asking for more rows, we get ODBX_ROW_NEXT again. >>> >>> Thanks! >>> >>> >>> On Tue, Aug 23, 2011 at 7:25 AM, Mariano Martinez Peck < >>> mar...@gm...> wrote: >>> >>>> Hi Norbert. We found a problem with Sqlie and I wonder if it is our >>>> fault or not. >>>> Imagine we send a query and we iterate the resultset with odbx_row_fetch >>>> >>>> Now...imagine the query answered 3 rows. We invoke odbx_row_fetch times >>>> and we correctly get the rows. Now...the problem is that it does NOT answers >>>> ODBX_ROW_DONE ("0") but instead ODBX_ROW_NEXT ("1") . Hence, we assume we >>>> can continue asking rows. And in fact, if we continue invoking that function >>>> 3 more times, we get AGAIN those 3 rows... >>>> >>>> So...shouldn't this answer ODBX_ROW_DONE after the 3 times I invoked >>>> odbx_row_fetch ? >>>> >>>> Thanks a lot in advance >>>> >>>> -- >>>> Mariano >>>> http://marianopeck.wordpress.com >>>> >>>> >>> >> > |