Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 3 Jahren, 7 Monaten
Letzter Beitrag:
vor 3 Jahren, 7 Monaten
Beteiligte Autoren:
Yogi Yang, Arie, ccc2

Need Advise WM17 - Best way Import Data from file

Startbeitrag von Yogi Yang am 07.11.2014 14:28

In a mobile app that I am building the data that is required is very large around 189 MB after compression.

As the size of the data is big if we embed this data in apk the size of the apk goes above the largest allowed apk size in Android.

So the only way we can go is to supply the data separate to client and then give facility in the app to import data from file.

I want to know what is the best way to achieve this in WM17 generated Android app?

I am using the default DB (SQLite).

Is it possible to replace DB file directly by copying it to appropriate location (which I don't know at the moment) or have to try something else?

TIA

Yogi Yang

Antworten:

Yogi,

Quote
Is it possible to replace DB file directly by copying it to appropriate location (which I don't know at the moment) or have to try something else?



Yes you can. Just copy it to the fDataDir().

You can use WD/WB to create the sqlite database. Use hNativeAccessSQLite as a connection parameter, just like you would open Oracle of MYSQL or whatever database.
In fact I'm doing so in one of my projects using a WB server.
Because importing thousand of record turned out to be VERY slow on the device. Mainly because WM17 did not support transactions very well. As a result EVERY HAdd was wrapped in a transaction and that is very very slow. Maybe WM19 wil do better?

von Arie - am 07.11.2014 15:19
Arie,

Thanks for your inputs.

I was under the impression that as soon as the App starts the database it is accessing will get locked at operating system level so accessing/replacing the database file would not be possible.

TIA

Yogi Yang

von Yogi Yang - am 08.11.2014 14:05
Yogi,
We replace the database every day on dozens of devices.
Simplified:


HClose()
HCloseCOnnection(myConnection)

sDatabase is string = "yogi.db"
HTTPRequest("www.somesite.com/yogi.db")
s is string= fSaveBuffer(sDatabasse, m_sData)

HDescribeConnection(myConnection,"","",sDatabase,"",hAccessSQLiteAndroid,hOReadWrite)
HOpenConnection(myConnection)

You have to use HClose() and HCloseCOnnection before, maybe that helps?

von Arie - am 09.11.2014 09:12
in some device you may not allow to direct replace file , and if internet connection is not possible , you can use usb thumbdrive .

open files in thumbdrive (as you open file in folder) and read each records and update to your local sqlite .

i use this method to transfer data in hfsql classic to sqlite

von ccc2 - am 10.11.2014 08:21
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.