From: newsuser@linux2.johnmckown.net
To: pgsql-sql@postgresql.org
Subject: Re: Simple search question
Date: Mon, 12 Jun 2000 20:09:11 -0500
Message-ID: <slrn8kb2dm.3rr.newsuser@linux2.johnmckown.net> (raw)
References: <39457549.CEA07C63@ihug.com.au>
On Tue, 13 Jun 2000 09:42:01 +1000, Alex <gliathit@ihug.com.au> wrote:
]>Hi,
]> after running a script which performs an insert, a new tuple is
]>created, and a serial number is generated for it. I want to write the
]>new tuple data back to the screen, including the new serial number.
]> My question is, do I have to do a search for the tuple just inserted in
]>order to get the data back again? I am thinking there must be a faster,
]>more efficient way.
]>Thanks,
]>Alex
What language is your "script" written in? Based on some previous posts,
I guess you're talking about a PHP script. How did you add the tuple?
I'd guess with a pg_Exec(connect_id,"INSERT ...."). From reading the doc,
I think that you can get the row just inserted by using the pg_fetch_row()
function, passing it the result from the pg_Exec and asking for row 0.
I have not yet gotten anything running with PHP (lack of time to "play"),
so I can't test this. If it doesn't work, I'd try using pg_GetLastOid()
to get the OID of the inserted row. The use the pg_Exec and SELECT
* WHERE OID=oid-value, followed by pg_fetch_row().
Just some thoughts.
John
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-sql@postgresql.org
Cc: newsuser@linux2.johnmckown.net
Subject: Re: Simple search question
In-Reply-To: <slrn8kb2dm.3rr.newsuser@linux2.johnmckown.net>
References: <39457549.CEA07C63@ihug.com.au> <slrn8kb2dm.3rr.newsuser@linux2.johnmckown.net>
* 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