当前位置: 首页>>代码示例>>C++>>正文


C++ DB_HOST::end_enumerate方法代码示例

本文整理汇总了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;
}
开发者ID:hanxue,项目名称:Boinc,代码行数:16,代码来源:handle_request.cpp

示例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;
}
开发者ID:hanxue,项目名称:Boinc,代码行数:38,代码来源:handle_request.cpp


注:本文中的DB_HOST::end_enumerate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。