diff options
| author | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-01-20 15:42:53 +0000 |
|---|---|---|
| committer | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-01-20 15:42:53 +0000 |
| commit | dcec9bcedc769372f1d2a84d24755a8dda43238f (patch) | |
| tree | 81eba4fddcfbe7a015052e5332b839c717d3cce3 /pica-client/history.cpp | |
| parent | da68f9e85db0f232656542564bd770240e28110e (diff) | |
| download | pica-pica-dcec9bcedc769372f1d2a84d24755a8dda43238f.tar.gz pica-pica-dcec9bcedc769372f1d2a84d24755a8dda43238f.zip | |
displaying history in chatwindow
git-svn-id: svn://localhost/project_picapica/trunk@221 fb96df88-216d-11de-830c-f3023f12d8ac
Diffstat (limited to 'pica-client/history.cpp')
| -rw-r--r-- | pica-client/history.cpp | 21 |
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(); +} |
