in reply to Re^2: Sql table names
in thread Sql table names
a table may be queried for its contents by supplying its name through an online form.In that case, you definitely want to check the name against the hash to make sure it's a table you want users to be able to access. You may also want something like this, depending on your needs:
Eventually you might consider Class::DBI which provides some ready-made shortcuts for this kind of thing.my @tables = ( {name=>members,cols=>[qw(members id)]}, {name=>emails,cols=>[qw(emails member_id)]}, ); my $sql = "SELECT " . join(',',@{$tables[0]->{cols}}) . " FROM " . $tables[0]->{name} ;
|
|---|