mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-05-22 20:38:21 +00:00
This fixes an issue where embedded replica based connections would have issues dispatching executes on deferred statements. This is due to sqld using `sqlite3_txn_state` to return the connection's state. While this works for other transactions, in a deferred transaction the connection does not change its state to be in a transaction. This is due to the nature of a deferred transaction. The problem is that the connection does set `is_autocommit` to `false`. This means that sqld is returning that it is not in a txn state which is used by clients to set its `is_autocommit` state. For now the work around is to track when the client is in a `DEFERRED` transaction and to handle remote state transition's in such a way that it ignores the value from the server if it is currently in the deferred state.