X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fpostgresqlstorage.cpp;h=16ab7c39294136479ff87ea6c993f10d31e44e8b;hb=e212eabe53878a8fa6ecb15909a325ed7dd63283;hp=48236bc04197b614a2e13a04fd8dbe241cb372b3;hpb=6a835281b265df6a06b7f41109ad2d449899fed0;p=quassel.git diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index 48236bc0..16ab7c39 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -1634,6 +1634,8 @@ bool PostgreSqlStorage::logMessage(Message &msg) } QVariantList params; + // PostgreSQL handles QDateTime()'s serialized format by default, and QDateTime() serializes + // to a 64-bit time compatible format by default. params << msg.timestamp() << msg.bufferInfo().bufferId().toInt() << msg.type() @@ -1718,6 +1720,8 @@ bool PostgreSqlStorage::logMessages(MessageList &msgs) for (int i = 0; i < msgs.count(); i++) { Message &msg = msgs[i]; QVariantList params; + // PostgreSQL handles QDateTime()'s serialized format by default, and QDateTime() serializes + // to a 64-bit time compatible format by default. params << msg.timestamp() << msg.bufferInfo().bufferId().toInt() << msg.type() @@ -1797,17 +1801,19 @@ QList PostgreSqlStorage::requestMsgs(UserId user, BufferId bufferId, Ms QDateTime timestamp; while (query.next()) { + // PostgreSQL returns date/time in ISO 8601 format, no 64-bit handling needed + // See https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT timestamp = query.value(1).toDateTime(); timestamp.setTimeSpec(Qt::UTC); Message msg(timestamp, bufferInfo, - (Message::Type)query.value(2).toUInt(), + (Message::Type)query.value(2).toInt(), query.value(8).toString(), query.value(4).toString(), query.value(5).toString(), query.value(6).toString(), query.value(7).toString(), - (Message::Flags)query.value(3).toUInt()); + (Message::Flags)query.value(3).toInt()); msg.setMsgId(query.value(0).toLongLong()); messagelist << msg; } @@ -1861,11 +1867,13 @@ QList PostgreSqlStorage::requestMsgsFiltered(UserId user, BufferId buff QDateTime timestamp; while (query.next()) { + // PostgreSQL returns date/time in ISO 8601 format, no 64-bit handling needed + // See https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT timestamp = query.value(1).toDateTime(); timestamp.setTimeSpec(Qt::UTC); Message msg(timestamp, bufferInfo, - (Message::Type)query.value(2).toUInt(), + (Message::Type)query.value(2).toInt(), query.value(8).toString(), query.value(4).toString(), query.value(5).toString(), @@ -1916,17 +1924,19 @@ QList PostgreSqlStorage::requestAllMsgs(UserId user, MsgId first, MsgId QDateTime timestamp; for (int i = 0; i < limit && query.next(); i++) { + // PostgreSQL returns date/time in ISO 8601 format, no 64-bit handling needed + // See https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT timestamp = query.value(2).toDateTime(); timestamp.setTimeSpec(Qt::UTC); Message msg(timestamp, bufferInfoHash[query.value(1).toInt()], - (Message::Type)query.value(3).toUInt(), + (Message::Type)query.value(3).toInt(), query.value(9).toString(), query.value(5).toString(), query.value(6).toString(), query.value(7).toString(), query.value(8).toString(), - (Message::Flags)query.value(4).toUInt()); + (Message::Flags)query.value(4).toInt()); msg.setMsgId(query.value(0).toLongLong()); messagelist << msg; } @@ -1978,11 +1988,13 @@ QList PostgreSqlStorage::requestAllMsgsFiltered(UserId user, MsgId firs QDateTime timestamp; for (int i = 0; i < limit && query.next(); i++) { + // PostgreSQL returns date/time in ISO 8601 format, no 64-bit handling needed + // See https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT timestamp = query.value(2).toDateTime(); timestamp.setTimeSpec(Qt::UTC); Message msg(timestamp, bufferInfoHash[query.value(1).toInt()], - (Message::Type)query.value(3).toUInt(), + (Message::Type)query.value(3).toInt(), query.value(9).toString(), query.value(5).toString(), query.value(6).toString(),