[thelist] returning values you already have (was: SQL statement construction)

Warden, Matt mwarden at odyssey-design.com
Wed Oct 11 14:19:32 CDT 2000


> This sub is supposed to access a table, search it until the data in column
> usAuthenticate is equal to the data in $form{'CONFIRM'} and return that
row
> of information.   It returns data but only the first row in the table.  It
> doesnt find the WHERE bit...
>   my $dbh=$db->prepare("SELECT
>
usNum,usName,UsEmail,usPassword,usFullname,usStreet,usSuburb,usCity,usState,
> usZip,usPhone,usAuthenticate FROM changeConfirm  WHERE  usAuthenticate=" .
> int($form{'CONFIRM'}));

This is something I've wondered about for a while. I see that he selected
usAuthenticate, even though that was a value he already knew, because he
used it to construct the WHERE clause. I assume that affects performance,
but to what extent. Personally, I don't do this because I'm afraid of the
hit it takes for moving an unnecessary column to my script. However, your
data are then spread about. You will have most of the data in a recordset,
and then this other bit of data in a separate variable. Is it just a coding
style issue, or is the performance hit in any way significant?

--
mattwarden
mattwarden.com





More information about the thelist mailing list