本文整理汇总了C++中MySQL::active方法的典型用法代码示例。如果您正苦于以下问题:C++ MySQL::active方法的具体用法?C++ MySQL::active怎么用?C++ MySQL::active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::active方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ajaxIsEmailExist
void UserModule::ajaxIsEmailExist(WebPage *page, HttpRequest &request) {
MySQL *query = manager->newQuery();
String email = request.header.POST.getValue("email");
String sql = (String)"select id from users where (email='" + email + "')";
string sql8 = sql.to_string();
if (query->active(sql) > 0) {
page->tplIndex->out("out", "<note>\n<result>1</result></note>\n");
}
manager->deleteQuery(query);
}
示例2: paintPageWidgets
void WidgetManager::paintPageWidgets(WebPage *page) {
if (page == NULL) return;
MySQL *query = page->site->manager->newQuery();
String sql = "select widgetId, tag from widget_site where siteId='" + (String)page->site->siteId + "'";
if (query->active(sql)) {
int count = query->getRowCount();
for (int i = 0; i < count; i++) {
int widgetId = query->getFieldValue(i, "widgetId").toInt();
String tag = query->getFieldValue(i, "tag");
paintWidget(page, tag, widgetId);
}
}
}
示例3: paintNews
void NewsModule::paintNews(WebPage *page, HttpRequest &request) {
WebTemplate *tpl = new WebTemplate();
if (!tpl->open(manager->modulePath + "/" + url + "/index_tpl.html")) return;
WebTemplate *tplItem = new WebTemplate();
if (!tplItem->open(manager->modulePath + "/" + url + "/item_tpl.html")) return;
WebTemplate *tplLast = new WebTemplate();
if (!tplLast->open(manager->modulePath + "/" + url + "/itemLast_tpl.html")) return;
WebTemplate *tplTag = new WebTemplate();
if (!tplTag->open(manager->modulePath + "/" + url + "/tag_tpl.html")) return;
MySQL *query = manager->newQuery();
String sql = "select count(*) cnt from dataNews n, data d where not isnull(num) and d.dataId=n.id and d.pageId='" + (String)page->pageId + "' and d.moduleId='" + (String)moduleId + "' order by dt desc";
int newsCount = 0;
if (query->active(sql) > 0) {
newsCount = query->getFieldValue(0, "cnt").toInt();
}
int p = request.header.GET.getValue("p").toInt();
sql = "select * from dataNews n, data d where not isnull(num) and d.dataId=n.id and d.pageId='" + (String)page->pageId + "' and d.moduleId='" + (String)moduleId +
"' order by dt desc limit " + (String)(p * 10) + ", 10";
if (query->exec(sql)) {
if (query->storeResult()) {
int count = query->getRowCount();
for (int i = 0; i < count; i++) {
String id = query->getFieldValue(i, "id");
String dt = query->getFieldValue(i, "dt");
dt = dtRus(dt, 0);
String name = query->getFieldValue(i, "name");
String about = query->getFieldValue(i, "about");
String text = query->getFieldValue(i, "text");
int num = query->getFieldValue(i, "num").toInt();
String tag1 = query->getFieldValue(i, "tag1");
String tag2 = query->getFieldValue(i, "tag2");
String tag3 = query->getFieldValue(i, "tag3");
String tag4 = query->getFieldValue(i, "tag4");
String tag5 = query->getFieldValue(i, "tag5");
WebTemplate *tpli = tplItem;
if (i + 1 == count) tpli = tplLast;
tpli->clearAllTags();
tpli->out("page", page->page);
tpli->out("num", num);
tpli->out("itemId", id);
tpli->out("dt", dt);
tpli->out("name", name);
tpli->out("about", about);
tpli->out("text", text);
tpli->out("host", page->site->host);
tplTag->clearAllTags();
tplTag->out("tag1", tag1);
tplTag->out("tag2", tag2);
tplTag->out("tag3", tag3);
tplTag->out("tag4", tag4);
tplTag->out("tag5", tag5);
tplTag->exec();
tpli->out("tags", tplTag->html);
tpli->exec();
tpl->out("out", tpli->html);
}
}
}
if (newsCount != 0) {
WebTemplate *tplPag = new WebTemplate();
if (!tplPag->open(manager->modulePath + "/" + url + "/pagination_tpl.html")) return;
int pageCount = newsCount / 10;
if (newsCount % 10 != 0) pageCount++;
for (int i = 0; i < pageCount; i++) {
if (i == 0) tplPag->out("out", "<li><a href=\"/\">" + (String)(i + 1) + "</a></li>");
else tplPag->out("out", "<li><a href=\"/post?p=" + (String)i + "\">" + (String)(i + 1) + "</a></li>");
if (i + 1 == pageCount) tplPag->out("next", "/post?p=" + (String)i);
}
tplPag->exec();
tpl->out("out", tplPag->html);
}
String uuid = request.header.COOKIE.getValue("uuid");
int userId = manager->getUserId(uuid);
WebTemplate *tplWrite = new WebTemplate();
if (userId != 0) {
if (!tplWrite->open(manager->modulePath + "/" + url + "/addPostButton_tpl.html")) return;
}
else {
if (!tplWrite->open(manager->modulePath + "/" + url + "/addPostButtonNotEnter_tpl.html")) return;
}
tplWrite->exec();
tpl->out("out", tplWrite->html);
//.........这里部分代码省略.........