Since upgrading to 6.80 I have gotten a few "Don't have database lock! crashes
I am looking at my csystemrecord.addupdate code (that hasn't changed in years)
Just wondering if anything changed in 6.80 with SQL
The routine that is being executed is below.
B4X:
Screen Size: X(320) Y(533) Scale:1.5
OSVersion:4.0.4 API:15
java.lang.IllegalStateException: Don't have database lock!
at android.database.sqlite.SQLiteDatabase.verifyLockOwner(SQLiteDatabase.java:2090)
at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:690)
at anywheresoftware.b4a.sql.SQL.EndTransaction(SQL.java:269)
at com.BOBs.BBS.csystemrecord._addupdate(csystemrecord.java:112)
at com.BOBs.BBS.csubscriptions._dosubscriptions(csubscriptions.java:673)
at com.BOBs.BBS.starter._startup_alldone(starter.java:1298)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.hooks.Hooks.java_lang_reflect_Method_VTinvoke(Hooks.java:6451)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:199)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:168)
at anywheresoftware.b4a.keywords.Common.DoEvents(Common.java:388)
at com.BOBs.BBS.cpleasewait._showpleasewait(cpleasewait.java:475)
at com.BOBs.BBS.main._createscreen(main.java:745)
at com.BOBs.BBS.main._activity_resume(main.java:524)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.hooks.Hooks.java_lang_reflect_Method_VTinvoke(Hooks.java:6451)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:163)
at com.BOBs.BBS.main.afterFirstLayout(main.java:109)
at com.BOBs.BBS.main.access$000(main.java:17)
at com.BOBs.BBS.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
java.lang.IllegalStateException: Don't have database lock!
at android.database.sqlite.SQLiteDatabase.verifyLockOwner(SQLiteDatabase.java:2090)
at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:690)
at anywheresoftware.b4a.sql.SQL.EndTransaction(SQL.java:269)
at com.BOBs.BBS.csystemrecord._addupdate(csystemrecord.java:112)
at com.BOBs.BBS.csubscriptions._dosubscriptions(csubscriptions.java:673)
at com.BOBs.BBS.starter._startup_alldone(starter.java:1298)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.hooks.Hooks.java_lang_reflect_Method_VTinvoke(Hooks.java:6451)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:199)
at anywheresoftware.b4a.Msgbox.msgbox(Msgbox.java:138)
at anywheresoftware.b4a.specci48.spdialogs.SPDialogs$Msgbox3.Show(SPDialogs.java:54)
at com.BOBs.BBS.cgenfuncs._msgboxwithreply(cgenfuncs.java:1274)
at com.BOBs.BBS.main._error_msgbox(main.java:1133)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.hooks.Hooks.java_lang_reflect_Method_VTinvoke(Hooks.java:6451)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:199)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:168)
at anywheresoftware.b4a.keywords.Common.DoEvents(Common.java:388)
at com.BOBs.BBS.cpleasewait._showmessage(cpleasewait.java:410)
at com.BOBs.BBS.main._starterprogress(main.java:1788)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.hooks.Hooks.java_lang_reflect_Method_VTinvoke(Hooks.java:6451)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
I am looking at my csystemrecord.addupdate code (that hasn't changed in years)
Just wondering if anything changed in 6.80 with SQL
The routine that is being executed is below.
B4X:
public Sub AddUpdate As Boolean
If mRecordID = 0 Then
cDatabase.SQLDatabase.BeginTransaction
mSQLStatement = "INSERT into " &DEFINE_DB_SystemTableName &" DEFAULT VALUES "
'------------------------------------------------------------------------------------------------------
' Insert the New record
'------------------------------------------------------------------------------------------------------
Try
cDatabase.SQLDatabase.ExecNonQuery(mSQLStatement)
cDatabase.SQLDatabase.TransactionSuccessful
cDatabase.SQLDatabase.EndTransaction
'---------------------------------------------------------------------------------------------------
' Retrieve the RecordID for the last record just Added
'---------------------------------------------------------------------------------------------------
mRecordID = cDatabase.SQLDatabase.ExecQuerySingleResult("SELECT max(RecordID) FROM " &DEFINE_DB_SystemTableName)
' If mPrinterMacAddress.Length = 0 Then
' mPrinterMacAddress = "2C:27:D7:A2:8B:50"
' End If
Catch
#If Debug
Log(LastException.Message)
#End If
CallSubDelayed3("Main", "Error_MsgBox", LastException.Message, "Database Error SystemRecord-001")
cDatabase.SQLDatabase.EndTransaction
Return False
End Try
End If
mSQLStatement = "UPDATE " &DEFINE_DB_SystemTableName &" SET " &DEFINE_DB_TagSystemFlags1 &"=" &mFlags1 &", " _
&DEFINE_DB_TagSystemFlags2 &"=""" &mFlags2 &""", " _
&DEFINE_DB_TagSystemNextDBCount &"=" &mNextDBCount &", " _
&DEFINE_DB_TagSystemPrinterMacAddress &"=""" &mPrinterMacAddress &""", " _
&DEFINE_DB_TagSystemPrinterName &"=""" &mPrinterName &""", " _
&DEFINE_DB_TagSystemLastImportedPath &"=""" &mLastImportedPath &""", " _
&DEFINE_DB_TagSystemPrinterIPAddress &"=""" &mPrinterIPAddress &""", " _
&DEFINE_DB_TagSystemPrinterIPUserID &"=""" &mPrinterIPUserID &""", " _
&DEFINE_DB_TagSystemPrinterIPPwd &"=""" &mPrinterIPPwd &""", " _
&DEFINE_DB_TagSystemPrinterIPPort &"=""" &mPrinterIPPort &""", " _
&DEFINE_DB_TagSystemMacAddress &"=""" &mMacAddress &""", " _
&DEFINE_DB_TagSystemReusePerformed &"=" &mReusePerformed &" " _
&" where " &DEFINE_DB_TagSystemRecordID &"=" &mRecordID
cDatabase.SQLDatabase.BeginTransaction
Try
cDatabase.SQLDatabase.ExecNonQuery(mSQLStatement)
cDatabase.SQLDatabase.TransactionSuccessful
cDatabase.SQLDatabase.EndTransaction
Return True
Catch
#If Debug
Log(LastException.Message)
#End If
CallSubDelayed3("Main", "Error_MsgBox", LastException.Message, "Database Error SystemRecord-002")
cDatabase.SQLDatabase.EndTransaction
Return False
End Try
End Sub