Re: DB Alias and Sequence autoincrement

Lukas Kahwe Smith <[email protected]> Fri, 28 Oct 2005 00:07:16 +0200
Newsgroups gmane.comp.php.pear.liveuser
Message-ID <[email protected]>
cron-jbULQAKo4A5fyO9Q7EP/[email protected] wrote:
> Hello,
> 
> I'm testing the examples from LiveUser_Admin/example1
> 
> Using MDB2 the example works correctly, but when using DB storage container
> I get the error:
> 
> Couldn't create the query, reason: DB Error: no such field-UPDATE
> liveuser_perm_users_seq SET id=LAST_INSERT_ID(id+1) [nativecode=1054 **
> Unknown column 'id' in 'field list']
> 
> It appear not to respect the alias *id* to *sequence* when using the DB
> storage container:

Yes .. there is no "id" field you can alias in the emulated sequence as 
its not handled as a table. Gets to complicated to explain :-)

Anyways DB and MDB2 use different column names for sequences. You can 
get the MDB2_Schema installer to use the DB style column name though by 
setting the seqcol_name option which is commented out in the 
demodata.php script.

> There is any way I can make LiveUser use the auto increment columns from
> MYSQL?

Only with MDB2 as the backend. Then you can set the "force_seq" option 
to false in the storage container. However atm you still need to 
manually make the given fields auto incrementing. In the future this 
will however be possible to handle this directly through MDB2_Schema.

regards,
Lukas