本文整理汇总了C++中DB_APP::enumerate方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_APP::enumerate方法的具体用法?C++ DB_APP::enumerate怎么用?C++ DB_APP::enumerate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_APP
的用法示例。
在下文中一共展示了DB_APP::enumerate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scan_tables
int SCHED_SHMEM::scan_tables() {
DB_PLATFORM platform;
DB_APP app;
DB_APP_VERSION app_version;
DB_ASSIGNMENT assignment;
int i, j, n;
n = 0;
while (!platform.enumerate("where deprecated=0")) {
platforms[n++] = platform;
if (n == MAX_PLATFORMS) {
overflow("platforms", "MAX_PLATFORMS");
}
}
nplatforms = n;
n = 0;
app_weight_sum = 0;
while (!app.enumerate("where deprecated=0")) {
if (n == MAX_APPS) {
overflow("apps", "MAX_APPS");
}
app_weight_sum += app.weight;
if (app.locality_scheduling == LOCALITY_SCHED_LITE) {
locality_sched_lite = true;
}
if (app.non_cpu_intensive) {
have_nci_app = true;
}
if (config.non_cpu_intensive) {
have_nci_app = true;
app.non_cpu_intensive = true;
}
if (app.n_size_classes > 1) {
char path[MAXPATHLEN];
sprintf(path, "../size_census_%s", app.name);
#ifndef _USING_FCGI_
FILE* f = fopen(path, "r");
#else
FCGI_FILE* f = FCGI::fopen(path, "r");
#endif
if (!f) {
log_messages.printf(MSG_CRITICAL,
"Missing size census file for app %s\n", app.name
);
return ERR_FOPEN;
}
for (int i=0; i<app.n_size_classes-1; i++) {
char buf[256];
char* p = fgets(buf, 256, f);
if (!p) {
log_messages.printf(MSG_CRITICAL,
"Size census file for app %s is too short\n", app.name
);
return ERR_XML_PARSE; // whatever
}
app.size_class_quantiles[i] = atof(buf);
}
fclose(f);
}
apps[n++] = app;
}
napps = n;
n = 0;
// for each (app, platform) pair,
// get all versions with numbers maximal in their plan class.
//
for (i=0; i<nplatforms; i++) {
PLATFORM& splatform = platforms[i];
for (j=0; j<napps; j++) {
APP& sapp = apps[j];
vector<APP_VERSION> avs;
char query[1024];
sprintf(query,
"where appid=%d and platformid=%d and deprecated=0",
sapp.id, splatform.id
);
while (!app_version.enumerate(query)) {
avs.push_back(app_version);
}
for (unsigned int k=0; k<avs.size(); k++) {
APP_VERSION& av1 = avs[k];
for (unsigned int kk=0; kk<avs.size(); kk++) {
if (k == kk) continue;
APP_VERSION& av2 = avs[kk];
if (!strcmp(av1.plan_class, av2.plan_class) && av1.version_num > av2.version_num) {
av2.deprecated = 1;
}
}
}
for (unsigned int k=0; k<avs.size(); k++) {
APP_VERSION& av1 = avs[k];
if (av1.deprecated) continue;
if (av1.min_core_version && av1.min_core_version < 10000) {
fprintf(stderr, "min core version too small - multiplying by 100\n");
av1.min_core_version *= 100;
}
if (av1.max_core_version && av1.max_core_version < 10000) {
//.........这里部分代码省略.........