Perl: the Markov chain saw | |
PerlMonks |
Re: Counter and select statementby pfaut (Priest) |
on May 20, 2003 at 14:12 UTC ( [id://259455]=note: print w/replies, xml ) | Need Help?? |
You interpolated $lineno into your SQL statement outside the loop. The value it held at the time was embedded into the SQL statement and was used for all rows returned. You could easily create the field where you are using $lineno with perl instead of having the database return it. The data coming from the database is already present in the list of fields - you are just appending $datestamp and $lineno to this. It doesn't make sense to give data to the database just to have the database return it. Some other notes... You can use placeholders on select statements as well as on inserts. Why do you use it for one and not the other? Placeholders are a much cleaner way to plug data into your SQL than string interpolation. Some of the fields in your first select were literals which you just took and plugged into another SQL statement. You could have just coded the SQL statements with those constants.
In Section
Seekers of Perl Wisdom
|
|