Skip to content

Commit

Permalink
fixed sql tcp queries
Browse files Browse the repository at this point in the history
  • Loading branch information
taraldv committed Aug 6, 2020
1 parent ff25ce6 commit 7468c01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/servertcpqueries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int ServerTcpQueries::CUDQuery(int code, QVariantList vars)
data.prepend(code);
if(connect())
{
qDebug() <<"SQL TCP Query(" << code << ")" << " Sending data: " << data;
this->write(data);
if(this->waitForReadyRead(mMillisWait))
{
Expand Down
4 changes: 2 additions & 2 deletions handlers/sessionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void SessionHandler::addUser()
qDebug() << "User is guest: " << mUser->isGuest();
if (!mUser->isGuest())
{
vars.append(QString::number(mUser->getUserId()));
vars.prepend(QString::number(mUser->getUserId()));
int numberOfRowsAffected = mServerTcpQueries->CUDQuery(1, vars);
if(numberOfRowsAffected<=0)
{
Expand All @@ -179,7 +179,7 @@ void SessionHandler::addUser()
{
if (addGuestUserToDatabase())
{
vars.append(QString::number(mUser->getGuestId()));
vars.prepend(QString::number(mUser->getGuestId()));
int numberOfRowsAffected = mServerTcpQueries->CUDQuery(1, vars);
if(numberOfRowsAffected<=0)
{
Expand Down
6 changes: 4 additions & 2 deletions handlers/userhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ QString UserHandler::getGuestStreamId()
{
QVariantList vars;
vars.append(QString::number(getGuestId()));
QString queryData = mServerTcpQueries->RQuery(8, vars)[0].toString();
QVariantList returnList = mServerTcpQueries->RQuery(8, vars);
QString queryData = returnList[0].toString();
if(!queryData.isEmpty())
{
return queryData;
Expand All @@ -173,7 +174,8 @@ int UserHandler::getGuestId()
{
QVariantList vars;
vars.append(mGuestName);
return mServerTcpQueries->RQuery(9, vars)[0].toInt();
QVariantList returnList = mServerTcpQueries->RQuery(9, vars);
return returnList[0].toInt();
}

bool UserHandler::logout()
Expand Down

0 comments on commit 7468c01

Please sign in to comment.