PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Need Advise WM17 - Best way Import Data from file
Need Advise WM17 - Best way Import Data from file
Iniciado por guest, 07,nov. 2014 15:28 - 4 respuestas
Publicado el 07,noviembre 2014 - 15: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
Publicado el 07,noviembre 2014 - 16:19
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?
Publicado el 08,noviembre 2014 - 15:05
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
Publicado el 09,noviembre 2014 - 10:12
Yogi,
We replace the database every day on dozens of devices.
Simplified:


HClose()
HCloseCOnnection(myConnection)

sDatabase is string = "yogi.db"
HTTPRequest("<a class="ExternalLink" rel="nofollow" target="_blank" href="http://www.somesite.com/yogi.db">www.somesite.com/yogi.db</a>")
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?
Publicado el 10,noviembre 2014 - 09:21
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