aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/DbAndroid/dbandroidshellconnection.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:41 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:41 -0500
commit8e640722c62692818ab840d50b3758f89a41a54e (patch)
tree38197eb1688a5afc338081ea17e15f938976e422 /Plugins/DbAndroid/dbandroidshellconnection.h
parent9618f0ebbf4b88045247c01ce8c8f58203508ebf (diff)
Imported Upstream version 3.0.7upstream/3.0.7
Diffstat (limited to 'Plugins/DbAndroid/dbandroidshellconnection.h')
-rw-r--r--Plugins/DbAndroid/dbandroidshellconnection.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/Plugins/DbAndroid/dbandroidshellconnection.h b/Plugins/DbAndroid/dbandroidshellconnection.h
new file mode 100644
index 0000000..1c0ae0f
--- /dev/null
+++ b/Plugins/DbAndroid/dbandroidshellconnection.h
@@ -0,0 +1,59 @@
+#ifndef DBANDROIDSHELLCONNECTION_H
+#define DBANDROIDSHELLCONNECTION_H
+
+#include "dbandroidconnection.h"
+#include "csvformat.h"
+
+#include <QMutex>
+
+class DbAndroid;
+class AdbManager;
+
+class DbAndroidShellConnection : public DbAndroidConnection
+{
+ Q_OBJECT
+
+ public:
+ DbAndroidShellConnection(DbAndroid* plugin, QObject *parent = 0);
+ ~DbAndroidShellConnection();
+
+ bool connectToAndroid(const DbAndroidUrl& url);
+ void disconnectFromAndroid();
+ bool isConnected() const;
+ QString getDbName() const;
+ QStringList getDbList();
+ QStringList getAppList();
+ bool isAppOkay() const;
+ bool deleteDatabase(const QString& dbName);
+ ExecutionResult executeQuery(const QString& query);
+
+ private:
+ enum class DataType
+ {
+ UNKNOWN = -1,
+ _NULL = 0,
+ INTEGER = 1,
+ REAL = 2,
+ TEXT = 3,
+ BLOB = 4
+ };
+
+ QStringList findColumns(const QStringList& originalArgs, const QString& query);
+ QString appendTypeQueryPart(const QString& query, const QStringList& columnNames);
+ void extractResultData(const QList<QList<QByteArray> >& deserialized, bool firstHalfForTypes, ExecutionResult& results);
+ QVariant valueFromString(const QByteArray& bytes, const QByteArray& type);
+
+ DbAndroid* plugin = nullptr;
+ AdbManager* adbManager = nullptr;
+ bool connected = false;
+ DbAndroidUrl connectionUrl;
+ bool appOkay = false;
+ mutable QMutex appOkMutex;
+
+ static const CsvFormat CSV_FORMAT;
+
+ private slots:
+ void checkForDisconnection(const QStringList& devices);
+};
+
+#endif // DBANDROIDSHELLCONNECTION_H