bizactuator has asked for the wisdom of the Perl Monks concerning the following question:
my @_mb = $dbh->tables; my $_tablesAffected = 0; foreach $_k (@_mb) { # Ran code in here... }
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: Perl and MySql - checking tables for column names
by Corion (Patriarch) on Jan 23, 2017 at 08:56 UTC | |
by bizactuator (Sexton) on Jan 23, 2017 at 09:06 UTC | |
by Corion (Patriarch) on Jan 23, 2017 at 09:12 UTC | |
|
Re: Perl and MySql - checking tables for column names
by kschwab (Vicar) on Jan 23, 2017 at 15:16 UTC |