in reply to Dynamic query generation
update: and you're creating a new lexical variable $query within the if ($action eq ..., which goes out of scope.
Also note that you should be careful if you build queries from external/dynamic input. Use placeholders if you can, and DBI->quote otherwise.my $query; if ($action eq 'Problem Submit') $query = "INSERT INTO Ticket_Data ("; for $key ( keys %ORA_MAPPING ) { my $value = $ORA_MAPPING{$key}; next if $key eq "Data_id"; $query.=" $value, "; # or did you really mean $key here? }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamic query generation
by chanakya (Friar) on May 05, 2005 at 12:19 UTC |