]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
add insert-sql-android.sh (convenient way to add SQL data into android
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Fri, 27 Dec 2013 13:06:40 +0000 (14:06 +0100)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Fri, 27 Dec 2013 13:06:40 +0000 (14:06 +0100)
DB)

insert-sql-android.sh [new file with mode: 0755]
mainwindow.cpp
set-android-db.sh
ui.sql

diff --git a/insert-sql-android.sh b/insert-sql-android.sh
new file mode 100755 (executable)
index 0000000..82dd894
--- /dev/null
@@ -0,0 +1,11 @@
+export DB=/data/data/eu.nothing2do.diary-mobile/files/db
+adb pull $DB
+echo "$DB file retreived"
+cat $1|sqlite3 db
+echo "db file populated"
+adb push db /storage/sdcard1
+echo "file db copied to /storage/sdcard1"
+adb shell su -c mv /storage/sdcard1/db $DB
+echo "file mv'ed to the right place"
+adb shell su -c chown u0_a12:u0_a12 $DB
+echo "file chown'ed"
index cd460d62a0e66400b53502e992e9c71d98c652e0..44c6e8fb89a014ff7dc19007525cdb44fc041e63 100644 (file)
@@ -130,7 +130,7 @@ CLabel* MainWindow::addWidget(const QString &key, CLabel * a){
     signalmap->setMapping(a, key);
     return a;
 }
-void MainWindow::action(const QString & a){
+void MainWindow::action(const QString &a){
     qDebug()<<"action("<<a<<")";
 
     flush();
index bce6d81ffecec1d848f184b30b728c31e0e43e4c..1251a3c962173298fc0341a4b79434ef436aa64c 100755 (executable)
@@ -1,2 +1,7 @@
-echo '.read ui.sql'|sqlite3 db
+cat $1|sqlite3 db
 adb push db /sdcard/db
+echo "file db copied to /sdcard/db"
+adb shell su -c mv /sdcard/db /data/data/eu.nothing2do.eu-diarymobile
+echo "file mv'ed to the right place"
+adb shell su -c chown u0_a12:u0_a12 /data/data/eu.nothing2do.diarymobile/files/db
+echo "file chown'ed"
diff --git a/ui.sql b/ui.sql
index 7f3e7cbfbae3bd1c60952b6163c044b2fb945e9c..fc44ef955bbf0e6b5d2b922eac4ecd5a9cf09708 100644 (file)
--- a/ui.sql
+++ b/ui.sql
@@ -23,9 +23,9 @@ INSERT INTO "ui" (keyword, label, action) VALUES('config','max column','setint m
 INSERT INTO "ui" (keyword, label, action) VALUES('config','host','settext host 127.0.0.1');
 INSERT INTO "ui" (keyword, label, action) VALUES('config','port','setint port port 5432');
 INSERT INTO "ui" (keyword, label, action) VALUES('config','user','settext user root');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','password','settext pass 123456789');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','database','settext db database');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','filesave','setfile file');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','password','settext pass');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','database','settext db');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','filesave','settext file');
 INSERT INTO "ui" (keyword, label, action) VALUES('config','SQLsettings', 'settext SQLsettings requiressl=1 connect_timeout=10000');
 INSERT INTO "ui" (keyword, label, action) VALUES('config','button', 'settext button background-color: red;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;');
 INSERT INTO "ui" (keyword, label, action) VALUES('config','fichier SQL', 'setfile sqlfile ui.sql');