forked from mirrors/linphone-iphone
feat(AbstractDb): add a noLimitValue function to deal with LIMIT keyword properly
This commit is contained in:
parent
de04087a34
commit
4cdb46496e
3 changed files with 17 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue