设为首页 加入收藏

TOP

新款 c++ web framework 支持orm http/2(三)
2023-07-23 13:36:03 】 浏览:79
Tags:新款 web framework 支持 orm http/2
rticles.setTitle(title); // articles.setTitle("直接标题"); articles.setContent(content); int effectnum = 0; try { effectnum = articles.save(); aid = articles.getAid(); client << "<p>新(new)id " << aid << " 或 新(new)id " << effectnum << "</p>"; } catch (std::exception &e) { client << "<p>" << articles.sqlstring << "</p>"; client << "<p>" << e.what() << "</p>"; return ""; } if (effectnum > 0) { client.goto_url("/cms/list", 3, "内容已经添加"); return ""; } else { client.goto_url("/cms/list", 3, "添加出错(error)"); return ""; } return ""; } std::string articledelete(std::shared_ptr<httppeer> peer) { httppeer &client = peer->getpeer(); unsigned int aid = client.get["id"].to_int(); auto articles = orm::cms::Article(); //  可以先查询是否存在或有权限之类 // articles.where("isopen=1").where(" aid=",aid).limit(1).fetch(); int effectnum = 0; try { effectnum = articles.remove(aid); } catch (std::exception &e) { client << "<p>" << articles.sqlstring << "</p>"; client << "<p>" << e.what() << "</p>"; return ""; } if (effectnum > 0) { client.goto_url("/cms/list", 3, "内容已经删除"); return ""; } else { client.goto_url("/cms/list", 3, "删除出错(error)"); return ""; } return ""; } }

 

更看官方controller例子

 

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇1分钟理清楚C++类模板和模板类区别 下一篇<三>线程间互斥-mutex互斥..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目