RE: Translate between DBI and SQL

2019-02-11 Thread Fennell, Brian
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

Re: Translate between DBI and SQL

2019-02-11 Thread pali
On Friday 08 February 2019 22:37:17 Mike Martin wrote: > Has anyone done any work on converting SQL queries between RDBMS and perl? > > My particular interest is DBD::Pg but anything would be of use > > It would be very useful when I am testing complex SQL, it's very easy to > miss a \ or quote

RE: Translate between DBI and SQL

2019-02-11 Thread Fennell, Brian
P.P.S. My last answer used single-quote for a column with a space in it in PostgreSQL - this is wrong, it should have been a double-quote for the name of the column with a space and a single quote for a quoted string literal in PostgreSQL. Better example: (Adapted from answer to question here

RE: Translate between DBI and SQL

2019-02-11 Thread Fennell, Brian
Mike, If you have a complete example of what you are starting with and what you want to end up with your question would be clearer. If I understand you correctly: You start with raw SQL such as you might enter into a Postgres command line tool (for example psql). What you want is the equivalent