[EMAIL PROTECTED] wrote:
>
> Hello, MySQL Experts,
Hello,
>
[.....}
>
> Alternatively, is there any way I can safely generate a unique id without
> creating the master row?
> The I could put the slave rows in before I create the master row, and I
> wouldn't have a problem.
You can use one auxiliary table with one row and one field that you use
for "unique id" generation. Your "transactions" would look like:
- get a unique ID from auxiliary table
- insert records into slave table
- insert master record
We use this kind of auxiliary table in our application.
Our auxiliary table look like:
CREATE TABLE sequence (
code int(11) DEFAULT '0' NOT NULL
);
And we generate unique IDs with:
UPDATE sequence SET code=LAST_INSERT_ID(code+1);
SELECT LAST_INSERT_ID();
>
> Thanks in advance for any advice.
>
> Alec Cawley
>
> <<--
Hope this helps
--
Joseph Bueno
NetClub/Trader.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php