X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C73E9D1B182 for ; Fri, 30 Jul 2004 13:08:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99215-08 for ; Fri, 30 Jul 2004 16:08:28 +0000 (GMT) Received: from ariel.globecom.net (ariel.globecom.net [212.116.67.15]) by svr1.postgresql.org (Postfix) with ESMTP id 823CDD1B1CE for ; Fri, 30 Jul 2004 13:08:27 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by ariel.globecom.net (Postfix) with ESMTP id 9EE336536F8; Fri, 30 Jul 2004 18:08:42 +0200 (CEST) Received: from ariel.globecom.net ([127.0.0.1]) by localhost (ariel.bahnhof.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 07943-01-14; Fri, 30 Jul 2004 18:08:41 +0200 (CEST) Received: from mail-gw.globecom.net (mail-gw.globecom.net [212.116.65.149]) by ariel.globecom.net (Postfix) with ESMTP id CD772653871; Fri, 30 Jul 2004 18:08:41 +0200 (CEST) Received: from [10.0.8.131] (STH-10-NAT-212.116.78.2-CUST-BRFFARMEN-CPE.globecom.net [212.116.78.2]) by mail-gw.globecom.net (Postfix) with ESMTP id 9E90FB858; Fri, 30 Jul 2004 18:08:25 +0200 (CEST) In-Reply-To: <018301c47648$db231990$0301a8c0@Mesa.com> References: <018301c47648$db231990$0301a8c0@Mesa.com> Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: , "'Rod K'" From: reiner peterke Subject: Re: [0.2] getting transactions to work Date: Fri, 30 Jul 2004 18:08:25 +0200 To: X-Mailer: Apple Mail (2.618) X-Virus-Scanned: by amavisd-new at globecom.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200407/54 X-Sequence-Number: 2879 well i've read about this thing called persistent connection, i think it is supposed to exist in mysql also. the idea sound like what i want. i've tried it but i didn't get any different results. but then i'm not convinced i did it right either. r On 30 jul 2004, at 17.21, bruce wrote: > if psgres works as mysql.... you should be able to do it... > > but the issue appears to be that the connection you establish with the > db in > one page, is not available once you shut the page down. > > within mysql, there appears to be a mysqli group of functions that are > setup > to accommodate transactions across multiple pages... i would > imagine/hope > that the same sort of functionality is available for posgres.... > > i'm getting close to needing the same functionality with mysql, and i'm > betting/hoping like hell that what i've just described is how mysql/php > works... > > -bruce > > > -----Original Message----- > From: pgsql-php-owner@postgresql.org > [mailto:pgsql-php-owner@postgresql.org]On Behalf Of reiner peterke > Sent: Friday, July 30, 2004 8:04 AM > To: Rod K > Cc: pgsql-php@postgresql.org > Subject: Re: [0.2] [PHP] getting transactions to work > > > this is meant in all honesty, > > then whats the point?! > > ok, let me put it this way. is there no way to implement pages using > transactions? > otherwise it seems to kind of defeat the purpose of them. > > r > On 30 jul 2004, at 16.57, Rod K wrote: > >> You are correct. You cannot have a transaction span multiple >> pages/scripts. >> >> reiner peterke wrote: >> >>> there seems to be very little info around on actually using >>> transactions with postgres. i've tried to create a page that will >>> take input from a form and insert it into my database. it works if i >>> just do it without transactions but when i try to use with the begin >>> and commit sections of code, it doesn't update the data base. i'm >>> guessing it is doing a rollback when my page loads itself again. can >>> anyone help me out here ? >>> >>> thanks >>> >>> r >>> >>> code below >>> >>> >>> >>> those eyes >>> >>> >>> >> $conn = pg_connect("dbname=entish user=postgres"); >>> if(!$conn) >>> { >>> print "not for the chocolate"; >>> exit; >>> } >>> if ($_POST[submit]) { >>> >>> $begin = pg_query("begin"); >>> $isql = "insert into diety(diety,culture,gender) >>> values >>> ('$_POST[diety]','$_POST[culture]','$_POST[gender]')"; >>> printf("-- %s --\n",$isql); >>> $results = pg_query($isql); >>> ?> >>>
>>> >>> >>>
>>> >> } >>> else if(!$_POST[action]) { >>> ?> >>>
>>> Diety:
>>> Culture:
>>> Gender:
>>> >>>
>>> >> } >>> else { >>> if($_POST[action] == 'commit') { >>> echo "let me see"; >>> $act = pg_query("commit"); >>> } >>> else { >>> $act = pg_query("rollback"); >>> } >>> } //end if $_POST[submit] >>> ?> >>> >>> >>> ---------------------------(end of >>> broadcast)--------------------------- >>> TIP 8: explain analyze is your friend >> >> > > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if > your > joining column's datatypes do not match >