mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-26 09:57:23 +03:00
parent
c185bebb57
commit
a664466ee9
@ -204,7 +204,7 @@ private:
|
||||
* @param db pointer to the db
|
||||
* @return 0 on success
|
||||
*/
|
||||
int update(SqlDB *db)
|
||||
int update(SqlDB *db) override
|
||||
{
|
||||
string error_str;
|
||||
return insert_replace(db, true, error_str);
|
||||
@ -215,7 +215,7 @@ private:
|
||||
* @param db pointer to the db
|
||||
* @return 0 on success
|
||||
*/
|
||||
int insert(SqlDB *db, string& error_str);
|
||||
int insert(SqlDB *db, string& error_str) override;
|
||||
|
||||
/**
|
||||
* Execute an INSERT or REPLACE Sql query.
|
||||
@ -225,6 +225,13 @@ private:
|
||||
* @return 0 one success
|
||||
*/
|
||||
int insert_replace(SqlDB *db, bool replace, string& error_str);
|
||||
|
||||
/**
|
||||
* Drops object from the database
|
||||
* @param db pointer to the db
|
||||
* @return 0 on success
|
||||
*/
|
||||
int drop(SqlDB *db) override;
|
||||
};
|
||||
|
||||
#endif /*HOOK_H_*/
|
||||
|
@ -93,6 +93,14 @@ public:
|
||||
*/
|
||||
static int bootstrap(SqlDB *_db);
|
||||
|
||||
/**
|
||||
* Drops object from the database
|
||||
* @param db pointer to the db
|
||||
* @return 0 on success
|
||||
*/
|
||||
|
||||
int drop(SqlDB *db, const int hook_id);
|
||||
|
||||
private:
|
||||
|
||||
// ----------------------------------------
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "HookImplementation.h"
|
||||
#include "HookStateHost.h"
|
||||
#include "HookStateVM.h"
|
||||
#include "HookLog.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -405,3 +406,25 @@ int Hook::set_hook(HookType hook_type, string& error)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int Hook::drop(SqlDB *db)
|
||||
{
|
||||
ostringstream oss;
|
||||
int rc;
|
||||
|
||||
oss << "DELETE FROM " << table << " WHERE oid=" << oid;
|
||||
|
||||
rc = db->exec_wr(oss);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
HookLog* hl = nd.get_hl();
|
||||
|
||||
return hl->drop(db, oid);
|
||||
}
|
||||
|
@ -138,6 +138,18 @@ int HookLog::dump_log(std::string &xml_log)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int HookLog::drop(SqlDB *db, const int hook_id)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "DELETE FROM " << table << " WHERE hkid =" << hook_id;
|
||||
|
||||
return db->exec_wr(oss);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int HookLog::add(int hkid, int hkrc, std::string &xml_result)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
Loading…
x
Reference in New Issue
Block a user