[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gb.db2 Connection problem & Fix


Le 19/11/2026 à 08:31, Denis Crowther a écrit :
courtesy of ChatGPT.

----------
Connection.Timeout is ignored by gb.db2.sqlite3 in 3.20.4. The same code path is present in 3.22.0. With Connection.Timeout = -1 set before Open(), a locked write still retries for about 120 seconds because the driver's timeout stays at 0.

In gambas-3.22.0/main/comp/gb.db2/.src/Connection.class, add the middle line in Open()

   _Driver = hDriver
   hDriver.Timeout = Me.Timeout  '<--- add
   $pHandle = hDriver.Open(Me)


and add this setter so changes also take effect on an open connection:

Private Sub Timeout_Write(Value As Integer)

   $iTimeout = Value
   If $pHandle And If _Driver Then _Driver.Timeout = Value

End
----------

Found by testing a program write with the db being locked by a cli "sqlite> BEGIN IMMEDIATE;"

I wanted an immediate error, never happened.

nb: I have a working temp fix but I haven't tested this Gambas level fix yet.


Thanks!

As usual, the LLM analyze is correct, but the suggested fix is wrong. The actual bug is the driver timeout property that should not exist.

This is why it's very important to tell that you post something generated by an LLM.

It's fixed in the last commit.

Regards,

--
Benoît Minisini.


References:
gb.db2 Connection problem & FixDenis Crowther <denisc@xxxxxxxxxxxxxx>