diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-30 14:40:34 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-30 14:40:34 +0100 |
commit | a2f62610144d1ba496ece3946a1e64fe8d6e0f9c (patch) | |
tree | 6b44a790030765ef09d15a697e7e24420cc62f1b /client/HandleMessage.cpp | |
parent | e892ee5639d0f538740e4f1d51284ec27039e270 (diff) |
WIP fix HandleMessage
Diffstat (limited to 'client/HandleMessage.cpp')
-rw-r--r-- | client/HandleMessage.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
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); } |