On Fri, 19 Mar 2004 23:21:20 -0600, Andrew Gaffney wrote: > See the problem? I can't use either quoting consistently due to the > nature of the data I'm working with. How about using the power that is offered to you by Perl??? There is a function offered by the DBI module called 'quote'.
Following is a copy and paste from the DBI-docs. Btw. 'perldoc DBI' on your local terminal and a bit of searching could have saved you a lot of time :) /oliver/ --- cnp --- quote $sql = $dbh->quote($value); $sql = $dbh->quote($value, $data_type); Quote a string literal for use as a literal value in an SQL statement, by escaping any special characters (such as quotation marks) contained within the string and adding the required type of outer quotation marks. $sql = sprintf "SELECT foo FROM bar WHERE baz = %s", $dbh->quote("Don't"); For most database types, quote would return 'Don''t' (including the outer quotation marks). An undefined $value value will be returned as the string NULL (without single quotation marks) to match how NULLs are represented in SQL. If $data_type is supplied, it is used to try to determine the required quoting behaviour by using the information returned by "type_info". As a special case, the standard numeric types are optimized to return $value without calling type_info. Quote will probably not be able to deal with all possible input (such as binary data or data containing newlines), and is not related in any way with escaping or quoting shell meta-characters. It is valid for the quote() method to return an SQL expression that evaluates to the desired string. For example: $quoted = $dbh->quote("one\ntwo\0three") may return something like: CONCAT('one', CHAR(12), 'two', CHAR(0), 'three') The quote() method should not be used with "Placeholders and Bind Values". -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>