Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I have one comment that hasn't been addressed yet, is slightly OT, but still important. In your SQL query you may want to explicitly specify the columns you are inserting into. This has a large benefit: if you add a column to the table or the column ordering changes, your code is less likely to break. A good rule of thumb I use is to:
I've found this to be especially helpful in SELECT and INSERT -type statements. Here's an example that demonstrates what I mean and answers your question:
I began doing this after thinking about the issues raised in Topics in Perl Programming: Table-Mutation Tolerant Database Fetches with DBI, and realizing the way I was doing SQL does not lend itself to change very well. In reply to (dkubb) Re: (1) Using CGI.pm params to make a DBI MySQL query
by dkubb
|
|