aboutsummaryrefslogtreecommitdiff
path: root/client/HandleMessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/HandleMessage.cpp')
-rw-r--r--client/HandleMessage.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/client/HandleMessage.cpp b/client/HandleMessage.cpp
new file mode 100644
index 0000000..f7f14f4
--- /dev/null
+++ b/client/HandleMessage.cpp
@@ -0,0 +1,47 @@
+#include "HandleMessage.h"
+
+
+HandleMessage::HandleMessage(QObject *parent) : QObject(parent)
+{
+
+}
+
+QString HandleMessage::ParseMessage(const QString Msg , int totalRecords )
+{
+ QString message= Msg.section('\n',2,(3+totalRecords));
+
+ return message;
+
+}
+
+void HandleMessage::ParseToSQL(QString input)
+{
+ QSqlQuery queryInsertData;
+ QString output = "INSERT INTO `WSdb`.`tblMain` () VALUES ";
+ QVector<QString> data;
+ QVector<QString> 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)));
+ if (j <= data[j].size()) {
+ output.append(",");
+ }
+
+ }
+ output.append(")");
+
+ if (i+1 < list.size()){
+ output.append(",");
+ }
+ }
+ queryInsertData.exec(output);
+}
+
+
+