iOS Question read-only sqlite db: does it still need to be copied out to documents

Discussion in 'iOS Questions' started by MikeS, Jan 17, 2015.

  1. MikeS

    MikeS Member

    Hello. I am evaluating, and I understand it's needed to copy out sqlite db file from DirAssets file to DirDocuments folder prior to initialization. I can understand why that's needed for writeable db file, but for a read-only file, is it still necessary (i.e. can the file be opened/initialised within the DirAssets)? I ask since it's possible in objectiveC to open a read-only database in an application’s bundle. As I have a rather large db, so I want to avoid duplicating this file if possible. Thanks.
  2. Erel

    Erel Administrator Staff Member Licensed User

    You only need to copy it once so the impact of this should be quite minor. Currently the SQL library will throw an error if you try to open a database from the assets folder. It is possible to use NativeObject to workaround this check.
  3. MikeS

    MikeS Member

    Thanks. I understand the impact is minor (e.g. startup speed) but if I have a reasonably large db file of 5Mb, then the user will have another 5Mb consumed. It seems a little inefficient or redundant if there is a way around it. I guess on iOS maybe the user may not easily see this inefficiency, but I am concerned on Android where the user can easily see resource usage, and view the app unfavourably. When you mention about the check workaround, do you mean it's possible to use a NativeObject to perform the db open and pass a db handle back to the B4i environment?
    Last edited: Jan 18, 2015
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice