mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
feature #1613: Function to list the oids of a Pool.
This commit is contained in:
parent
00483802d9
commit
d32c736b5c
@ -179,6 +179,17 @@ public:
|
||||
return PoolSQL::dump(oss, "DATASTORE_POOL", Datastore::table, where);
|
||||
};
|
||||
|
||||
/**
|
||||
* Lists the Datastore ids
|
||||
* @param oids a vector with the oids of the objects.
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
int list(vector<int>& oids)
|
||||
{
|
||||
return PoolSQL::list(oids, Datastore::table);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -97,6 +97,20 @@ public:
|
||||
const char * table,
|
||||
const string& where);
|
||||
|
||||
/**
|
||||
* List the objects in the pool
|
||||
* @param oids a vector with the oids of the objects.
|
||||
* @param the name of the DB table.
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
int list(
|
||||
vector<int>& oids,
|
||||
const char * table)
|
||||
{
|
||||
return search(oids, table, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the object's data in the data base. The object mutex SHOULD be
|
||||
* locked.
|
||||
|
@ -561,7 +561,12 @@ int PoolSQL::search(
|
||||
set_callback(static_cast<Callbackable::Callback>(&PoolSQL::search_cb),
|
||||
static_cast<void *>(&oids));
|
||||
|
||||
sql << "SELECT oid FROM " << table << " WHERE " << where;
|
||||
sql << "SELECT oid FROM " << table;
|
||||
|
||||
if (!where.empty())
|
||||
{
|
||||
sql << " WHERE " << where;
|
||||
}
|
||||
|
||||
rc = db->exec(sql, this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user