本文整理汇总了C++中DB_HOST::end_enumerate方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_HOST::end_enumerate方法的具体用法?C++ DB_HOST::end_enumerate怎么用?C++ DB_HOST::end_enumerate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_HOST
的用法示例。
在下文中一共展示了DB_HOST::end_enumerate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find_host_by_cpid
// find the user's most recently-created host with given host CPID
//
static bool find_host_by_cpid(DB_USER& user, char* host_cpid, DB_HOST& host) {
char buf[1024], buf2[256];
sprintf(buf, "%s%s", host_cpid, user.email_addr);
md5_block((const unsigned char*)buf, strlen(buf), buf2);
sprintf(buf,
"where userid=%d and host_cpid='%s' order by id desc", user.id, buf2
);
if (!host.enumerate(buf)) {
host.end_enumerate();
return true;
}
return false;
}
示例2: find_host_by_other
// find the user's most recently-created host with given various characteristics
//
static bool find_host_by_other(DB_USER& user, HOST req_host, DB_HOST& host) {
char buf[2048];
char dn[512], ip[512], os[512], pm[512];
// don't dig through hosts of these users
// prevents flooding the DB with slow queries from users with many hosts
//
for (unsigned int i=0; i < config.dont_search_host_for_userid.size(); i++) {
if (user.id == config.dont_search_host_for_userid[i]) {
return false;
}
}
// Only check if all the fields are populated
//
if (strlen(req_host.domain_name) && strlen(req_host.last_ip_addr) && strlen(req_host.os_name) && strlen(req_host.p_model)) {
safe_strcpy(dn, req_host.domain_name);
escape_string(dn, sizeof(dn));
safe_strcpy(ip, req_host.last_ip_addr);
escape_string(ip, sizeof(ip));
safe_strcpy(os, req_host.os_name);
escape_string(os, sizeof(os));
safe_strcpy(pm, req_host.p_model);
escape_string(pm, sizeof(pm));
sprintf(buf,
"where userid=%d and id>%d and domain_name='%s' and last_ip_addr = '%s' and os_name = '%s' and p_model = '%s'"
" and m_nbytes = %lf order by id desc", user.id, req_host.id, dn, ip, os, pm, req_host.m_nbytes
);
if (!host.enumerate(buf)) {
host.end_enumerate();
return true;
}
}
return false;
}