Closed woblavobla closed 6 years ago
Every statement Firebird executes must be within the scope of a transaction. If, using fb, you execute a statement without first starting a transaction, a transaction is implicitly started and automatically committed.
The README contains examples of explicit transaction usage.
@rowland Okay, i got it. But in what direction should i look, to change default behavior to start Transaction with select in READ_ONLY?
I think you want to just do conn.transaction('READ ONLY'), not forgetting to commit eventually. Making all implicitly-started transactions read only would break things.
@rowland i want to make all implicitly-started select transactions read only. Because if db have forced_write flag true, it will perform writes to db on each select.
It might be possible, but it would take redesigning the library. Feel free to fork it. Might be easier to just start read-only transactions though.
On Mar 5, 2017, at 12:22, Andrey Lobanov notifications@github.com wrote:
@rowland i want to make all implicitly-started select transactions read only. Because if db have forced_write flag true, it will perform writes to db on each select.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@rowland As i can see we can't determine type of statement before it is prepared. But to prepare statement we should start transaction. Any ideas?
I really don't know what problem you're trying to solve.
On Thu, Mar 9, 2017 at 4:35 AM, Andrey Lobanov notifications@github.com wrote:
@rowland https://github.com/rowland As i can see we can't determine type of statement before it is prepared. But to prepare statement we should start transaction. Any ideas?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rowland/fb/issues/54#issuecomment-285339877, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAWwILAKsXoMTKdfkCg0ULXTSKONxZ5ks5rj_IngaJpZM4MRBZ4 .
-- Brent Rowland
@rowland The main idea is to all implicitly started transactions(with select statements) made read only.
After every select commit transaction is called. Why is that? And how to turn this feature off?
`Statement 395766:
SELECT * FROM PROJECTS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLAN (PROJECTS NATURAL)
2017-03-02T16:55:15.2890 (2124:00000000015FA0B8) COMMIT_TRANSACTION E:\WORK\TRUNKDB\RED2MINE.FDB (ATT_46229, SYSDBA:NONE, UTF8, TCPv4:127.0.0.1) C:\Ruby23\bin\ruby.exe:4124 (TRA_304960647, CONCURRENCY | WAIT | READ_WRITE) 0 ms, 1 read(s), 1 write(s), 1 fetch(es), 1 mark(s)
2017-03-02T16:55:37.1870 (2124:00000000015FA0B8) START_TRANSACTION E:\WORK\TRUNKDB\RED2MINE.FDB (ATT_46229, SYSDBA:NONE, UTF8, TCPv4:127.0.0.1) C:\Ruby23\bin\ruby.exe:4124 (TRA_304960648, CONCURRENCY | WAIT | READ_WRITE)
2017-03-02T16:55:37.1920 (2124:00000000015FA0B8) PREPARE_STATEMENT E:\WORK\TRUNKDB\RED2MINE.FDB (ATT_46229, SYSDBA:NONE, UTF8, TCPv4:127.0.0.1) C:\Ruby23\bin\ruby.exe:4124 (TRA_304960648, CONCURRENCY | WAIT | READ_WRITE) `