Discussion:
interbase select transaction
(too old to reply)
humanista (mruczus)
2008-01-10 08:52:54 UTC
Permalink
Can interbase select transaction (just reading data) fail? Why? I need to
know if I should use a try except for a select.
Craig Stuntz [TeamB]
2008-01-10 13:01:26 UTC
Permalink
Sure it can fail. You can pass bad SQL, for example, or try to read
something your DB user account doesn't have permission to read.

That said, I don't see why you'd use try/except. Instead, use
try/finally to commit the transaction whether or not the SELECT fails.
There is no need to "roll back" a SELECT, since it doesn't modify data.*

* Selectable stored procs can modify data, but I don't think that's
what you're asking about.
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio González has a new CD of
Irish music out, and it's good: http://tinyurl.com/7hgfr
humanista (mruczus)
2008-01-10 21:02:35 UTC
Permalink
If I do not use a transaction explicitly for a select, is it not commited
and could there be troubles out of that?
Craig Stuntz [TeamB]
2008-01-10 20:30:22 UTC
Permalink
Post by humanista (mruczus)
If I do not use a transaction explicitly for a select, is it not
commited and could there be troubles out of that?
dbExpress should eventually take care of it for you, but it's a good
idea to use performance monitoring to make sure that is in fact the
case.
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
http://qc.borland.com -- Vote for important issues
Selmar
2008-01-10 16:36:21 UTC
Permalink
I not use select transaction.
I use:
IF (Query.Transaction.Active = TRUE) THEN
Query.Transaction.Commit;
Query.Active:= FALSE;
Query.SQL.Clear;
Query.SQL.ADD('SELECT * FROM ...');
Query.Active:= TRUE;
IF (Query.Fields.Fields[0].IsNULL = FALSE) THEN
BEGIN

END
ELSE
BEGIN

END;
Query.Active:= false;
Query.SQL.Clear;
Or you can user a transaction in the procedure of the interbase. Hope this
helps.
Craig Stuntz [TeamB]
2008-01-10 15:47:30 UTC
Permalink
Post by Selmar
I not use select transaction.
Yes you do. You just don't know it. Nothing can be done in IB without
a transaction. Even a SELECT.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Please read and follow Borland's rules for the user of their
server: http://support.borland.com/entry.jspa?externalID=293
Tiedo Kruisselbrink
2008-01-11 07:01:54 UTC
Permalink
Post by Craig Stuntz [TeamB]
Post by Selmar
I not use select transaction.
Yes you do. You just don't know it. Nothing can be done in IB without
a transaction. Even a SELECT.
Do you mean DBX adds "START TRANSACTION" and "COMMIT" if I don't?
Then I am afraid DBX does this sometimes wrong, when using MS-SQL: I
occasionally get error messages, telling me that I am starting multiple
transactions, when I am sure I don't.

Where can I learn more about this?

Thanks,
Tiedo
--
Craig Stuntz [TeamB]
2008-01-11 12:52:14 UTC
Permalink
Post by Tiedo Kruisselbrink
Do you mean DBX adds "START TRANSACTION" and "COMMIT" if I don't?
More or less, yes. You can use the TSQLMonitor component to watch the
transactions come and go.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
http://qc.borland.com -- Vote for important issues
Loading...