本文整理汇总了C++中DBManager::sql_execute方法的典型用法代码示例。如果您正苦于以下问题:C++ DBManager::sql_execute方法的具体用法?C++ DBManager::sql_execute怎么用?C++ DBManager::sql_execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::sql_execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: erase
bool PingFlow::erase(DBManager &dbm)
{
char sql[500];
sprintf(sql, "DELETE FROM %s WHERE `pingId`='%d';", this->get_table_name().c_str(), this->get_ping_id());
dbm.sql_execute(sql);
return true;
}
示例2: update
bool PingFlow::update(DBManager &dbm)
{
char sql[500];
sprintf(sql, "UPDATE %s SET `sendPackage`='%d', `receivePackage`='%d', `lostPackage`='%d', `minTime`='%d', `maxTime`='%d', `averageTime`='%d', `errorMessage`='%s', `pingTime`='FROM_UNIXTIME(%ld)'WHERE `pingId`='%d';",\
this->get_table_name().c_str(), this->send_package, this->receive_package, this->lost_package, this->min_time, this->max_time, this->average_time, this->error_message, this->ping_time, this->ping_id);
dbm.sql_execute(sql);
return true;
}
示例3: create
bool PingFlow::create(DBManager &dbm)
{
char sql[500];
sprintf(sql, "INSERT INTO %s (`sendPackage`, `receivePackage`, `lostPackage`, `minTime`, `maxTime`, `averageTime`, `errorMessage`, 'pingTime') VALUES \
('%d', '%d', '%d', '%d', '%d', '%d', '%s', 'FROM_UNIXTIME(%ld)')", \
this->get_table_name().c_str(), this->send_package, this->receive_package, this->lost_package, this->min_time, this->max_time, this->average_time, this->error_message, this->ping_time);
dbm.sql_execute(sql);
return true;
}
示例4: sprintf
std::vector<ObjectFoundation*> PingFlow::find_all(DBManager &dbm)
{
char sql[500];
sprintf(sql, "SELECT * FROM %s;", this->get_table_name().c_str());
std::cout << sql << std::endl;
dbm.sql_execute(sql);
m_sql_list sql_list = dbm.get_sql_res();
m_sql_object sql_object;
std::vector<ObjectFoundation*> pfl;
if (sql_list.size()==0) {
std::cout << "Object not found!" << std::endl;
} else {
m_sql_list::iterator iter = sql_list.begin();
for (; iter != sql_list.end(); iter++) {
pfl.push_back(this->to_object(*iter));
}
}
return pfl;
}