Does anyone have any ideas on how to make this work:
I write a lot of scripts to do migrations. I try to make as much of my code
reusable as possible. Straight table copies are no problem after I query the
system tables to get the table, and column names, and build something like:
INSERT INTO $ini->{targetdb}..$table ($columnlist) SELECT $columnlist FROM
$ini->{sourcedb}..$table
My problem comes with finding a way to build reusable code for a subroutine
to deal with tables that will not go straight across. The obstacle is in
this statement:
$row = $select->bind_columns(undef, \$column1, \$column2......
Again, I can get the column names by querying the system catalogs. I don't
necessarily have to bind them by anything resembling their column name, I
only need a way to reference them. So once I get the number of columns into
the script, how can I then assign variable, or hash key names so that I can
build a bind_columns statement that can work?
I may be just too close to this to see something obvious - whatever the
case, I would greatly appreciate any ideas that will help with this.
Thanks,
Steve Howard