Opinions on how to Integrate Transactions
От | APseudoUtopia |
---|---|
Тема | Opinions on how to Integrate Transactions |
Дата | |
Msg-id | 27ade5280906140814o4b9d89b6p7e53c55b3a5bd2e@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Opinions on how to Integrate Transactions
Re: Opinions on how to Integrate Transactions |
Список | pgsql-general |
Hey, I'm new to using transactions. I'd like to integrate them into my PHP application to prevent a few issues we've been having. Such as, some queries in the beginning of the php script running, then an error occurring, preventing queries toward the bottom of the script from running. It's leaving me with things such as a forum topic without any associated forum posts. From what I've read on transactions, they would be the solution to my problems. So I have a couple questions about them. 1. Is there a way to list active transactions on all databases? I'd like a way to see if there are any "idle" transactions that are just hanging there. Is there a way to "kill" them from the console? 2. I have a PHP class which communicates with the DB, which is included into every other page on the site. Should I just add BEGIN and COMMIT at the beginning and end of the class? This way, I wont need to edit every single page on my site to include BEGIN and COMMIT? Or will that type of "blind" transactions cause problems? 3. What happens when there IS an error? Do I need to run ROLLBACK every time? Or will it automatically reset when the connection is closed when the PHP script dies? Thanks for the advice.
В списке pgsql-general по дате отправления: