Newline characters in quoted strings

IBM® Informix® ESQL/C does not allow a newline character (0x0A) in a quoted string. The database server does allow a newline character in a quoted string, however, if you specify that you want to allow it. Consequently, you can include the newline character in a quoted string that is part of a dynamically prepared SQL statement because the database server, rather than Informix ESQL/C, processes the prepared statement.

You can specify that you want the database server to allow the newline character in a quoted string either on a per session basis or on an all session basis. A session is the duration of the client connection to the database server.

To allow or disallow a newline character in a quoted string for a particular session, you must execute the user-defined routine ifx_allow_newline(boolean). The following example illustrates how to start the ifx_allow_newline() user-defined routine to allow newlines in quoted strings:
EXEC SQL execute procedure ifx_allow_newline('t');
To disallow newline in quoted strings, change the argument to f as in the following example:
EXEC SQL execute procedure ifx_allow_newline('f');

To allow or disallow a newline character in a quoted string for all sessions, set the ALLOW_NEWLINE parameter in the onconfig file. A value of 1 allows the newline character. A value of 0 disallows the newline character. For more information about the ALLOW_NEWLINE parameter, see your IBM Informix Administrator's Guide.


Copyright© 2018 HCL Technologies Limited