Re: Class ADODB - Method GenID() in MySQL
| From: | Lester Caine | Date: | Wed, 19 Jul 2006 16:06:07 +0000 |
| Subject: | Re: Class ADODB - Method GenID() in MySQL | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239585@lists.php.net to get a copy of this message | ||
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