in reply to Explanation of Code Problem
Hi,
You may want to read the DBI documentation about prepared statements. A prepared statement is one where instead of actually putting values in the sql, placeholders (?) are used instead. Then the statement can be resused a bunch of times with different data sets. Prepared statements have a number of advantages with regards to security, performance, and reusability all of which are dicussed in the DBI documentation.
Here is an example:
$sql = "select colnm from tblnm where colmn in (?,?,?); $st = $dbh->prepare($sql); # Select where colmn in (1, 2, 3) $st->execute(1, 2, 3); .... # Select where colmn in (4, 5, 6) $st->execute(4, 5, 6);
And so on. In general, the SQL will not contain the values. The values (@array) are passed in during each execution.
Hope this helps.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Explanation of Code Problem
by ikegami (Patriarch) on Jan 04, 2005 at 16:16 UTC | |
|
Re^2: Explanation of Code Problem
by Anonymous Monk on Jan 04, 2005 at 16:24 UTC | |
by TedYoung (Deacon) on Jan 04, 2005 at 16:28 UTC |