|
@@ -3845,18 +3845,8 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- wheresql.push_back('=');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- std::stringstream _stream;
|
|
|
|
- _stream << val;
|
|
|
|
- wheresql.append(_stream.str());
|
|
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3922,14 +3912,7 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- wheresql.push_back('=');
|
|
|
|
- }
|
|
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
|
|
if (obj.is_string())
|
|
if (obj.is_string())
|
|
{
|
|
{
|
|
@@ -3971,9 +3954,7 @@ M_MODEL& or_leRandomnumber(T val)
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
wheresql.push_back(bi);
|
|
wheresql.push_back(bi);
|
|
- std::stringstream _stream;
|
|
|
|
- _stream << val;
|
|
|
|
- wheresql.append(_stream.str());
|
|
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4032,14 +4013,135 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereBT(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.push_back('>');
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereBE(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(">=");
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereLT(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
{
|
|
{
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- wheresql.push_back('=');
|
|
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
}
|
|
}
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" < ");
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereLE(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" <= ");
|
|
|
|
|
|
wheresql.push_back('\'');
|
|
wheresql.push_back('\'');
|
|
wheresql.append(val);
|
|
wheresql.append(val);
|
|
@@ -4343,19 +4445,167 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereBT(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
{
|
|
{
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- wheresql.push_back('=');
|
|
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- std::stringstream _stream;
|
|
|
|
- _stream << val;
|
|
|
|
- wheresql.append(_stream.str());
|
|
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" > ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereBE(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" >= ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereLT(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" < ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereLE(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" <= ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+ //where and
|
|
|
|
+ M_MODEL &whereEQ(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" AND ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
M_MODEL &whereAnd(const std::string &wq, const std::string &val)
|
|
M_MODEL &whereAnd(const std::string &wq, const std::string &val)
|
|
{
|
|
{
|
|
if (wheresql.empty())
|
|
if (wheresql.empty())
|
|
@@ -4380,22 +4630,80 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+ //where string or
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereOrBT(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
{
|
|
{
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- wheresql.push_back('=');
|
|
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
}
|
|
}
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.push_back('>');
|
|
|
|
|
|
wheresql.push_back('\'');
|
|
wheresql.push_back('\'');
|
|
wheresql.append(val);
|
|
wheresql.append(val);
|
|
wheresql.push_back('\'');
|
|
wheresql.push_back('\'');
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ M_MODEL &whereOrBE(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(">=");
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
- M_MODEL &whereOr(const std::string &wq)
|
|
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereOrLT(const std::string &wq, const std::string &val)
|
|
{
|
|
{
|
|
if (wheresql.empty())
|
|
if (wheresql.empty())
|
|
{
|
|
{
|
|
@@ -4419,11 +4727,15 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
|
|
+ wheresql.append(" < ");
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
- template <typename _SQL_Value>
|
|
|
|
- requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
- M_MODEL &whereOr(const std::string &wq, _SQL_Value val)
|
|
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereOrLE(const std::string &wq, const std::string &val)
|
|
{
|
|
{
|
|
if (wheresql.empty())
|
|
if (wheresql.empty())
|
|
{
|
|
{
|
|
@@ -4447,20 +4759,49 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
|
|
+ wheresql.append(" <= ");
|
|
|
|
+
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ wheresql.append(val);
|
|
|
|
+ wheresql.push_back('\'');
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //where or
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereOrBT(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
{
|
|
{
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- wheresql.push_back('=');
|
|
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- std::stringstream _stream;
|
|
|
|
- _stream << val;
|
|
|
|
- wheresql.append(_stream.str());
|
|
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" > ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
- M_MODEL &whereOr(const std::string &wq, const std::string &val)
|
|
|
|
|
|
+
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereOrBE(const std::string &wq, _SQL_Value val)
|
|
{
|
|
{
|
|
if (wheresql.empty())
|
|
if (wheresql.empty())
|
|
{
|
|
{
|
|
@@ -4484,15 +4825,154 @@ M_MODEL& or_leRandomnumber(T val)
|
|
ishascontent = true;
|
|
ishascontent = true;
|
|
}
|
|
}
|
|
wheresql.append(wq);
|
|
wheresql.append(wq);
|
|
- char bi = wq.back();
|
|
|
|
- if (bi == '=' || bi == '>' || bi == '<')
|
|
|
|
|
|
+ wheresql.append(" >= ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereOrLT(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
{
|
|
{
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- wheresql.push_back('=');
|
|
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
}
|
|
}
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" < ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereOrLE(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.append(" <= ");
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ M_MODEL &whereOr(const std::string &wq)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+ template <typename _SQL_Value>
|
|
|
|
+ requires std::is_integral_v<_SQL_Value> || std::is_floating_point_v<_SQL_Value>
|
|
|
|
+ M_MODEL &whereOr(const std::string &wq, _SQL_Value val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.push_back('=');
|
|
|
|
+ wheresql.append(std::to_string(val));
|
|
|
|
+ return *mod;
|
|
|
|
+ }
|
|
|
|
+ M_MODEL &whereOr(const std::string &wq, const std::string &val)
|
|
|
|
+ {
|
|
|
|
+ if (wheresql.empty())
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ishascontent)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!iskuohao)
|
|
|
|
+ {
|
|
|
|
+ wheresql.append(" OR ");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (iskuohao)
|
|
|
|
+ {
|
|
|
|
+ ishascontent = true;
|
|
|
|
+ }
|
|
|
|
+ wheresql.append(wq);
|
|
|
|
+ wheresql.push_back('=');
|
|
wheresql.push_back('\'');
|
|
wheresql.push_back('\'');
|
|
wheresql.append(val);
|
|
wheresql.append(val);
|
|
wheresql.push_back('\'');
|
|
wheresql.push_back('\'');
|
|
@@ -6861,7 +7341,7 @@ M_MODEL& or_leRandomnumber(T val)
|
|
temp_cache.save(sqlhashid, cache_data, exp_time);
|
|
temp_cache.save(sqlhashid, cache_data, exp_time);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- B_BASE::meta &get_cache(const std::string &cache_key_name)
|
|
|
|
|
|
+ typename B_BASE::meta &get_cache(const std::string &cache_key_name)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -10604,7 +11084,7 @@ M_MODEL& or_leRandomnumber(T val)
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
islock_conn = true;
|
|
islock_conn = true;
|
|
-
|
|
|
|
|
|
+
|
|
if (islock_conn)
|
|
if (islock_conn)
|
|
{
|
|
{
|
|
if (!edit_conn)
|
|
if (!edit_conn)
|
|
@@ -10616,16 +11096,15 @@ M_MODEL& or_leRandomnumber(T val)
|
|
{
|
|
{
|
|
edit_conn = conn_obj->get_edit_conn();
|
|
edit_conn = conn_obj->get_edit_conn();
|
|
}
|
|
}
|
|
- sqlstring="start transaction";
|
|
|
|
|
|
+ sqlstring = "start transaction";
|
|
edit_conn->write_sql(sqlstring);
|
|
edit_conn->write_sql(sqlstring);
|
|
iscommit = true;
|
|
iscommit = true;
|
|
|
|
|
|
-
|
|
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
M_MODEL &rollback()
|
|
M_MODEL &rollback()
|
|
{
|
|
{
|
|
- if(iscommit==false)
|
|
|
|
|
|
+ if (iscommit == false)
|
|
{
|
|
{
|
|
error_msg = "not begin_commit";
|
|
error_msg = "not begin_commit";
|
|
iserror = true;
|
|
iserror = true;
|
|
@@ -10646,16 +11125,16 @@ M_MODEL& or_leRandomnumber(T val)
|
|
{
|
|
{
|
|
edit_conn = conn_obj->get_edit_conn();
|
|
edit_conn = conn_obj->get_edit_conn();
|
|
}
|
|
}
|
|
- sqlstring="rollback";
|
|
|
|
|
|
+ sqlstring = "rollback";
|
|
edit_conn->write_sql(sqlstring);
|
|
edit_conn->write_sql(sqlstring);
|
|
|
|
|
|
- iscommit = false;
|
|
|
|
|
|
+ iscommit = false;
|
|
islock_conn = false;
|
|
islock_conn = false;
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
M_MODEL &commit()
|
|
M_MODEL &commit()
|
|
{
|
|
{
|
|
- if(iscommit==false)
|
|
|
|
|
|
+ if (iscommit == false)
|
|
{
|
|
{
|
|
error_msg = "not begin_commit";
|
|
error_msg = "not begin_commit";
|
|
iserror = true;
|
|
iserror = true;
|
|
@@ -10674,17 +11153,16 @@ M_MODEL& or_leRandomnumber(T val)
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- edit_conn =conn_obj->get_edit_conn();
|
|
|
|
|
|
+ edit_conn = conn_obj->get_edit_conn();
|
|
}
|
|
}
|
|
- sqlstring="commit";
|
|
|
|
|
|
+ sqlstring = "commit";
|
|
edit_conn->write_sql(sqlstring);
|
|
edit_conn->write_sql(sqlstring);
|
|
|
|
|
|
- iscommit = false;
|
|
|
|
|
|
+ iscommit = false;
|
|
islock_conn = false;
|
|
islock_conn = false;
|
|
return *mod;
|
|
return *mod;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
asio::awaitable<bool> async_begin_commit()
|
|
asio::awaitable<bool> async_begin_commit()
|
|
{
|
|
{
|
|
if (!conn_empty())
|
|
if (!conn_empty())
|
|
@@ -10704,7 +11182,7 @@ M_MODEL& or_leRandomnumber(T val)
|
|
{
|
|
{
|
|
edit_conn = co_await conn_obj->async_get_edit_conn();
|
|
edit_conn = co_await conn_obj->async_get_edit_conn();
|
|
}
|
|
}
|
|
- sqlstring="start transaction";
|
|
|
|
|
|
+ sqlstring = "start transaction";
|
|
co_await edit_conn->async_write_sql(sqlstring);
|
|
co_await edit_conn->async_write_sql(sqlstring);
|
|
iscommit = true;
|
|
iscommit = true;
|
|
|
|
|
|
@@ -10712,7 +11190,7 @@ M_MODEL& or_leRandomnumber(T val)
|
|
}
|
|
}
|
|
asio::awaitable<bool> async_rollback()
|
|
asio::awaitable<bool> async_rollback()
|
|
{
|
|
{
|
|
- if(iscommit==false)
|
|
|
|
|
|
+ if (iscommit == false)
|
|
{
|
|
{
|
|
error_msg = "not begin_commit";
|
|
error_msg = "not begin_commit";
|
|
iserror = true;
|
|
iserror = true;
|
|
@@ -10733,17 +11211,17 @@ M_MODEL& or_leRandomnumber(T val)
|
|
{
|
|
{
|
|
edit_conn = co_await conn_obj->async_get_edit_conn();
|
|
edit_conn = co_await conn_obj->async_get_edit_conn();
|
|
}
|
|
}
|
|
- sqlstring="rollback";
|
|
|
|
|
|
+ sqlstring = "rollback";
|
|
co_await edit_conn->async_write_sql(sqlstring);
|
|
co_await edit_conn->async_write_sql(sqlstring);
|
|
|
|
|
|
- iscommit = false;
|
|
|
|
|
|
+ iscommit = false;
|
|
islock_conn = false;
|
|
islock_conn = false;
|
|
co_return true;
|
|
co_return true;
|
|
}
|
|
}
|
|
|
|
|
|
asio::awaitable<bool> async_commit()
|
|
asio::awaitable<bool> async_commit()
|
|
{
|
|
{
|
|
- if(iscommit==false)
|
|
|
|
|
|
+ if (iscommit == false)
|
|
{
|
|
{
|
|
error_msg = "not begin_commit";
|
|
error_msg = "not begin_commit";
|
|
iserror = true;
|
|
iserror = true;
|
|
@@ -10764,10 +11242,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
{
|
|
{
|
|
edit_conn = co_await conn_obj->async_get_edit_conn();
|
|
edit_conn = co_await conn_obj->async_get_edit_conn();
|
|
}
|
|
}
|
|
- sqlstring="commit";
|
|
|
|
|
|
+ sqlstring = "commit";
|
|
co_await edit_conn->async_write_sql(sqlstring);
|
|
co_await edit_conn->async_write_sql(sqlstring);
|
|
|
|
|
|
- iscommit = false;
|
|
|
|
|
|
+ iscommit = false;
|
|
islock_conn = false;
|
|
islock_conn = false;
|
|
co_return true;
|
|
co_return true;
|
|
}
|
|
}
|