summaryrefslogtreecommitdiffstats
path: root/pica-client/history.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pica-client/history.cpp')
-rw-r--r--pica-client/history.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/pica-client/history.cpp b/pica-client/history.cpp
index 1f57bc4..31a4e22 100644
--- a/pica-client/history.cpp
+++ b/pica-client/history.cpp
@@ -1,4 +1,5 @@
#include "history.h"
+#include <QDebug>
History::History(QString storage, quint32 my_id)
: me_(my_id)
@@ -23,11 +24,13 @@ void History::Add(quint32 peer_id, QString message, bool is_me)
{
QSqlQuery query;
- query.prepare("insert into history (contact_id, account_id, timestamp, is_me, is_delivered, message) \
- values (:peer_id, :me, strftime('%s','now'), :is_me, :is_delivered, :message)");
+ query.prepare(
+ "insert into \"history\" (\"contact_id\", \"account_id\", \"is_me\", \"is_delivered\", \"message\", \"id\", \"timestamp\") \
+ values (:contact_id, :account_id, :is_me, :is_delivered, :message, null, strftime('%s','now'));"
+ );
- query.bindValue(":peer_id", peer_id);
- query.bindValue(":me", me_);
+ query.bindValue(":contact_id", peer_id);
+ query.bindValue(":account_id", me_);
if (is_me)
{
@@ -124,3 +127,13 @@ QMap<quint32, QList<QString> > History::GetUndeliveredMessages()
return M;
}
+
+bool History::isOK()
+{
+ return !lasterr.isValid();
+}
+
+QString History::GetLastError()
+{
+ return lasterr.text();
+}