iOS Question VACUUM sqlite

yiankos1

Well-Known Member
Licensed User
Longtime User
Hello my friends,
I copy paste my b4a to b4i but i get an error at iOS. The problem is that iSQL does not have SQL2.EndTransaction like B4A.

Code:
B4X:
Sub clvSaved_ItemLongClick (Index As Int, Value As Object)
   
    Log(Value & " LongClicked!")
    Msgbox2("Msg", "Do you want to delete this question", "", Array ("Yes", "No"))
    Wait For Msg_Click (ButtonText As String)
    If ButtonText = "Yes" Then
       
        SQL2.ExecNonQuery2("DELETE FROM table1 WHERE ROWID = ?", Array As Int(Index))
        SQL2.ExecNonQuery("VACUUM")
        clvSaved.RemoveAt(Index)  
        If SQL2.ExecQuerySingleResult("SELECT COUNT(ROWID) FROM table1")=0 Then
            lblNoSaved.Visible=True
        End If
    End If
End Sub

Error:
B4X:
Error calling sqlite3_step (1: cannot VACUUM from within a transaction) SQLITE_ERROR
DB Query: VACUUM
Unknown error finalizing or resetting statement (1: cannot VACUUM from within a transaction)
DB Query: VACUUM
Error occurred on line: 1089 (Main)
ExecNonQuery error: cannot VACUUM from within a transaction
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  result               -[B4ISQL ExecNonQueryInsideTransaction::] + 628
  result               -[B4ISQL ExecNonQuery2::] + 140
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
  result               -[B4IShell runVoidMethod] + 232
  result               -[B4IShell raiseEventImpl:method:args::] + 1792
 result               -[B4IShellBI raiseEvent:event:params:] + 1372
 result               -[B4IDebugResumableSub resume::] + 356
 result               -[B4I checkAndRunWaitForEvent:event:params:] + 552
 result               -[B4IShellBI raiseEvent:event:params:] + 1228
 result               __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
 libdispatch.dylib    <redacted> + 24
 
Last edited:

yiankos1

Well-Known Member
Licensed User
Longtime User
The only way that i can achieve "VACUUM" at iOS is through a workaround:
B4X:
DBUtils.ExecuteMap(SQL2,"VACUUM",Array As String(""))
I think iSQL has a BUG about ending a transaction, because "VACUUM" sees that there is always an open transaction.
 
Upvote 0
Top