Thanks Chris, Armeen.
More updates:
1. SQLite database is used in a single user mode. Only one connection is made from Powerbuilder. Hope PB doesn't make any hidden connections.
2. Database is in local drive only and NOT in any network drive.
3. Connection using DSN-Less connection
My connection parameters are
SQLCA.DBMS="ODBC"
SQLCA.DBParm="ConnectString='Driver=SQLite3 ODBC Driver;Database=E:\PowerBuilder 2022\V6.0.0 (64 bit)\BaseCommon\Data\one.db;FKSupport=True;AttachAs=public'"
SQLCA.Lock="RC"
Save Event
SQLCA.AutoCommit = False
ll_rc = Event ue_saveprocess_update()
If ll_rc = 1 Then
SQLCA.of_commit()
Event ue_saveprocess_reset()
Else
SQLCA.of_rollback()
OpenWithParm(w_display_error, io_dberror_data)
End If
SQLCA.AutoCommit = True
Event ue_saveprocess_update
/* Event ue_saveprocess_update */
Long ll_rc
ll_rc = dw_entry.Update(True, False)
If (ll_rc <> 1 And ib_dberror = False) Then // For dbError = True, Error captured at DBError Event which should not be overwritten here
PopulateError(999, "notused")
io_dberror_data.of_set( "MessageType", "Error")
io_dberror_data.of_set( "Error Line", String ( Error.Line ))
io_dberror_data.of_set( "Error Object", Error.Object)
io_dberror_data.of_set( "Error Event", Error.objectevent)
io_dberror_data.of_set( "Child Object", is_child_object)
io_dberror_data.of_set( "Error Message", 'Save Failed in Entry DW')
Return ll_rc
ElseIf ib_dberror = True Then
Return -1
End If
If is_tab_dw_update[1] = 'Y' Then
ll_rc = tab_1.tabpage_1.dw_1.Update(True, False)
If (ll_rc <> 1 And ib_dberror = False) Then
PopulateError(999, "notused")
io_dberror_data.of_set( "MessageType", "Error")
io_dberror_data.of_set( "Error Line", String ( Error.Line ))
io_dberror_data.of_set( "Error Object", Error.Object)
io_dberror_data.of_set( "Error Event", Error.objectevent)
io_dberror_data.of_set( "Child Object", is_child_object)
io_dberror_data.of_set( "Error Message", 'Save Failed in Tabpage_1 DW_1')
Return ll_rc
ElseIf ib_dberror = True Then
Return -1
End If
End If
If is_tab_dw_update[2] = 'Y' Then
ll_rc = tab_1.tabpage_2.dw_2.Update(True, False)
If (ll_rc <> 1 And ib_dberror = False) Then
PopulateError(999, "notused")
io_dberror_data.of_set( "MessageType", "Error")
io_dberror_data.of_set( "Error Line", String ( Error.Line ))
io_dberror_data.of_set( "Error Object", Error.Object)
io_dberror_data.of_set( "Error Event", Error.objectevent)
io_dberror_data.of_set( "Child Object", is_child_object)
io_dberror_data.of_set( "Error Message", 'Save Failed in Tabpage_2 DW_2')
Return ll_rc
ElseIf ib_dberror = True Then
Return -1
End If
End If
If is_tab_dw_update[3] = 'Y' Then
ll_rc = tab_1.tabpage_3.dw_3.Update(True, False)
If (ll_rc <> 1 And ib_dberror = False) Then
PopulateError(999, "notused")
io_dberror_data.of_set( "MessageType", "Error")
io_dberror_data.of_set( "Error Line", String ( Error.Line ))
io_dberror_data.of_set( "Error Object", Error.Object)
io_dberror_data.of_set( "Error Event", Error.objectevent)
io_dberror_data.of_set( "Child Object", is_child_object)
io_dberror_data.of_set( "Error Message", 'Save Failed in Tabpage_3 DW_3')
Return ll_rc
ElseIf ib_dberror = True Then
Return -1
End If
End If
If is_tab_dw_update[4] = 'Y' Then
ll_rc = tab_1.tabpage_4.dw_4.Update(True, False)
If (ll_rc <> 1 And ib_dberror = False) Then
PopulateError(999, "notused")
io_dberror_data.of_set( "MessageType", "Error")
io_dberror_data.of_set( "Error Line", String ( Error.Line ))
io_dberror_data.of_set( "Error Object", Error.Object)
io_dberror_data.of_set( "Error Event", Error.objectevent)
io_dberror_data.of_set( "Child Object", is_child_object)
io_dberror_data.of_set( "Error Message", 'Save Failed in Tabpage_4 DW_4')
Return ll_rc
ElseIf ib_dberror = True Then
Return -1
End If
End If
If is_tab_dw_update[5] = 'Y' Then
ll_rc = tab_1.tabpage_5.dw_5.Update(True, False)
If (ll_rc <> 1 And ib_dberror = False) Then
PopulateError(999, "notused")
io_dberror_data.of_set( "MessageType", "Error")
io_dberror_data.of_set( "Error Line", String ( Error.Line ))
io_dberror_data.of_set( "Error Object", Error.Object)
io_dberror_data.of_set( "Error Event", Error.objectevent)
io_dberror_data.of_set( "Child Object", is_child_object)
io_dberror_data.of_set( "Error Message", 'Save Failed in Tabpage_5 DW_5')
Return ll_rc
ElseIf ib_dberror = True Then
Return -1
End If
End If
Return 1
Control goes into infinite loop, when it updates the second dw/ds.
If we run as such, the second update tab_1.tabpage_1.dw_1.update(True, False) goes into infinite loop.
If we comment out the first dw update, then the third update tab_1.tabpage_2.dw_2.update(True, False) goes into infinite loop.
Works well, if we comment out the begin transaction / commit / rollback statements
//SQLCA.AutoCommit = False
ll_rc = Event ue_saveprocess_update()
If ll_rc = 1 Then
//SQLCA.of_commit()
Event ue_saveprocess_reset()
Else
//SQLCA.of_rollback()
OpenWithParm(w_display_error, io_dberror_data)
End If
//SQLCA.AutoCommit = True
May be some issues is in the locking mechanism? A file with -journal suffix is created when in the database file folder when db transactions are enabled.
Things became more confusing:
Another window with 3 datawindows [ 3 different tables] gets updated without any issues with database transactions enabled. Here also a file with -journal suffix is created, and it got deleted at the end of the transaction [ ie on Commit ].
Happiness Always
BKR Sivaprakash
As Chris says, PB app might be waiting for SQLite to finish its work, which never gets completed. Let me check with 'Trace' Miguel.
What I would recommend is - if possible - "somehow" disconnect your connection with the DB when the process never seems to finish, so that you can see what the last SQL statement was in your trace log. Maybe a tool like DBeaver could help out to see what SQL is running. I'm not familiar with SQLite, so I don't know what tools are available to trace in different ways.
The last SQL Statement was an insert statement [ sqlpreview event & debugger ]. When I stepin in debugger, the last statement executed was dw_2.update which fires sqlpreview event that displays the sql statement.
It works well when I comment out the autocommit statement.