I can't add much to Brian's reactor way of doing it, it should work
fine, although i would say if this is a frequent operation a custom
method may be more efficient.
Also if your addKeysToChain method is simply adding new keys, as opposed
to replacing the existing keys with a new set, then you could consider
INSERT IGNORE (in mysql anyway) rather than seperate DELETE and INSERT
statements
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Kotek
Sent: 04 January 2008 14:34
To: [email protected]
Subject: Re: [Reactor for CF] an easier way to populate MTM
tables?
You can get the KeyIterator from the Keychain, and then add or
remove Keys from the interator as you need to. When you save the
Keychain, it's KeyIterator will also be saved, and it should
automatically handle adding or removing any associated Keys as part of
the save process.
On Jan 4, 2008 9:00 AM, Mike Haggerty <[EMAIL PROTECTED]>
wrote:
Hello.
I am wondering if there is an easier way to do the
following with Reactor:
I have keys and keychains. There is a many to many
relationship between
the two. I am trying to figure out the best way to add
keys to a
keychain. Currently, I have constructed a function in
the
keychainRecord.cfc called addKeysToKeychain(), which
takes a list of key
IDs. This function then DELETEs all rows in the
keychain_key MTM table
specific to the current keychain, and loops through the
list of key IDs,
and INSERTs a new row to the keychain_key MTM table for
each.
This method works fine, but I was just curious as to
whether there
existed some secret Reactor magic that would allow me to
do something
similar without witting a custom function.
Thanks!
Mike Haggerty
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at:
http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at:
http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --