Re: Class ADODB - Method GenID() in MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Renne Rocha wrote:

 Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
new BD.

ADOdb will emulate SEQUENCES using what is available in the database engine. Firebird uses Generators - MySQL it generates a table of values. So which ever engine you use, GenID should give you the next values for the SEQUENCE you asked for.

 I don't know if anyone have ever used this class before. I am trying
to use the GenID method, because in PostgreSQL we don't have the
auto_increment field type. I made it work (with the Insert_ID method),
but it isn't portable. Does anyone that knows this class can help me?

GenID is not needed to be linked to an AUTO field. In fact it's much better NOT to make the field AUTO, and use the SEQUENCE value instead. That way you can create an ID and use it in several tables.

MySQL driver may have the option switched off - check $hasGenID setting.

Main thing is that the name of the SEQUENCE should not be the same as a table name for easier understanding.

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux