aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/HandleMessage.cpp7
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);
}