in reply to Re: Perl and MySql - checking tables for column names
in thread Perl and MySql - checking tables for column names
What would the @_mb have it in? just table names? So that way I could loop through it like it already does:my @_mb = $dbh->table_info; my $_tablesAffected = 0; foreach $_k (@_mb) { # Ran code in here... }
or is there a bunch of fields in the @_mb array? Thx, -Richardforeach $_k (@_mb) { my $_sql = "select * from $_k LIMIT 0"; my $sth2 = $dbh->prepare($_sql); $sth2->execute(); my @_mb2 = @{$sth2->{NAME}}; foreach $_k2 (@_mb2) { # then looking for column names with username: if($_k2 =~ /username/i) { # do what they are looking for } next; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl and MySql - checking tables for column names
by Corion (Patriarch) on Jan 23, 2017 at 09:12 UTC |