mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-12 08:58:17 +03:00
B #2144: Fix affected rows for Sqlite
This commit is contained in:
parent
27403b3c97
commit
3961b401a9
@ -76,6 +76,8 @@ public:
|
||||
*/
|
||||
int do_callback(int num, char **values, char **names)
|
||||
{
|
||||
++affected_rows;
|
||||
|
||||
return (this->*cb)(arg, num, values, names);
|
||||
};
|
||||
|
||||
|
@ -215,11 +215,6 @@ int MySqlDB::exec(ostringstream& cmd, Callbackable* obj, bool quiet)
|
||||
|
||||
int num_rows = mysql_affected_rows(db);
|
||||
|
||||
if ( num_rows > 0)
|
||||
{
|
||||
obj->set_affected_rows(num_rows);
|
||||
}
|
||||
|
||||
if ( obj->isCallBackSet() )
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
@ -266,6 +261,11 @@ int MySqlDB::exec(ostringstream& cmd, Callbackable* obj, bool quiet)
|
||||
delete[] names;
|
||||
}
|
||||
|
||||
if ( obj->get_affected_rows() == 0 && num_rows > 0)
|
||||
{
|
||||
obj->set_affected_rows(num_rows);
|
||||
}
|
||||
|
||||
// Free the result object
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
@ -136,11 +136,11 @@ int SqliteDB::exec(ostringstream& cmd, Callbackable* obj, bool quiet)
|
||||
}while( (rc == SQLITE_BUSY || rc == SQLITE_IOERR) &&
|
||||
(counter < 10));
|
||||
|
||||
if (obj != 0)
|
||||
if (obj != 0 && obj->get_affected_rows() == 0)
|
||||
{
|
||||
int num_rows = sqlite3_changes(db);
|
||||
|
||||
if ( num_rows > 0)
|
||||
if (num_rows > 0)
|
||||
{
|
||||
obj->set_affected_rows(num_rows);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user