Commit 4cdb4649 authored by Ronan's avatar Ronan
Browse files

feat(AbstractDb): add a noLimitValue function to deal with `LIMIT` keyword properly

parent de04087a
......@@ -137,6 +137,20 @@ string AbstractDb::timestampType () const {
return "";
}
string AbstractDb::noLimitValue () const {
L_D();
switch (d->backend) {
case Mysql:
return "9999999999999999999";
case Sqlite3:
return "-1";
}
L_ASSERT(false);
return "";
}
long long AbstractDb::getLastInsertId () const {
long long id = 0;
......
......@@ -56,6 +56,8 @@ protected:
std::string timestampType () const;
std::string noLimitValue () const;
long long getLastInsertId () const;
void enableForeignKeys (bool status);
......
......@@ -1883,7 +1883,7 @@ static constexpr string &blobToString (string &in) {
if (end > 0)
query += " LIMIT " + Utils::toString(end - begin);
else
query += " LIMIT 9999999999999999999"; // For Mysql compatibility, do not set -1.
query += " LIMIT " + noLimitValue();
if (begin > 0)
query += " OFFSET " + Utils::toString(begin);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment