本文整理汇总了C++中db::Result::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Result::end方法的具体用法?C++ Result::end怎么用?C++ Result::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db::Result
的用法示例。
在下文中一共展示了Result::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: track
void Pages::track(Document *doc){
std::string sub;
int tid = route("track", path, sub);
bool post = cgi.getEnvironment().getRequestMethod() == "POST";
if(!tid) return;
if(sub == ""){
ExtendedTrack t(tid);
if(!t) return;
doc->setHtml("html/track.tpl", t.title);
doc->rootDict()->SetValueAndShowSection("TID", number(t.id), "HAS_OEMBED");
t.fill(doc->dict());
t.player(doc->dict(), true);
Audio(&t).fill(doc->dict());
doc->dict()->ShowSection(Youtube(t.artist.id) ? "HAS_YOUTUBE" : "NO_YOUTUBE");
Dict *embed = doc->dict()->AddIncludeDictionary("EMBED_CODE");
embed->SetFilename("html/embed-code.tpl");
embed->SetIntValue("WIDTH", 150);
t.Track::fill(embed);
Dict *uploader = doc->dict()->AddIncludeDictionary("UPLOADER");
uploader->SetFilename("html/uploader.tpl");
uploader->SetValue("ACTION", t.url() + "/upload");
int hits = Stat::push("trackView", t.artist.id, tid);
doc->dict()->SetValue("HIT_COUNT", number(hits));
int unique_hits = Stat::get("trackView", 0, tid, true);
doc->dict()->SetValue("UNIQUE_HIT_COUNT", number(unique_hits));
doc->rootDict()->ShowSection("REQUIRES_STATS_JS");
Session::fill(doc->dict());
EventList::track(t).fill(doc->dict(), "EVENTS", false);
doc->dict()->ShowSection(Follower(Session::user().id).favorited(tid) ? "IS_FAVORITE" : "NOT_FAVORITE");
if(Session::user()){
DB::Result playlists = DB::query(
"SELECT id, name FROM playlists WHERE user_id = " + number(Session::user().id) + " ORDER BY name ASC");
if(!playlists.empty()){
doc->dict()->ShowSection("HAS_PLAYLISTS");
for(DB::Result::const_iterator i=playlists.begin(); i!=playlists.end(); i++){
Dict *playlist = doc->dict()->AddSectionDictionary("PLAYLIST");
playlist->SetValue("PLAYLIST_ID", i->at(0));
playlist->SetValue("PLAYLIST_NAME", i->at(1));
}
}
}
}
else if(sub == "delete"){
Track t(tid);
if(!t) return;
if(!t.artist.self())
doc->redirect(t.url());
else if(!post || cgi("confirm") != "Delete" || Session::nonce() != cgi("nonce")){
Session::newNonce();
doc->setHtml("html/delete.tpl", "Track deletion");
doc->dict()->SetValue("WHAT", t.title);
doc->dict()->SetValue("CANCEL_URL", t.url());
}
else{
log("Deleting track: " + t.title + " (" + number(t.id) + ")");
Art art(t.id);
if(art) art.remove();
Audio(&t).unlink();
Playlist::removeTrack(t.id);
DB::query("DELETE FROM events WHERE track_id = " + number(t.id));
DB::query("DELETE FROM featured_tracks WHERE track_id = " + number(t.id));
DB::query("DELETE FROM favorites WHERE type = 'track' AND ref = " + number(t.id));
DB::query("DELETE FROM user_features WHERE type = 'track' AND ref = " + number(t.id));
DB::query("DELETE FROM tracks WHERE id = " + number(t.id));
doc->redirect(Session::user().url());
}
}
else if(sub == "publish"){
Track t(tid);
if(!t) return;
if(tid != number(cgi("tid")))
return doc->redirect(t.url());
if(t.artist.self() && !t.visible && post){
DB::query("UPDATE tracks SET visible = 't', date = 'now' WHERE id = " + number(t.id));
Event e;
e.type = Event::Publish;
e.source = t.artist;
//.........这里部分代码省略.........