Re: mysql_insert_id

From: Devrim GUNDUZ <devrim(at)CommandPrompt(dot)com>
To: Erkin Tek <erkintek(at)fotograf(dot)web(dot)tr>
Cc: "pgsql-tr-genel(at)postgresql(dot)org" <pgsql-tr-genel(at)postgresql(dot)org>
Subject: Re: mysql_insert_id
Date: 2006-12-04 07:18:40
Message-ID: 1165216720.3069.2.camel@laptop.gunduz.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-tr-genel

Merhaba,

On Fri, 2006-12-01 at 16:30 +0200, Erkin Tek wrote:
> bir kaç fln filan buldum ama sanırım eklediğim şeyi bulmanın yolu pek
> yok, bir transaction yazmadıkca.

PostgreSQL 8.2'teki INSERT...RETURNING işinize yarayabilir sanırım:

test=# CREATE TABLE t1 (c1 serial unique, c2 varchar(20));
NOTICE: CREATE TABLE will create implicit sequence "t1_c1_seq" for
serial column "t1.c1"
NOTICE: CREATE TABLE / UNIQUE will create implicit index "t1_c1_key"
for table "t1"
CREATE TABLE
test=# INSERT INTO t1 VALUES (DEFAULT,'Devrim') RETURNING c1;
c1
----
1
(1 row)

INSERT 0 1
test=# INSERT INTO t1 VALUES (DEFAULT,'Gündüz') RETURNING c1;
c1
----
2
(1 row)

İyi çalışmalar,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

In response to

Responses

Browse pgsql-tr-genel by date

  From Date Subject
Next Message Erkin Tek 2006-12-04 11:18:47 Re: mysql_insert_id
Previous Message Ali ÇELİK 2006-12-03 20:44:23 Re: Yedek alıp geri yükl