updatequery.cpp

来自「LiteSQL is a C++ library that integrates」· C++ 代码 · 共 31 行

CPP
31
字号
/* LiteSQL - UpdateQuery implementation *  * By Tero Laitinen  *  * See LICENSE for copyright information. */#include "compatibility.hpp"#include "litesql/updatequery.hpp"namespace litesql {using namespace std;UpdateQuery& UpdateQuery::where(const Expr& e) {    _where = (RawExpr(_where) && e).asString();    return *this;}UpdateQuery& UpdateQuery::set(FieldType f, string value) {    fields.push_back(f.name());    values.push_back(escapeSQL(value));    return *this;}UpdateQuery::operator string() const {    string q = "UPDATE " + table + " SET ";    Split sets;    for (size_t i = 0; i < fields.size(); i++)        sets.push_back(fields[i] + "=" + values[i]);    q += sets.join(",");    if (_where.size())        q += " WHERE " + _where;    return q;}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?