Hi,
I need to compare two resultsets and they are having different rows. So I wanted to know what happens if I call NextRow() after last row? Does it crash or do something?
Thanks
is wxSQLite3 Resultsetquestion Topic is solved
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
is wxSQLite3 Resultsetquestion
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: is wxSQLite3 Resultsetquestion
Currently this should not be done according to the SQLite documentation. But it would need only a minor modification to the NextRow method to make it safe: After reaching the last row of a result set the internal member variable m_eof is set. On further calls this variable could be checked and NextRow could return false immediately without calling any SQLite functions.evstevemd wrote:I need to compare two resultsets and they are having different rows. So I wanted to know what happens if I call NextRow() after last row? Does it crash or do something?
Regards,
Ulrich
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: is wxSQLite3 Resultsetquestion
So you mean that once eof is reached calling nextrow without doing anything else to resultset is safe and just returns false?utelle wrote:Currently this should not be done according to the SQLite documentation. But it would need only a minor modification to the NextRow method to make it safe: After reaching the last row of a result set the internal member variable m_eof is set. On further calls this variable could be checked and NextRow could return false immediately without calling any SQLite functions.evstevemd wrote:I need to compare two resultsets and they are having different rows. So I wanted to know what happens if I call NextRow() after last row? Does it crash or do something?
Regards,
Ulrich
I want to be able to test if eof is reached in one rs so that I will not touch it and deal with the other one!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: is wxSQLite3 Resultsetquestion
The class wxSQLite3ResultSet has method Eof() to check whether all rows of the result set had been processed or not.evstevemd wrote:So you mean that once eof is reached calling nextrow without doing anything else to resultset is safe and just returns false?utelle wrote:Currently this should not be done according to the SQLite documentation. But it would need only a minor modification to the NextRow method to make it safe: After reaching the last row of a result set the internal member variable m_eof is set. On further calls this variable could be checked and NextRow could return false immediately without calling any SQLite functions.evstevemd wrote:I need to compare two resultsets and they are having different rows. So I wanted to know what happens if I call NextRow() after last row? Does it crash or do something?
I want to be able to test if eof is reached in one rs so that I will not touch it and deal with the other one!
If Eof() returns true then don't call NextRow() anymore.
BTW NextRow() also tells you when you have reached the end of the result set. As long as NextRow() returns true there are still rows to process. Don't call NextRow() again after it has returned false once.
Regards,
Ulrich
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
thanks a lot!
Just curious question. If I call nextrow after eof is reached what happens? Throws exception? Crash or what?
Thanks again for your usual support!
Just curious question. If I call nextrow after eof is reached what happens? Throws exception? Crash or what?
Thanks again for your usual support!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
No idea, I never tested. NextRow calls internally sqlite3_step and the SQLite documentation states "SQLITE_DONE means that the statement has finished executing successfully. sqlite3_step() should not be called again ... without first calling sqlite3_reset() to reset the virtual machine back to its initial state ...". So anything might happen.evstevemd wrote:Just curious question. If I call nextrow after eof is reached what happens? Throws exception? Crash or what?
Maybe I should make NextRow throw an exception if it is called again after Eof is reached.
Regards,
Ulrich
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Thanks, I think adding exception is better than "anything can happen"utelle wrote:No idea, I never tested. NextRow calls internally sqlite3_step and the SQLite documentation states "SQLITE_DONE means that the statement has finished executing successfully. sqlite3_step() should not be called again ... without first calling sqlite3_reset() to reset the virtual machine back to its initial state ...". So anything might happen.evstevemd wrote:Just curious question. If I call nextrow after eof is reached what happens? Throws exception? Crash or what?
Maybe I should make NextRow throw an exception if it is called again after Eof is reached.
Regards,
Ulrich
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?