I would go with the more complete code you have posted below.
In reply to Re^5: DBI and mysql query formatting by tangent in thread DBI and mysql query formatting by kimlid2810