Lee Daniel Crocker wrote:
But the issue is not just the database--it's how
to implement the
wfInsertID() function in the wiki code. PHP's Postgres functions don't
have anything like it, so you'll have to do something like get_last_oid()
and then retrieve the serial field value by OID.
Why I think I misunderstood something? Please tell me what's wrong.
The wfInsertID() funktion is used to get a unique autoincremented number
in mySQL. And PHP has a function to return this number to you.
I would now do the pg implementation by adding a 'serial' type to the
table. Usually I don't do anything with this value, because pg will
handle the autoincrement. Normaly mysql should do the same. If you for
some reasons will know which value currently is used, you can get this
in pg by the function currval(sequence_name) and the next value you can
get by nextval(sequence_name).
Current PHP:
function wfInsertId() {return mysql_insert_id( wfGetDB() );}
with pg:
function wfInsertId() {
return pq_query( wfGetDB(), "select currval('sequence_name')\;");
}
But usually if you e.g. fetching the data to display an articel you will
get the serial as well.
By the way: using OID's is bad, very bad. Thats an internal value,
noboby should use.
Smurf
--
------------------------- Anthill inside! ---------------------------