On Wed, May 19, 2010 at 5:53 PM, Jonathan Duncan
<[email protected]> wrote:
> I think I like this way the best:
> http://www.everymanhosting.com/forum/about22.html
>
> However, this will not address the required cascading update.
>
> This has some good information:
> http://blog.mclaughlinsoftware.com/2009/05/25/mysql-merge-gone-awry/
>
> But also not a final solution.
>
> I am thinking I may just write a PHP script that will select from db1.table1, 
> insert it into db2.table1 and then check if there is an associated row in 
> db1.table2 and if so insert that in db2.table 2 with new 'id' key from last 
> insert on db2.table1.


You will need a PHP script for sure.  This is one problem where an
incrementing primary key causes pain.  Your first article assumes you
have no foreign key dependencies, or possibly a row-dependent key like
a username.  The second article does too.

If auto_increment primary keys weren't so simple, easy, and beautiful,
they would be banished to hell for problems like this.  A UUID
approach to generated keys would be more robust, but adds too much
complexity.  And really, how often do these types of table merges
happen?

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to