From d9aa870e5d509cc7309ab82dd102a937ab58613a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Thu, 9 Feb 2017 04:36:04 -0500 Subject: Imported Upstream version 3.1.1+dfsg1 --- Plugins/DbAndroid/DbAndroid.pro | 8 ++++-- Plugins/DbAndroid/DbAndroid_de.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_es.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_fr.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_it.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_pl.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_pt_BR.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_ru.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_sk.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/DbAndroid_zh_CN.ts | 35 ++++++++++++++---------- Plugins/DbAndroid/adbmanager.cpp | 10 ++++++- Plugins/DbAndroid/copy.sh | 5 ++++ Plugins/DbAndroid/dbandroid.qrc | 3 ++ Plugins/DbAndroid/dbandroidconnectionfactory.cpp | 2 +- Plugins/DbAndroid/dbandroidjsonconnection.cpp | 6 ++++ Plugins/DbAndroid/dbandroidshellconnection.cpp | 29 ++++++++++++-------- Plugins/DbAndroid/dbandroidshellconnection.h | 3 +- 17 files changed, 228 insertions(+), 153 deletions(-) create mode 100755 Plugins/DbAndroid/copy.sh (limited to 'Plugins/DbAndroid') diff --git a/Plugins/DbAndroid/DbAndroid.pro b/Plugins/DbAndroid/DbAndroid.pro index e70547f..8c5359c 100644 --- a/Plugins/DbAndroid/DbAndroid.pro +++ b/Plugins/DbAndroid/DbAndroid.pro @@ -6,7 +6,7 @@ QT += widgets network -include($$PWD/../../../sqlitestudio/SQLiteStudio3/plugins.pri) +include($$PWD/../../SQLiteStudio3/plugins.pri) TARGET = DbAndroid TEMPLATE = lib @@ -52,14 +52,16 @@ FORMS += \ RESOURCES += \ dbandroid.qrc -TRANSLATIONS += \ +TRANSLATIONS += DbAndroid_de.ts \ + \ DbAndroid_it.ts\ DbAndroid_zh_CN.ts\ DbAndroid_sk.ts\ - DbAndroid_de.ts\ DbAndroid_ru.ts\ DbAndroid_pt_BR.ts\ DbAndroid_fr.ts\ DbAndroid_es.ts\ DbAndroid_pl.ts + + diff --git a/Plugins/DbAndroid/DbAndroid_de.ts b/Plugins/DbAndroid/DbAndroid_de.ts index d33c59d..8ec593f 100644 --- a/Plugins/DbAndroid/DbAndroid_de.ts +++ b/Plugins/DbAndroid/DbAndroid_de.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_es.ts b/Plugins/DbAndroid/DbAndroid_es.ts index 11a6466..1ec017b 100644 --- a/Plugins/DbAndroid/DbAndroid_es.ts +++ b/Plugins/DbAndroid/DbAndroid_es.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_fr.ts b/Plugins/DbAndroid/DbAndroid_fr.ts index f5b2509..80bc68a 100644 --- a/Plugins/DbAndroid/DbAndroid_fr.ts +++ b/Plugins/DbAndroid/DbAndroid_fr.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_it.ts b/Plugins/DbAndroid/DbAndroid_it.ts index 73f4429..2096f33 100644 --- a/Plugins/DbAndroid/DbAndroid_it.ts +++ b/Plugins/DbAndroid/DbAndroid_it.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_pl.ts b/Plugins/DbAndroid/DbAndroid_pl.ts index f2f781c..63b1d42 100644 --- a/Plugins/DbAndroid/DbAndroid_pl.ts +++ b/Plugins/DbAndroid/DbAndroid_pl.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -102,23 +102,28 @@ Chcesz wybrać inny, czy zostawić go nieskonfigurowanego? Nie można połączyć z %1:%2, ponieważ podano niepoprawne hasło. - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 Błąd podczas analizy odpowiedzi z Androida: %1 - + Generic error from Android: %1 Błąd ogólny z Androida: %1 - - + + Missing 'columns' in response from Android. Brauje 'columns' w odpowiedzi z Androida. - + Response from Android has missing data for column '%1' in row %2. Brakuje danych w kolumnie '%1' w wierszy %2 w odpowiedź z Androida. @@ -290,43 +295,43 @@ Urządzenie Android odmówiło usunięcia, lub było to niemożliwe. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. Nie można połączyć się z urządzeniem %1, ponieważ nie jest ono widoczne dla twojego komputera. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. Nie można połączyć się urządzeniem %1, ponieważ wygląda na to, że aplikacja %2 nie jest zainstalowana na tym urządzeniu. - + Cannot connect to device %1, because the application %2 is not debuggable. Nie można połączyć się urządzeniem %1, ponieważ aplikacja %2 nie debugowalna. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. Nie można połączyć się urządzeniem %1, ponieważ wygląda na to, że polecenie '%2' nie jest dostępne na tym urządzeniu. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Nie można połączyć się urządzeniem %1, ponieważ nie ma prawa dostępu do bazy danych '%2' na tym urządzeniu. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 Nie można połączyć się urządzeniem %1, ponieważ nie ma prawa dostępu do bazy danych '%2' na tym urządzeniu. Szczegóły: %3 - + Cannot get list of databases for application %1. Details: %2 Nie można pobrać listy baz danych dla aplikacji %1. Szczegóły: %2 - - + + Could not execute query on database '%1': %2 Nie można wykonać polecenia na bazie '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_pt_BR.ts b/Plugins/DbAndroid/DbAndroid_pt_BR.ts index 46ce2a9..5c248c3 100644 --- a/Plugins/DbAndroid/DbAndroid_pt_BR.ts +++ b/Plugins/DbAndroid/DbAndroid_pt_BR.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_ru.ts b/Plugins/DbAndroid/DbAndroid_ru.ts index efc50ff..115a72f 100644 --- a/Plugins/DbAndroid/DbAndroid_ru.ts +++ b/Plugins/DbAndroid/DbAndroid_ru.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_sk.ts b/Plugins/DbAndroid/DbAndroid_sk.ts index 4483977..89b0604 100644 --- a/Plugins/DbAndroid/DbAndroid_sk.ts +++ b/Plugins/DbAndroid/DbAndroid_sk.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/DbAndroid_zh_CN.ts b/Plugins/DbAndroid/DbAndroid_zh_CN.ts index 14e84d3..fbe2aa8 100644 --- a/Plugins/DbAndroid/DbAndroid_zh_CN.ts +++ b/Plugins/DbAndroid/DbAndroid_zh_CN.ts @@ -1,6 +1,6 @@ - + DbAndroid @@ -101,23 +101,28 @@ Would you like to select another one, or leave it unconfigured? - + + Unable to execute query on Android device (connection was closed): %1 + + + + Error while parsing response from Android: %1 - + Generic error from Android: %1 - - + + Missing 'columns' in response from Android. - + Response from Android has missing data for column '%1' in row %2. @@ -285,43 +290,43 @@ Android device refused deletion, or it was impossible. DbAndroidShellConnection - + Cannot connect to device %1, because it's not visible to your computer. - + Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device. - + Cannot connect to device %1, because the application %2 is not debuggable. - + Cannot connect to device %1, because '%2' command doesn't seem to be available on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. - + Cannot connect to device %1, because '%2' database cannot be accessed on the device. Details: %3 - + Cannot get list of databases for application %1. Details: %2 - - + + Could not execute query on database '%1': %2 diff --git a/Plugins/DbAndroid/adbmanager.cpp b/Plugins/DbAndroid/adbmanager.cpp index 462e91f..bbcf8fc 100644 --- a/Plugins/DbAndroid/adbmanager.cpp +++ b/Plugins/DbAndroid/adbmanager.cpp @@ -135,12 +135,19 @@ QString AdbManager::findAdb() } #endif + QString fullPath; + for (const QString& path : candidates) + { + fullPath = QDir::cleanPath(path); + if (testAdb(fullPath, true)) + return fullPath; + } + #ifdef Q_OS_WIN32 if (testAdb("adb.exe", true)) return "adb.exe"; static_qstring(winAdbPath, "/../Android/sdk/platform-tools/adb.exe"); - QString fullPath; for (const QString& path : QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation)) { fullPath = QDir::cleanPath(path + winAdbPath); @@ -286,6 +293,7 @@ bool AdbManager::execLongCommand(const QStringList& arguments, QProcess& proc, Q // Take off initial arguments from ADB, store it to use with "push". QStringList primaryArguments; QStringList args = arguments; + while (args.first() != "shell") primaryArguments << args.takeFirst(); diff --git a/Plugins/DbAndroid/copy.sh b/Plugins/DbAndroid/copy.sh new file mode 100755 index 0000000..d3e1a1e --- /dev/null +++ b/Plugins/DbAndroid/copy.sh @@ -0,0 +1,5 @@ +# Just my custom script to make copying fresh jar into DbAndroid faster +# Pawel Salawa + +rm SQLiteStudioRemote.jar +cp /home/googie/projects/AndroidStudioProjects/SQLiteStudioRemoteProject/sqlitestudioremote/build/intermediates/bundles/release/classes.jar SQLiteStudioRemote.jar diff --git a/Plugins/DbAndroid/dbandroid.qrc b/Plugins/DbAndroid/dbandroid.qrc index 4a7cb48..55a667a 100644 --- a/Plugins/DbAndroid/dbandroid.qrc +++ b/Plugins/DbAndroid/dbandroid.qrc @@ -6,3 +6,6 @@ android.png + + + diff --git a/Plugins/DbAndroid/dbandroidconnectionfactory.cpp b/Plugins/DbAndroid/dbandroidconnectionfactory.cpp index 22377b4..e1e59f8 100644 --- a/Plugins/DbAndroid/dbandroidconnectionfactory.cpp +++ b/Plugins/DbAndroid/dbandroidconnectionfactory.cpp @@ -17,7 +17,7 @@ DbAndroidConnection* DbAndroidConnectionFactory::create(const DbAndroidUrl& url, switch (url.getMode()) { case DbAndroidMode::SHELL: - return new DbAndroidShellConnection(plugin, parent); + return new DbAndroidShellConnection(plugin, url.getDevice(), parent); case DbAndroidMode::NETWORK: case DbAndroidMode::USB: return new DbAndroidJsonConnection(plugin, parent); diff --git a/Plugins/DbAndroid/dbandroidjsonconnection.cpp b/Plugins/DbAndroid/dbandroidjsonconnection.cpp index fb8087e..2c0023f 100644 --- a/Plugins/DbAndroid/dbandroidjsonconnection.cpp +++ b/Plugins/DbAndroid/dbandroidjsonconnection.cpp @@ -295,6 +295,12 @@ bool DbAndroidJsonConnection::deleteDatabase(const QString& dbName) DbAndroidConnection::ExecutionResult DbAndroidJsonConnection::executeQuery(const QString& query) { DbAndroidConnection::ExecutionResult executionResults; + if (!isConnected()) + { + executionResults.wasError = true; + executionResults.errorMsg = tr("Unable to execute query on Android device (connection was closed): %1").arg(query); + return executionResults; + } QJsonDocument json = wrapQueryInJson(query); QByteArray responseBytes = send(json.toJson(QJsonDocument::Compact)); diff --git a/Plugins/DbAndroid/dbandroidshellconnection.cpp b/Plugins/DbAndroid/dbandroidshellconnection.cpp index b39c19d..e48416d 100644 --- a/Plugins/DbAndroid/dbandroidshellconnection.cpp +++ b/Plugins/DbAndroid/dbandroidshellconnection.cpp @@ -8,10 +8,11 @@ const CsvFormat DbAndroidShellConnection::CSV_FORMAT = CsvFormat(",", "\r\n", true, true); -DbAndroidShellConnection::DbAndroidShellConnection(DbAndroid* plugin, QObject* parent) : +DbAndroidShellConnection::DbAndroidShellConnection(DbAndroid* plugin, const QString& deviceName, QObject* parent) : DbAndroidConnection(parent), plugin(plugin) { this->adbManager = plugin->getAdbManager(); + this->creationDeviceName = deviceName; connect(adbManager, SIGNAL(deviceListChanged(QStringList)), this, SLOT(checkForDisconnection(QStringList))); } @@ -39,7 +40,7 @@ bool DbAndroidShellConnection::connectToAndroid(const DbAndroidUrl& url) } QString stdOut; - bool res = adbManager->exec(QStringList({"shell", "run-as", url.getApplication(), "ls"}), &stdOut); + bool res = adbManager->exec(QStringList({"-s", url.getDevice(), "shell", "run-as", url.getApplication(), "ls"}), &stdOut); if (!res) { notifyWarn(tr("Cannot connect to device %1, because the application %2 doesn't seem to be installed on the device.").arg(url.getDevice(), url.getApplication())); @@ -58,19 +59,19 @@ bool DbAndroidShellConnection::connectToAndroid(const DbAndroidUrl& url) } // Check if sqlite3 is available - res = adbManager->exec(QStringList({"shell", "run-as", url.getApplication(), "sqlite3", "--version"})); - if (!res) + res = adbManager->exec(QStringList({"-s", url.getDevice(), "shell", "sqlite3", "--version"}), &stdOut); + if (!res || !stdOut.startsWith("3.")) { notifyWarn(tr("Cannot connect to device %1, because '%2' command doesn't seem to be available on the device.").arg(url.getDevice(), "sqlite3")); return false; } // Check if databases directory exists - res = adbManager->exec(QStringList({"shell", "run-as", url.getApplication(), "ls", "databases"})); + res = adbManager->exec(QStringList({"-s", url.getDevice(), "shell", "run-as", url.getApplication(), "ls", "databases"})); if (!res) { // Doesn't exist. Create if possible. - res = adbManager->exec(QStringList({"shell", "run-as", url.getApplication(), "mkdir", "databases"})); + res = adbManager->exec(QStringList({"-s", url.getDevice(), "shell", "run-as", url.getApplication(), "mkdir", "databases"})); if (!res) { notifyWarn(tr("Cannot connect to device %1, because '%2' database cannot be accessed on the device.").arg(url.getDevice(), "sqlite3")); @@ -115,7 +116,7 @@ QStringList DbAndroidShellConnection::getDbList() QMutexLocker lock(&appOkMutex); appOkay = true; QString out; - bool res = adbManager->exec(QStringList({"shell", "run-as", connectionUrl.getApplication(), "ls", "databases"}), &out); + bool res = adbManager->exec(QStringList({"-s", connectionUrl.getDevice(), "shell", "run-as", connectionUrl.getApplication(), "ls", "databases"}), &out); if (!res) return QStringList(); @@ -142,13 +143,18 @@ QStringList DbAndroidShellConnection::getDbList() QStringList DbAndroidShellConnection::getAppList() { QString out; - bool res = adbManager->exec(QStringList({"shell", "pm list packages -3"}), &out); + bool res = adbManager->exec(QStringList({"-s", creationDeviceName, "shell", "pm list packages -3"}), &out); if (!res) return QStringList(); QStringList appList; for (const QString& line : out.trimmed().split("\n", QString::SkipEmptyParts)) + { + if (!line.startsWith("package:")) + continue; // some other message + appList << line.mid(8).trimmed(); // skip "package:" prefix + } return appList; } @@ -161,18 +167,17 @@ bool DbAndroidShellConnection::isAppOkay() const bool DbAndroidShellConnection::deleteDatabase(const QString& dbName) { - return adbManager->exec(QStringList({"shell", "run-as", connectionUrl.getApplication(), "rm", "-f", "databases/" + dbName, "databases/" + dbName + "-journal"})); + return adbManager->exec(QStringList({"-s", connectionUrl.getDevice(), "shell", "run-as", connectionUrl.getApplication(), "rm", "-f", "databases/" + dbName, "databases/" + dbName + "-journal"})); } DbAndroidConnection::ExecutionResult DbAndroidShellConnection::executeQuery(const QString& query) { - const static QStringList stdArguments = QStringList({"shell", "run-as", "", "sqlite3", "-csv", "-separator", ",", "-batch", "-header"}); + const static QStringList stdArguments = QStringList({"-s", connectionUrl.getDevice(), "shell", "run-as", "", "sqlite3", "-csv", "-separator", ",", "-batch", "-header"}); // Prepare usual arguments QStringList args = stdArguments; - args.replace(2, connectionUrl.getApplication()); + args.replace(4, connectionUrl.getApplication()); args << "databases/" + connectionUrl.getDbName(); -// args << "/data/data/" + connectionUrl.getApplication() + "/sqlitestudio_remote.sql"; args << AdbManager::encode(query); // In case of SELECT we want to union typeof() for all columns first, then original query diff --git a/Plugins/DbAndroid/dbandroidshellconnection.h b/Plugins/DbAndroid/dbandroidshellconnection.h index 1c0ae0f..205d9bb 100644 --- a/Plugins/DbAndroid/dbandroidshellconnection.h +++ b/Plugins/DbAndroid/dbandroidshellconnection.h @@ -14,7 +14,7 @@ class DbAndroidShellConnection : public DbAndroidConnection Q_OBJECT public: - DbAndroidShellConnection(DbAndroid* plugin, QObject *parent = 0); + DbAndroidShellConnection(DbAndroid* plugin, const QString &deviceName, QObject *parent = 0); ~DbAndroidShellConnection(); bool connectToAndroid(const DbAndroidUrl& url); @@ -49,6 +49,7 @@ class DbAndroidShellConnection : public DbAndroidConnection DbAndroidUrl connectionUrl; bool appOkay = false; mutable QMutex appOkMutex; + QString creationDeviceName; static const CsvFormat CSV_FORMAT; -- cgit v1.2.3