Notices and errors are as before switch might need still some work.

This commit is contained in:
Eelke Klein 2017-01-08 10:29:21 +01:00
parent a36bf5f7f4
commit 2502aea9e5
4 changed files with 49 additions and 33 deletions

View file

@ -22,6 +22,7 @@ public:
using on_result_callback = std::function<void(std::shared_ptr<Pgsql::Result>)>;
using on_state_callback = std::function<void(State)>;
using on_notice_callback = std::function<void(Pgsql::ErrorDetails)>;
ASyncDBConnection();
@ -29,6 +30,7 @@ public:
void closeConnection();
void setStateCallback(on_state_callback state_callback);
void setNoticeCallback(on_notice_callback notice_callback);
/** Sends command to the server.
@ -61,6 +63,10 @@ private:
std::mutex m_mutex;
on_state_callback m_func;
} m_stateCallback;
struct {
std::mutex m_mutex;
on_notice_callback m_func;
} m_noticeCallback;
struct t_Command {
std::mutex m_mutex;
@ -102,6 +108,9 @@ private:
void waitForAndSendCommand();
void doNewCommand();
void waitForResult();
void processNotice(const PGresult *result);
};
Thread m_threadData;