mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
B #5400,- : Bug fixes backport
* Fix PoolSQL::exist for PostgreSQL * Sort hooks by execution id
This commit is contained in:
parent
7b9243f73a
commit
b387ef06ae
@ -66,11 +66,7 @@ int HookLog::_dump_log(int hkid, int exec_id, std::string &xml_log)
|
||||
|
||||
cmd << "SELECT body FROM "<< table;
|
||||
|
||||
if ( hkid == -1 )
|
||||
{
|
||||
cmd << " ORDER BY hkid DESC";
|
||||
}
|
||||
else
|
||||
if ( hkid != -1 )
|
||||
{
|
||||
cmd << " WHERE hkid = " << hkid;
|
||||
}
|
||||
@ -80,6 +76,8 @@ int HookLog::_dump_log(int hkid, int exec_id, std::string &xml_log)
|
||||
cmd << " AND exeid = " << exec_id;
|
||||
}
|
||||
|
||||
cmd << " ORDER BY hkid DESC, exeid";
|
||||
|
||||
xml_log.append("<HOOKLOG>");
|
||||
|
||||
cb.set_callback(&xml_log);
|
||||
|
@ -228,20 +228,31 @@ PoolObjectSQL * PoolSQL::get_ro(int oid)
|
||||
void PoolSQL::exist(const string& id_str, std::set<int>& id_list)
|
||||
{
|
||||
std::vector<int> existing_items;
|
||||
std::set<int>::iterator iterator;
|
||||
|
||||
one_util::split_unique(id_str, ',', id_list);
|
||||
search(existing_items, table.c_str(), "1 order by 1 ASC");
|
||||
if (Nebula::instance().get_db_backend() == "postgresql")
|
||||
{
|
||||
search(existing_items, table.c_str(), "true order by 1 ASC");
|
||||
}
|
||||
else
|
||||
{
|
||||
search(existing_items, table.c_str(), "1 order by 1 ASC");
|
||||
}
|
||||
|
||||
for (iterator = id_list.begin(); iterator != id_list.end(); ++iterator)
|
||||
for (auto iterator = id_list.begin(); iterator != id_list.end();)
|
||||
{
|
||||
if (!std::binary_search(existing_items.begin(), existing_items.end(), *iterator))
|
||||
{
|
||||
id_list.erase(iterator);
|
||||
iterator = id_list.erase(iterator);
|
||||
}
|
||||
else
|
||||
{
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user