mirror of
https://github.com/SOCI/soci.git
synced 2026-05-12 14:49:13 -05:00
Fix behaviour of fetch() without any data for MySQL too
Same fix is required for MySQL as for PostgreSQL, see the previous commit message for explanation.
This commit is contained in:
@@ -314,6 +314,7 @@ mysql_statement_backend::execute(int number)
|
||||
else
|
||||
{
|
||||
// it was not a SELECT
|
||||
numberOfRows_ = 0;
|
||||
return ef_no_data;
|
||||
}
|
||||
}
|
||||
@@ -321,6 +322,13 @@ mysql_statement_backend::execute(int number)
|
||||
statement_backend::exec_fetch_result
|
||||
mysql_statement_backend::fetch(int number)
|
||||
{
|
||||
if (numberOfRows_ == 0)
|
||||
{
|
||||
// There is nothing to fetch and normally we shouldn't be even called
|
||||
// in this case, but don't do anything stupid if we are.
|
||||
return ef_no_data;
|
||||
}
|
||||
|
||||
// Note: This function does not actually fetch anything from anywhere
|
||||
// - the data was already retrieved from the server in the execute()
|
||||
// function, and the actual consumption of this data will take place
|
||||
|
||||
Reference in New Issue
Block a user