Do NOT set ID on accounts, they should only contain account ID.
This commit is contained in:
parent
581b7c08a0
commit
48909d9ef9
3 changed files with 14 additions and 6 deletions
|
@ -1670,8 +1670,8 @@ void DatabaseQueries::createOverwriteAccount(const QSqlDatabase& db, ServiceRoot
|
||||||
throw ApplicationException(q.lastError().text());
|
throw ApplicationException(q.lastError().text());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
account->setId(q.lastInsertId().toInt());
|
//account->setId(q.lastInsertId().toInt());
|
||||||
account->setAccountId(account->id());
|
account->setAccountId(q.lastInsertId().toInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1690,8 +1690,14 @@ void DatabaseQueries::createOverwriteAccount(const QSqlDatabase& db, ServiceRoot
|
||||||
q.bindValue(QSL(":proxy_password"), TextFactory::encrypt(proxy.password()));
|
q.bindValue(QSL(":proxy_password"), TextFactory::encrypt(proxy.password()));
|
||||||
q.bindValue(QSL(":id"), account->accountId());
|
q.bindValue(QSL(":id"), account->accountId());
|
||||||
|
|
||||||
q.bindValue(QSL(":custom_data"),
|
auto custom_data = account->customDatabaseData();
|
||||||
QString::fromUtf8(QJsonDocument::fromVariant(account->customDatabaseData()).toJson(QJsonDocument::JsonFormat::Indented)));
|
QString serialized_custom_data;
|
||||||
|
|
||||||
|
if (!custom_data.isEmpty()) {
|
||||||
|
serialized_custom_data = QString::fromUtf8(QJsonDocument::fromVariant(custom_data).toJson(QJsonDocument::JsonFormat::Indented));
|
||||||
|
}
|
||||||
|
|
||||||
|
q.bindValue(QSL(":custom_data"), serialized_custom_data);
|
||||||
|
|
||||||
if (!q.exec()) {
|
if (!q.exec()) {
|
||||||
throw ApplicationException(q.lastError().text());
|
throw ApplicationException(q.lastError().text());
|
||||||
|
|
|
@ -189,8 +189,8 @@ QList<ServiceRoot*> DatabaseQueries::getAccounts(const QSqlDatabase& db, const Q
|
||||||
ServiceRoot* root = new T();
|
ServiceRoot* root = new T();
|
||||||
|
|
||||||
// Load common data.
|
// Load common data.
|
||||||
root->setId(query.value(QSL("id")).toInt());
|
//root->setId(query.value(QSL("id")).toInt());
|
||||||
root->setAccountId(root->id());
|
root->setAccountId(query.value(QSL("id")).toInt());
|
||||||
|
|
||||||
QNetworkProxy proxy(QNetworkProxy::ProxyType(query.value(QSL("proxy_type")).toInt()),
|
QNetworkProxy proxy(QNetworkProxy::ProxyType(query.value(QSL("proxy_type")).toInt()),
|
||||||
query.value(QSL("proxy_host")).toString(),
|
query.value(QSL("proxy_host")).toString(),
|
||||||
|
|
|
@ -13,5 +13,7 @@ FormEditStandardAccount::FormEditStandardAccount(QWidget* parent)
|
||||||
|
|
||||||
void FormEditStandardAccount::apply() {
|
void FormEditStandardAccount::apply() {
|
||||||
FormAccountDetails::apply();
|
FormAccountDetails::apply();
|
||||||
|
|
||||||
|
m_account->saveAccountDataToDatabase();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue