mirror of
https://gitlab.com/spaceti-app/integrations/common/server-sdk.git
synced 2026-07-12 14:10:43 +02:00
Fix quotes
This commit is contained in:
parent
8aa786fa51
commit
403c2e4a2d
@ -35,7 +35,6 @@ QByteArray DatabaseTable::jsonData(const QSet<QString> &filters) const
|
|||||||
bool DatabaseTable::fromJson(const QByteArray &data)
|
bool DatabaseTable::fromJson(const QByteArray &data)
|
||||||
{
|
{
|
||||||
// in: JSON ( e.g. {"id": 300} )
|
// in: JSON ( e.g. {"id": 300} )
|
||||||
qDebug(sdkdb) << "Response:" << data;
|
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(data);
|
QJsonDocument doc = QJsonDocument::fromJson(data);
|
||||||
QVariantMap variant = qvariant_cast<QVariantMap>(doc.toVariant());
|
QVariantMap variant = qvariant_cast<QVariantMap>(doc.toVariant());
|
||||||
|
|
||||||
|
|||||||
@ -139,6 +139,8 @@ QSqlQuery DatabaseUtils::insertIntoTable(const DatabaseTable *table, const QStri
|
|||||||
values += ":" + key;
|
values += ":" + key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QSqlQuery query(mDatabaseManager->database());
|
QSqlQuery query(mDatabaseManager->database());
|
||||||
QString queryText = QString("INSERT INTO %1 ( %2 ) VALUES ( %3 );").arg(table_name).arg(columns).arg(values);
|
QString queryText = QString("INSERT INTO %1 ( %2 ) VALUES ( %3 );").arg(table_name).arg(columns).arg(values);
|
||||||
query.prepare(queryText);
|
query.prepare(queryText);
|
||||||
@ -146,7 +148,15 @@ QSqlQuery DatabaseUtils::insertIntoTable(const DatabaseTable *table, const QStri
|
|||||||
for (const auto& _key : keys ) {
|
for (const auto& _key : keys ) {
|
||||||
QString key = fromCamelCase(_key);
|
QString key = fromCamelCase(_key);
|
||||||
auto value = valueMap.value(_key);
|
auto value = valueMap.value(_key);
|
||||||
query.bindValue(":"+key, value);
|
if (value.type() == QVariant::Type::String) {
|
||||||
|
QString temp = "'" + value.toString() + "'";
|
||||||
|
query.bindValue(":" + key, temp);
|
||||||
|
} else if (value.type() == QVariant::Type::DateTime) {
|
||||||
|
QString temp = "'" + value.toDateTime().toString("yyyy-MM-dd hh:mm:ss") + "'";
|
||||||
|
query.bindValue(":" + key, temp);
|
||||||
|
} else {
|
||||||
|
query.bindValue(":" + key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSqlQuery res = mDatabaseManager->executeQuery(query);
|
QSqlQuery res = mDatabaseManager->executeQuery(query);
|
||||||
@ -184,7 +194,15 @@ QSqlQuery DatabaseUtils::updateTable(const DatabaseTable *table, const QString &
|
|||||||
for (const auto& _key : keys ) {
|
for (const auto& _key : keys ) {
|
||||||
QString key = fromCamelCase(_key);
|
QString key = fromCamelCase(_key);
|
||||||
auto value = valueMap.value(_key);
|
auto value = valueMap.value(_key);
|
||||||
query.bindValue(":"+key, value);
|
if (value.type() == QVariant::Type::String) {
|
||||||
|
QString temp = "'" + value.toString() + "'";
|
||||||
|
query.bindValue(":" + key, temp);
|
||||||
|
} else if (value.type() == QVariant::Type::DateTime) {
|
||||||
|
QString temp = "'" + value.toDateTime().toString("yyyy-MM-dd hh:mm:ss") + "'";
|
||||||
|
query.bindValue(":" + key, temp);
|
||||||
|
} else {
|
||||||
|
query.bindValue(":" + key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSqlQuery res = mDatabaseManager->executeQuery(query);
|
QSqlQuery res = mDatabaseManager->executeQuery(query);
|
||||||
|
|||||||
@ -59,9 +59,9 @@ bool RequestManager::processRequest(const std::shared_ptr<Request>& request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (auto header, reply->request().rawHeaderList()) {
|
// foreach (auto header, reply->request().rawHeaderList()) {
|
||||||
qDebug(sdknetwork) << header << ":" << reply->request().rawHeader(header);
|
// qDebug(sdknetwork) << header << ":" << reply->request().rawHeader(header);
|
||||||
}
|
// }
|
||||||
|
|
||||||
Q_ASSERT(reply);
|
Q_ASSERT(reply);
|
||||||
// Adding reply to final request
|
// Adding reply to final request
|
||||||
@ -125,8 +125,6 @@ void RequestManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
|||||||
}
|
}
|
||||||
QByteArray data = reply->readAll();
|
QByteArray data = reply->readAll();
|
||||||
|
|
||||||
qDebug(sdknetwork) << data;
|
|
||||||
|
|
||||||
// Decompress gzip data
|
// Decompress gzip data
|
||||||
#ifdef CORESDK_ZLIB
|
#ifdef CORESDK_ZLIB
|
||||||
if (encoding.toLower() == "gzip" && !data.isEmpty() ) {
|
if (encoding.toLower() == "gzip" && !data.isEmpty() ) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user