aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-30 20:35:28 +0100
committerlonkaars <loek@pipeframe.xyz>2022-10-30 20:35:28 +0100
commitf10fe5ad6bc561f05fcace7bb278e2a50c906208 (patch)
tree29a9a118710b798a582a06bea9c7ec29e5afdb0a
parentea9463c3ba9335bc3d04dd04502ab9e67e8a718c (diff)
use qt built-in trailing newline split solution
-rw-r--r--client/HandleMessage.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/client/HandleMessage.cpp b/client/HandleMessage.cpp
index 84f561b..d719157 100644
--- a/client/HandleMessage.cpp
+++ b/client/HandleMessage.cpp
@@ -24,9 +24,8 @@ void HandleMessage::ParseToSQL(QString input) {
QSqlQuery queryInsertData;
QString output = "INSERT INTO `tblMain` (`temperature`, `humidity`, `pressure`) VALUES ";
QStringList data;
- QStringList list = input.split("\n");
+ QStringList list = input.split("\n",Qt::SkipEmptyParts);
for (int i = 0; i < list.size(); ++i) {
- if (list[i].size() == 0) continue;
data=list[i].split(",");
bool valid;
@@ -44,5 +43,3 @@ void HandleMessage::ParseToSQL(QString input) {
queryInsertData.exec(output);
}
-
-