SQL Portability - SQL Dialects
 
 
- How to concatenate strings? Let me count the (incompatible) ways...
- 
SELECT first_name || ' ' || last_name FROM table
 
 SELECT first_name + ' ' + last_name FROM table
 SELECT first_name CONCAT ' ' CONCAT last_name FROM table
 SELECT CONCAT(first_name, ' ', last_name) FROM table
 SELECT CONCAT(first_name, CONCAT(' ', last_name)) FROM table
 
- The ODBC way:     (not pretty, but portable)
- 
SELECT {fn CONCAT(first_name, {fn CONCAT(' ', last_name))}} FROM table
 
 
- The {fn …} will be rewritten by prepare() to the required syntax via a call to
- 
$new_sql_fragment = $dbh->{Rewrite}->CONCAT(”…”)
 
 
- Similarly for some data types:
- 
SELECT * FROM table WHERE date_time > {ts ’2002-06-04 12:00:00’ } FROM table
 
 $new_sql_fragment = $dbh->{Rewrite}->ts(’2002-06-04 12:00:00’)
 
- This 'rewrite' functionality is planned but not yet implemented