String delimiters
Informix®
The ANSI SQL string delimiter character is the single quote ('string'
), while
double quotes are used to delimit database object names:
SELECT ... WHERE "tabname"."colname" = 'a string value'
SELECT ... WHERE tabname.colname = 'a string value'
This is important, since many BDL programs use that character to delimit the strings in SQL commands.
SAP ASE
QUOTED_IDENTIFIER
session option is OFF (the
default):SET QUOTED_IDENTIFIER OFF
Solution
$ cat s.4gl
MAIN
DEFINE n INT
SELECT COUNT(*) INTO n FROM tab1 WHERE col1 = "abc"
END MAIN
$ fglcomp -S s.4gl
s.4gl^3^SELECT COUNT(*) FROM tab1 WHERE col1 = 'abc'
However, SQL statements created dynamically are not modified by the Genero compiler.
The Genero database interface can automatically replace all double quotes by single quotes in SQL statements. This applies to static and dynamic SQL statements.
dbi.database.dbname.ifxemul.dblquotes = { true | false }
For
more details see IBM Informix emulation parameters in FGLPROFILE.... WHERE "tabname"."colname" = "a string value"
... WHERE 'tabname'.'colname' = 'a string value'
This would produce an error since 'tabname'.'colname' is not allowed by ORACLE.
Escaped string delimiters can be used inside strings like the following:
'This is a single quote: '''
'This is a single quote: \''
"This is a double quote: """
"This is a double quote: \""
Although double quotes are replaced automatically in SQL statements, it is recommended that you use only single quotes to enforce portability.