From a2f62610144d1ba496ece3946a1e64fe8d6e0f9c Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 30 Oct 2022 14:40:34 +0100 Subject: WIP fix HandleMessage --- client/HandleMessage.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/HandleMessage.cpp b/client/HandleMessage.cpp index aa73828..dc25b21 100644 --- a/client/HandleMessage.cpp +++ b/client/HandleMessage.cpp @@ -17,15 +17,12 @@ QString HandleMessage::ParseMessage(const QString Msg , int totalRecords ) void HandleMessage::ParseToSQL(QString input) { QSqlQuery queryInsertData; - QString output = "INSERT INTO `WSdb`.`tblMain` () VALUES "; + QString output = "insert into WSdb.tblMain (temperature, humidity, pressure) values "; QStringList data; QStringList list = input.split("\n"); for (int i = 0; i < list.size(); ++i) { - output += "("; - data=list[i].split(","); - for (int j = 1; j < data.size(); ++j) { bool valid; output.append(QString::number(data[j].toInt(&valid, 16))); @@ -35,11 +32,11 @@ void HandleMessage::ParseToSQL(QString input) } output.append(")"); - if (i+1 < list.size()){ output.append(","); } } + printf("%s\n", output.toStdString().c_str()); queryInsertData.exec(output); } -- cgit v1.2.3