Hi Quinton,

Thank you very much for this explanation,  it makes a lot more sense now.

But I'm not completely dissuaded by this.  The next AUTO_INCREMENT key is stored in table metadata - where it can be read and written to.  So would it not be possible to hack the mysql driver to use this value instead of using the one in the EO_PK_TABLE?

Regards,
Richard Stephens
Ph: 07 3136 3426
Mob: 0410 111 570



On 04/10/2008, at 9:58 PM, Q wrote:


On 04/10/2008, at 5:31 PM, Richard Stephens wrote:

Unfortunately, most of the PHP stuff doesn't use any database abstraction.  Converting it to se a different database would be a huge task.

I guess I just don't understand why WO has to store the next key in a table, rather than  in the table metadata where AUTO_INCREMENT stores it.

The reason that WO just doesn't work well with AUTO_INC is because it expects to be able to obtain an id for the EO BEFORE the insert is executed so that it can resolve temporary id's and any foreign keys in a transaction safe way.  When you use AUTO_INC, you don't know what the ID is actually going to be until after it has been inserted. What you need in order to do this properly is a sequence, which mysql lacks, but the behaviour can be emulated by using the EO_PK_TABLE.  You may be able to sort of resolve the issue of EO_PK_TABLE being out of date by using a trigger to update the EO_PK_TABLE on INSERT, or better yet use a trigger to use the EO_PK_TABLE to generate the ID value instead of allowing mysql to AUTO_INC the ID field, but I have never actually tried to do that.

 Alternatively, in my case, even using SELECT MAX(pk) might be an option, as the WO code doesn't actually create new entities very often.

Is there source available for the mysql driver? I wouldn't mind having a look see if I can adapt it

Regards,
Richard Stephens
Ph: 07 3136 3426
Mob: 0410 111 570

On 04/10/2008, at 4:10 PM, Guido Neitzer wrote:

On 03.10.2008, at 23:32, Richard Stephens wrote:

Is there any way to get round having to use EO_PK_TABLE for mysql and to allow WO to use auto_increment instead?  I'm writing a WO app that has to share a mysql database with a number of PHP apps, so the data that ends up in EO_PK_TABLE can't be trusted.

We had a hard time doing that (working around issues in MySQL) and ended up converting the projects to either FrontBase or PostgreSQL and within a day all pain was gone ...

The problem is, that WO just doesn't work the way, auto-increment works. And it's less pain to use another database than to deal with all these problems in my opinion. If that is not an option, just ignore me ...

cug

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/qdolan%40gmail.com

This email sent to [EMAIL PROTECTED]



-- 
Seeya...Q

Quinton Dolan - [EMAIL PROTECTED]
Gold Coast, QLD, Australia (GMT+10)
Ph: +61 419 729 806




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to