iOS Question Using SQLite

Discussion in 'iOS Questions' started by ThePuiu, Jun 25, 2019.

  1. ThePuiu

    ThePuiu Active Member Licensed User

    I'm trying to read records from a a local SQLite database.
    In the simulator goes, but on the iPhone does not, the error message is "Database file not found."

    Someone can help me with a small example ("a good practice guide"), how to check if there is a database or otherwise how to copy it.

    Used code:
    Code:
    If mySQL.IsInitialized = False Then
            mySQL.Initialize(
    File.DirDocuments, "database.db3"False)
        
    End If
    database.db3 file is on Files folder.
    Thank you!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    If File.Exists(File.DirDocuments, "database.db3") = False Then
     
    File.Copy(File.DirAssets, "database.db3"File.DirDocuments, "database.db3")
    End If
    mySQL.Initialize(...)
     
    ThePuiu likes this.
  3. ThePuiu

    ThePuiu Active Member Licensed User

    Also related to this topic ... if the structure or content of the database changed, how to be copied instead of the old one? (without deleting the old one manually)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Sorry but you do need to start a new thread for a new question. Otherwise all threads will become endless discussions about similar topics.
     
Loading...
  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