|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-03 17:08 UTC] bouchon at alussinan dot org
Description: ------------ Hello, I would like to propose to add a short explanation inside the documentation of the pg_query function, about transactions : ## Note that the pg_query() function can also take several queries embeded inside one transaction block. Example : $SQLQuery = 'BEGIN;'; $SQLQuery.= 'INSERT INTO a (a,b) VALUES (1,2);'; $SQLQuery.= 'INSERT INTO b (ref_b,c) VALUES (2,5);'; $SQLQuery.= 'COMMIT;'; $HandleResults = pg_query($SQLQuery); The essential point of a transaction is that it bundles multiple steps into a single, all-or-nothing operation. You can get more informations about transaction on http://www.postgresql.org/docs/8.0/interactive/tutorial-transactions.html ## I think that this feature should be mentionned inside the pg_query() function documentation. If this proposal is accepted, feel free to rewrite it in a better english. Kind regards, -- Bruno BAGUETTE - bouchon@alussinan.org (hardly filtered mail, but I read answers on the newsgroup) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 16:00:01 2025 UTC |
Hello, You are right, the documentation indicates "statement or statements", but I think that is too discreet (I didn't saw the mention). Maybe complete that sentence like this : "The SQL statement or statements (SQL transaction) to be executed." And/or add a second example "Example 2. pg_query() example using SQL transaction". $SQLQuery = 'BEGIN;'; $SQLQuery.= 'INSERT INTO a (a,b) VALUES (1,2);'; $SQLQuery.= 'INSERT INTO b (ref_b,c) VALUES (2,5);'; $SQLQuery.= 'COMMIT;'; $HandleResults = pg_query($SQLQuery); if (!$HandleResults) { echo "An error occured.\n"; exit; } Imho (but it is just my humble opinion), even if that feature is mentionned, it should be more in evidence. Best Regards,