mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-14 16:53:12 +09:00
Add a system.sqlquery API call to execute SELECT queries on the DB. It
returns the row results
This commit is contained in:
1 parent
d923ef3603
commit
ae853eaebc
4 files changed
+148
-1
No files matched your search
@@ -97,6 +97,47 @@ public:
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class SystemSqlQuery: public RequestManagerSystem
|
||||
{
|
||||
public:
|
||||
SystemSqlQuery():RequestManagerSystem("one.system.sqlquery",
|
||||
"Executes SQL queries on the DB backend","A:ss")
|
||||
{
|
||||
auth_op = AuthRequest::ADMIN;
|
||||
};
|
||||
|
||||
~SystemSqlQuery(){};
|
||||
|
||||
void request_execute(xmlrpc_c::paramList const& _paramList,
|
||||
RequestAttributes& att);
|
||||
private:
|
||||
|
||||
class select_cb : public Callbackable
|
||||
{
|
||||
public:
|
||||
void set_callback()
|
||||
{
|
||||
oss.str("");
|
||||
|
||||
Callbackable::set_callback(
|
||||
static_cast<Callbackable::Callback>(&select_cb::callback));
|
||||
}
|
||||
|
||||
std::string get_result()
|
||||
{
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
virtual int callback(void *nil, int num, char **values, char **names);
|
||||
|
||||
private:
|
||||
std::ostringstream oss;
|
||||
};
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class UserQuotaInfo : public RequestManagerSystem
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in new issue
Block a user