You are here: Re: [PHP] postgres - mysql last_inserted_id « PHP « IT news, forums, messages
Re: [PHP] postgres - mysql last_inserted_id

Posted by "david forums" on 07/01/05 12:27

Hi

I'm migrating also to posgresql. The easyest way to manage incrementation
with postgres is to use
sequences.

How to :
Create a sequence for each table that need autoincrementation.

use pgMyAdmin, to make all needed changes

before any insert call the id.

select nextval('tablename_seq');

and pass this id to your insert.

if you used a database wrapper like PEAR::DB it is easy cause it integrate
a function to perform it, and those function are auto-portable.

The sequence management is the most common incrementation system across
all sgbd. Few like to make the mess like mysql, and sqlite (maybe other
than I don't know).

regards

david




Le Thu, 30 Jun 2005 20:55:52 +0200, Uroš Kristan <uros.kristan1@siol.net>
a écrit:

> Hello,
>
>
> I have an application in production, build on mysql database.
>
> I decided to migrate to postgres because of numerous reasons.
>
> Can you guys please guide me into the right direction?
>
> the main problem is the missing autoincrement of pgsql and getting the
> last
> record from the tabel, for linking to another tabel.
>
> How do you deal with that?
>
> also, can you please recommend me some good manual, explanation or book
> to
> help me with this problem.
>
> Because the application uses around 250 tables in mysql and I would like
> to
> make it righ t the first time
>
> when migrating to pgsql..
>
>
> I was thinking about using the pear db wrapper class, but
>
>
> Regards,
>
> Uroš KRISTAN
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация