From: | Bo Lorentsen <bl(at)netgroup(dot)dk> |
---|---|
To: | Christian Kratzer <ck(at)cksoft(dot)de> |
Cc: | Michael Glaesemann <grzm(at)myrealbox(dot)com>, "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: OID Usage |
Date: | 2005-01-14 10:39:54 |
Message-ID: | 41E7A17A.6080803@netgroup.dk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Christian Kratzer wrote:
> why should your application not want to know about the metadata of it's
> own tables ? That sounds quite strange when you think about it.
Well, the ideer is to be compatible with mysql at the same level in the
code. This works nicely, as I have descriped, but I am concerned if
there is any strains attached to this method.
It is all found in the : http://lue.dk/prj/dbc/index.html
> If you name your sequences in a generic way you can alway construct
> the name of the sequence from the name of the table and the id column.
>
> We use this in our php framework
>
> function insert_id()
> {
> global $pg_conn;
> if(isset($pg_conn)) {
> $query = sprintf("SELECT currval('%s_%s_seq')
> AS id",$this->table,$this->id_column);
> $result = @pg_query($pg_conn,$query);
> $row = pg_fetch_assoc($result);
> return strval($row["id"]);
> } else {
> return 0;
> }
> }
Thanks, but this demands you to have the table and id_column name in
your hand, and I don't right now.
Also ... the "currval" function are specifik to postgresql, and there
are nothing like it in mysql that can make any garanti for getting row
for newly inserted data. You can access autoincrement values in mysql,
but no garanties are given about its value (someone else have inserted a
new in the same table).
But thanks for your interrest., anyway.
/BL
From | Date | Subject | |
---|---|---|---|
Next Message | Bo Lorentsen | 2005-01-14 10:47:25 | Re: OID Usage |
Previous Message | Michael Fuhr | 2005-01-14 10:15:08 | Re: OID Usage |