From: Michael Marley Date: Mon, 1 Sep 2014 22:42:22 +0000 (-0400) Subject: Use null QVariant instead of "ALL" for select limit on psql X-Git-Tag: 0.11.0~12^2 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=6d2798ada0b9e770f821e039431cc9dc3b5f85cf Use null QVariant instead of "ALL" for select limit on psql Using "ALL" as it was before was making PostgreSQL error out when attempting to return backlog for Quasseldroid when Quasseldroid is in "Unread messages per chat" mode. According to http://www.postgresql.org/docs/9.3/static/queries-limit.html, LIMIT NULL is the same thing as having no LIMIT at all. According to http://qt-project.org/doc/qt-4.8/qsqlquery.html, NULL values are bound in Qt SQL prepared statements by using a null QVariant. --- diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index 56aaf54c..bb58da17 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -1516,7 +1516,7 @@ QList PostgreSqlStorage::requestMsgs(UserId user, BufferId bufferId, Ms if (limit != -1) params << limit; else - params << "ALL"; + params << QVariant(QVariant::Int); QSqlQuery query = executePreparedQuery(queryName, params, db);