The esql compilation parameter of informix avoids the problem of SQL interrupt caused by / / comments
In EXEC SQL, if the "/ /" symbol appears in the SQL statement, it causes the SQL statement from the end of ";" to be ignored, not just the current line. This often comes as a surprise to programmers.
For example, the following example program t1.ec.
Int main ()
{
EXEC SQL UPDATE vyktd
SET kahaoo= "1" / / comment 1 appears in SQL
WHERE kahaoo= "2"
/ / Note 2 appears in ordinary programs
Return 0
}
Normal compilation can be done by:
$esql-e t1.ec
$
In fact, the SQL executed will be UPDATE vyktd SET kahaoo= "1" without any conditions. Because the WHERE sentence is masked by note 1, it becomes a dangerous full table update!
In order to avoid this hidden trouble, you need to add the compilation parameter of esql-keepccomment, after which, if you write "/ /" in sql, it will compile the error.
$esql-keepccomment-e t1.ec
Esqlc: "t1.ec", line 4: Error-33051: Syntax error on identifier or symbol'/'.
1 error (s) found
$