Updating rows kinda works.
Blocking calls are still used.
This commit is contained in:
parent
99d738ee65
commit
628c16e2f4
10 changed files with 179 additions and 81 deletions
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <QAbstractTableModel>
|
||||
#include "ASyncDBConnection.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
|
||||
#include "PgClass.h"
|
||||
#include "PgConstraint.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
|
|
@ -98,13 +100,17 @@ private:
|
|||
*/
|
||||
class ModifiedRow {
|
||||
public:
|
||||
ModifiedRow() = default;
|
||||
ModifiedRow(int row, const std::vector<Value> &values)
|
||||
: m_row(row), m_values(values)
|
||||
{}
|
||||
ModifiedRow(int row, const std::vector<Value> &&values)
|
||||
: m_row(row), m_values(values)
|
||||
{}
|
||||
const auto& data() const { return m_values; }
|
||||
int row() const { return m_row; }
|
||||
private:
|
||||
int m_row;
|
||||
int m_row = -1;
|
||||
std::vector<Value> m_values;
|
||||
};
|
||||
using ModifiedRowList = std::map<int, ModifiedRow>;
|
||||
|
|
@ -177,7 +183,6 @@ private:
|
|||
|
||||
void clear() { m_rows.clear(); }
|
||||
|
||||
private:
|
||||
Map m_rows;
|
||||
};
|
||||
|
||||
|
|
@ -188,6 +193,7 @@ private:
|
|||
PgClass m_table;
|
||||
boost::optional<PgConstraint> m_primaryKey;
|
||||
ASyncDBConnection m_dbConn;
|
||||
|
||||
bool callLoadData = false;
|
||||
|
||||
std::shared_ptr<Pgsql::Result> m_roData;
|
||||
|
|
@ -236,7 +242,7 @@ private:
|
|||
|
||||
bool savePendingChanges();
|
||||
|
||||
void updateRow(const PendingRow &pending_row);
|
||||
std::tuple<bool, ModifiedRow> updateRow(const PendingRow &pending_row);
|
||||
private slots:
|
||||
|
||||
void connectionStateChanged(ASyncDBConnection::State state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue