Skip to content

Commit 5d1e7f1

Browse files
authored
Merge pull request #198 from Targoman/fix_qb_condition_bug
fix qb condition bug
2 parents 101b5e4 + 5ed565c commit 5d1e7f1

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

App/Server/RESTServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void RESTServer::start(fnIsInBlackList_t _fnIPInBlackList) {
9292

9393
QObject::connect(&gHTTPServer, &QHttpServer::newConnection, [this](QHttpConnection* _con) {
9494

95-
TargomanLogInfo(7, QString(100, '*'));
95+
TargomanLogInfo(7, "****************************************************************************************************");
9696

9797
if (!this->validateConnection(_con->tcpSocket()->peerAddress(), _con->tcpSocket()->peerPort()))
9898
_con->killConnection();
@@ -122,7 +122,7 @@ void RESTServer::start(fnIsInBlackList_t _fnIPInBlackList) {
122122
if (Path == ServerCommonConfigs::BasePathWithVersion )
123123
return RequestHandler->sendError(qhttp::ESTATUS_NOT_ACCEPTABLE, "No API call provided", {}, {}, true);
124124

125-
TargomanLogInfo(7, QString(100, '*'));
125+
TargomanLogInfo(7, "****************************************************************************************************");
126126
TargomanLogInfo(7, "(" << RequestHandler->Index() << ") "
127127
<< "New API Call ["
128128
<< _req->connection()->tcpSocket()->peerAddress().toString()

App/Server/clsRequestHandler.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ void clsRequestHandler::sendResponse(qhttp::TStatusCode _code,
671671

672672
if (_response.isValid() == false)
673673
this->sendResponseBase(_code, QJsonObject({ { "result", QJsonValue(QJsonValue::Undefined) } }), _responseHeaders);
674-
675674
else if (strcmp(_response.typeName(), "TAPI::RawData_t") == 0) {
676675
TAPI::RawData_t RawData = qvariant_cast<TAPI::RawData_t>(_response);
677676

@@ -716,15 +715,12 @@ void clsRequestHandler::sendResponse(qhttp::TStatusCode _code,
716715
this->Response->end(RawData.data());
717716

718717
this->deleteLater();
719-
720718
} else if (strcmp(_response.typeName(), "TAPI::ResponseRedirect_t") == 0) {
721719
TAPI::ResponseRedirect_t ResponseRedirect = qvariant_cast<TAPI::ResponseRedirect_t>(_response);
722720
this->redirect(ResponseRedirect.url(), ResponseRedirect.appendBase(), ResponseRedirect.statusCode());
723-
724721
} else if (strcmp(_response.typeName(), "TAPI::FileData_t") == 0) {
725722
TAPI::FileData_t FileData = qvariant_cast<TAPI::FileData_t>(_response);
726723
this->sendFile(FileData.fileName());
727-
728724
} else
729725
this->sendResponseBase(_code, QJsonObject({ { "result", QJsonValue::fromVariant(_response) } }), _responseHeaders);
730726
}
@@ -836,7 +832,8 @@ void clsRequestHandler::slotSendFileData() {
836832
return;
837833
}
838834

839-
this->Response->write(this->FileHandler->read(ServerCommonConfigs::FileMaxChunk.value()));
835+
auto FileData = this->FileHandler->read(ServerCommonConfigs::FileMaxChunk.value());
836+
this->Response->write(FileData);
840837
QTimer::singleShot(10, this, &clsRequestHandler::slotSendFileData);
841838
}
842839

Interfaces/DBM/QueryBuilders.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,17 +2261,20 @@ tmplQueryWhereTrait<itmplDerived>::~tmplQueryWhereTrait() { ; }
22612261
template <class itmplDerived>
22622262
itmplDerived& tmplQueryWhereTrait<itmplDerived>::where(const clsCondition& _condition) {
22632263
if (_condition.isEmpty() == false)
2264-
this->WhereTraitData->WhereClauses = _condition;
2264+
this->WhereTraitData->WhereClauses.setCond(_condition);
22652265

22662266
return (itmplDerived&)*this;
22672267
}
22682268

22692269
template <class itmplDerived>
22702270
itmplDerived& tmplQueryWhereTrait<itmplDerived>::andWhere(const clsCondition& _condition) {
2271+
if (this->WhereTraitData->WhereClauses.isEmpty())
2272+
return this->where(_condition);
2273+
22712274
if (_condition.isEmpty() == false) {
2272-
if (this->WhereTraitData->WhereClauses.isEmpty())
2273-
this->WhereTraitData->WhereClauses = _condition;
2274-
else
2275+
// if (this->WhereTraitData->WhereClauses.isEmpty())
2276+
// this->WhereTraitData->WhereClauses = _condition;
2277+
// else
22752278
this->WhereTraitData->WhereClauses.andCond(_condition);
22762279
}
22772280

@@ -2280,10 +2283,13 @@ itmplDerived& tmplQueryWhereTrait<itmplDerived>::andWhere(const clsCondition& _c
22802283

22812284
template <class itmplDerived>
22822285
itmplDerived& tmplQueryWhereTrait<itmplDerived>::orWhere(const clsCondition& _condition) {
2286+
if (this->WhereTraitData->WhereClauses.isEmpty())
2287+
return this->where(_condition);
2288+
22832289
if (_condition.isEmpty() == false) {
2284-
if (this->WhereTraitData->WhereClauses.isEmpty())
2285-
this->WhereTraitData->WhereClauses = _condition;
2286-
else
2290+
// if (this->WhereTraitData->WhereClauses.isEmpty())
2291+
// this->WhereTraitData->WhereClauses = _condition;
2292+
// else
22872293
this->WhereTraitData->WhereClauses.orCond(_condition);
22882294
}
22892295

@@ -2292,10 +2298,13 @@ itmplDerived& tmplQueryWhereTrait<itmplDerived>::orWhere(const clsCondition& _co
22922298

22932299
template <class itmplDerived>
22942300
itmplDerived& tmplQueryWhereTrait<itmplDerived>::xorWhere(const clsCondition& _condition) {
2301+
if (this->WhereTraitData->WhereClauses.isEmpty())
2302+
return this->where(_condition);
2303+
22952304
if (_condition.isEmpty() == false) {
2296-
if (this->WhereTraitData->WhereClauses.isEmpty())
2297-
this->WhereTraitData->WhereClauses = _condition;
2298-
else
2305+
// if (this->WhereTraitData->WhereClauses.isEmpty())
2306+
// this->WhereTraitData->WhereClauses = _condition;
2307+
// else
22992308
this->WhereTraitData->WhereClauses.xorCond(_condition);
23002309
}
23012310

conf/api.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ Schema = AAA
369369
#---------------------------------------
370370
;TransactionLogFile =
371371

372+
;ObjectStorage/TempLocalStoragePath = /targoman/data/Account/objectstorage
373+
372374
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
373375
# @@@ Module_Advert SECTION @@@
374376
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -403,6 +405,8 @@ DB/Pass = targoman123
403405
#---------------------------------------
404406
DB/Schema = Advert
405407

408+
;ObjectStorage/TempLocalStoragePath = /targoman/data/Advert/objectstorage
409+
406410
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407411
# @@@ Module_Common SECTION @@@
408412
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -505,6 +509,8 @@ DB/Pass = targoman123
505509
#---------------------------------------
506510
DB/Schema = MT
507511

512+
;ObjectStorage/TempLocalStoragePath = /targoman/data/MT/objectstorage
513+
508514
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509515
# @@@ Module_NGTv1 SECTION @@@
510516
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -573,6 +579,8 @@ DB/Pass = targoman123
573579
#---------------------------------------
574580
DB/Schema = Ticketing
575581

582+
;ObjectStorage/TempLocalStoragePath = /targoman/data/Ticketing/objectstorage
583+
576584
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
577585
# @@@ Server SECTION @@@
578586
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0 commit comments

Comments
 (0)