develooper Front page | perl.dbi.users | Postings from February 2019

RE: Translate between DBI and SQL

Thread Previous | Thread Next
From:
Fennell, Brian
Date:
February 11, 2019 17:10
Subject:
RE: Translate between DBI and SQL
Message ID:
BN6PR14MB16178E7675CA2FAB33F7039CA2640@BN6PR14MB1617.namprd14.prod.outlook.com
P.S.
This may also help:
    http://www.dispersiondesign.com/articles/perl/perl_escape_characters

Short answer:
Use single-quoted strings whenever possible - they have the fewest characters to escape - only backslash and single quote - and you can escape both by preceding with a backslash.
Use dot operator and double-quoted strings for special characters and new-lines.

Use the dot and dot-equals operators for multi-line sql.

something like this:
   my($my_sql_string);
   $my_sql_string =  'SELECT \'column name with a space\' ' . "\n";
   $my_sql_string .= 'FROM table_b' ;

Ref the docs for anything really fancy (like non-english / non-printable-ascii Unicode or unusual character encodings).

Brian Fennell





The information contained in this electronic mail transmission is intended only for the use of the individual or entity named in this transmission. If you are not the intended recipient of this transmission, you are hereby notified that any disclosure, copying or distribution of the contents of this transmission is strictly prohibited and that you should delete the contents of this transmission from your system immediately. Any comments or statements contained in this transmission do not necessarily reflect the views or position of Radial or its subsidiaries and/or affiliates.



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About