Thread Gültigkeit von Identifier
(11 answers)
Opened by Kuerbis at 2015-11-16 09:32
Z.B hier $my_table und $col_1
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 my $stmt = "SELECT table_name FROM information_schema.tables WHERE table_schema = ? ORDER BY table_name"; my $tables = $dbh->selectcol_arrayref( $stmt, {}, ( $schema ) ); my $my_table = $tables->[0]; my $sth = $dbh->prepare( "SELECT * FROM $my_table LIMIT 0" ); $sth->execute(); my $columns = $sth->{NAME}; my $col_1 = shift @$columns; my $sth = $dbh->prepare( "SELECT $col_1 FROM $my_table" ); $sth->execute(); $sth->dump_results; |