aboutsummaryrefslogtreecommitdiff
path: root/client/HandleMessage.cpp
blob: a6b9ce4d8e5ecbe4f3c2530296952fe92cdbad94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "HandleMessage.h"

HandleMessage::HandleMessage(QObject *parent) : QObject(parent) { }

void HandleMessage::ParseToSQL(QString input) {
	QSqlQuery queryInsertData;
	QString output = "insert into WSdb.tblMain (temperature, humidity, pressure) values ";
	QStringList data;

	output.append("(");
	data=input.split(",");

	for (int i = 1; i < data.size(); i++) {
		bool valid;
		output.append(QString::number(data[i].toInt(&valid, 16)));
		if (i + 1 < data.size()) output.append(",");
	}

	output.append(")");

	queryInsertData.exec(output);
}