int result = 0,  res3 = SQLITE_OK;
                    for( ; ; )
                    {
                        res3 = sqlite3_step( stmt3 );
                        if( res3 == SQLITE_ROW )


As I said in previous post a successful sqlite3_step doesn’t return SQLITE_OK so

res3 == SQLITE_ROW is never true.





________________________________
From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of 
Igor Korot <ikoro...@gmail.com>
Sent: Monday, June 4, 2018 3:33:54 PM
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor

Hi, Igor,

On Mon, Jun 4, 2018 at 7:55 AM, Igor Tandetnik <i...@tandetnik.org> wrote:
> On 6/4/2018 12:31 AM, Igor Korot wrote:
>>
>> Now I'd like the cursor in the recordset of the "stmt" to go to the record
>> 1
>> so I can process those records again.
>>
>> I thought that this will be a job of sqlite_reset(), but when I called
>> it and started re-processing the recordset I got SQLITE_DONE on the
>> very first iteration.
>
>
> sqlite_reset definitely works. The problem must be somewhere in the code you
> haven't shown. Can you reproduce in a small complete example?

Following the exact code taken from y source.
Can you spot an error?

[code]
int result = 0,  res3 = SQLITE_OK;
                    for( ; ; )
                    {
                        res3 = sqlite3_step( stmt3 );
                        if( res3 == SQLITE_ROW )
                        {
// initial processing
                        }
                        else if( res3 == SQLITE_DONE )
                            break;
                        else
                        {
// error handling
                            result = 1;
                        }
                    }
                    if( !result )
                    {
                        res3 = sqlite3_reset( stmt3 );
                        for( ; ; )
                        {
                            res3 = sqlite3_step( stmt3 );
                            if( res3 == SQLITE_ROW )
                            {
// actual processing
                            }
                            else if( res3 == SQLITE_DONE )
                                break;
                            else
                            {
// error handling
                            }
                        }
                    }
                    if( res3 != SQLITE_DONE )
                        break;
}[/code]

Thank you.

> --
> Igor Tandetnik
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to