pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: bruce <bedouglas@earthlink.net>
To: 'reiner peterke' <zedaardv@drizzle.com>
To: 'Rod K' <rod@23net.net>
Cc: pgsql-php@postgresql.org
Subject: Re: [0.0] Re: [0.2] getting transactions to work
Date: Fri, 30 Jul 2004 09:35:14 -0700
Message-ID: <019201c47653$31ce8e00$0301a8c0@Mesa.com> (raw)
In-Reply-To: <3C941D97-E245-11D8-8EE0-000A95984CA6@drizzle.com>

the idea behind persistent connections is to simply allow you to open a
connection, that is persistent, ie, it's there for other db functions to use
and that the app doesn't go through the process of opening up a new
connection. with a persistent connection, the app essentially looks to see
if an existing connection has already been open that's available for use.

-bruce


-----Original Message-----
From: reiner peterke [mailto:zedaardv@drizzle.com]
Sent: Friday, July 30, 2004 9:27 AM
To: Rod K
Cc: pgsql-php@postgresql.org; bedouglas@earthlink.net
Subject: Re: [0.0] Re: [0.2] [PHP] getting transactions to work


ok,

thanks


On 30 jul 2004, at 18.13, Rod K wrote:

> No, persistent connections will not work either.
>
> reiner peterke wrote:
>
>> 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
>>>>>
>>>>> <html>
>>>>> <head>
>>>>> <submitle>those eyes</submitle>
>>>>> </head>
>>>>> <body>
>>>>>   <?
>>>>>   $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);
>>>>>     ?>
>>>>>     <form method="post" action="<? echo $PHP_SELF?>">
>>>>>       <input type="Submit" name="action" value="commit">
>>>>>       <input type="Submit" name="action" value="rollback">
>>>>>     </form>
>>>>>     <?
>>>>>   }
>>>>>   else if(!$_POST[action]) {
>>>>>   ?>
>>>>>     <form method="post" action="<? echo $PHP_SELF?>">
>>>>>       Diety:<input type="text" name="diety"><br>
>>>>>       Culture:<input type="text" name="culture"><br>
>>>>>       Gender:<input type="text" name="gender"><br>
>>>>>       <input type="Submit" name="submit" value="enter">
>>>>>     </form>
>>>>>     <?
>>>>>   }
>>>>>   else {
>>>>>     if($_POST[action] == 'commit') {
>>>>>       echo "let me see";
>>>>>       $act = pg_query("commit");
>>>>>     }
>>>>>     else {
>>>>>       $act = pg_query("rollback");
>>>>>       }
>>>>>   }  //end if $_POST[submit]
>>>>> ?>
>>>>> </body>
>>>>> </html>
>>>>> ---------------------------(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
>>>
>>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>               http://archives.postgresql.org
>




view thread (18+ messages)  latest in thread

Message-ID: <019201c47653$31ce8e00$0301a8c0@Mesa.com>
Permalink:  ../019201c47653$31ce8e00$0301a8c0@Mesa.com/
Also on:    postgresql.org/message-id/019201c47653$31ce8e00$0301a8c0@Mesa.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: bedouglas@earthlink.net, zedaardv@drizzle.com, rod@23net.net
  Subject: Re: [0.0] Re: [0.2] getting transactions to work
  In-Reply-To: <019201c47653$31ce8e00$0301a8c0@Mesa.com>
  References: <3C941D97-E245-11D8-8EE0-000A95984CA6@drizzle.com> <019201c47653$31ce8e00$0301a8c0@Mesa.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox