Android Question code 14 SQLITE_CANTOPEN

Discussion in 'Android Questions' started by b2mvga, Jun 26, 2019.

  1. b2mvga

    b2mvga Member Licensed User

    Hi

    I have a backup recovery routine, I unzip one zip file (containing the .DB database) and put this database in DirInternal folder.

    Code:
    Sub DescompactaZip
        
    Dim zipa As ABZipUnzip
        
    If File.Exists(File.DirRootExternal & "/mgmobile/backup",NomeBanco) = True Then
            zipa.ABUnzip(
    File.DirRootExternal & "/mgmobile/backup/" & NomeBanco,File.DirRootExternal & "/mgmobile/backup")
            
    If File.Exists(File.DirRootExternal & "/mgmobile/backup","vemovel.db") = True Then
                SQL1.Close
                
    File.Copy(File.DirRootExternal & "/mgmobile/backup","vemovel.db",File.DirInternal,"vemovel.db")
                
    Msgbox("Backup Restaurado com sucesso","OK")
                
    ExitApplication
            
    Else
                
    Msgbox("Arquivo vemovel.db não localizado na pasta backup","Atenção")
            
    End If
        
    Else
            
    Msgbox("Não foi encontrado nenhum zip de backup na unidade externa, verifique","Não realizado")
        
    End If
    End Sub
    In 99% of devices works fine... in some devices (Like Motorola Moto X4, Motorola G7 Plus) I can´t recover backup... the routines work without error (the vemovel.db file is unziped on File.DirRootExternal & "/mgmobile/backup" folder normally, after copy vemovel.db file to DirIternal the app I close app with ExitApplication and when I reopen app I receive the message: code 14 SQLITE_CANTOPEN

    The same backup restored on any samsung, LG, etc works fine...

    I only receive this message in some Motorolas

    My app is API=22

    Any help please?

    [​IMG]

    [​IMG]
     
    Last edited: Jun 26, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please upload a smaller image and post the error message as text.
     
  3. b2mvga

    b2mvga Member Licensed User

    Sorry Erel, next time I put smaller image and erros as text.

    I solve motorola problem, In Main program after try open vemovel.db file (with sqlite error), I recover backup again before any initialize and works

    My code in MAIN Before:

    Code:
    If SQL1.IsInitialized = False Then
                SQL1.Initialize(
    File.DirInternal, "vemovel.db"False)
    My code in MAIN now:

    Code:
    If SQL1.IsInitialized = False Then
            
    Try
                SQL1.Initialize(
    File.DirInternal, "vemovel.db"False)
            
    Catch
                
    If File.Exists(File.DirRootExternal & "/mgmobile/backup","vemovel.db") = True Then
                    
    File.Copy(File.DirRootExternal & "/mgmobile/backup","vemovel.db",File.DirInternal,"vemovel.db")
                    SQL1.Initialize(
    File.DirInternal, "vemovel.db"False)
                
    End If
            
    End Try
        
    End If
     
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