Informix Compatibility Mode
Informix Compatibility Mode
ecpg can be run in a so-called Informix compatibility mode. If this mode is active, it tries to behave as if it were the Informix precompiler for Informix E/SQL. Generally spoken this will allow you to use the dollar sign instead of the EXEC SQL primitive to introduce embedded SQL commands:
$int j = 3;
$CONNECT TO :dbname;
$CREATE TABLE test(i INT PRIMARY KEY, j INT);
$INSERT INTO test(i, j) VALUES (7, :j);
$COMMIT;
Note
There must not be any white space between the $ and a following preprocessor directive, that is, include, define, ifdef, etc. Otherwise, the preprocessor will parse the token as a host variable.
There are two compatibility modes: INFORMIX, INFORMIX_SE
When linking programs that use this compatibility mode, remember to link against libcompat that is shipped with ECPG.
Besides the previously explained syntactic sugar, the Informix compatibility mode ports some functions for input, output and transformation of data as well as embedded SQL statements known from E/SQL to ECPG.
Informix compatibility mode is closely connected to the pgtypeslib library of ECPG. pgtypeslib maps SQL data types to data types within the C host program and most of the additional functions of the Informix compatibility mode allow you to operate on those C host program types. Note however that the extent of the compatibility is limited. It does not try to copy Informix behavior; it allows you to do more or less the same operations and gives you functions that have the same name and the same basic behavior but it is no drop-in replacement if you are using Informix at the moment. Moreover, some of the data types are different. For example, PostgreSQL's datetime and interval types do not know about ranges like for example YEAR TO MINUTE so you won't find support in ECPG for that either.
Additional Types
The Informix-special "string" pseudo-type for storing right-trimmed character string data is now supported in Informix-mode without using typedef. In fact, in Informix-mode, ECPG refuses to process source files that contain typedef sometype string;
EXEC SQL BEGIN DECLARE SECTION;
string userid; /* this variable will contain trimmed data */
EXEC SQL END DECLARE SECTION;
EXEC SQL FETCH MYCUR INTO :userid;
Additional/Missing Embedded SQL Statements
CLOSE DATABASE-
This statement closes the current connection. In fact, this is a synonym for ECPG's
DISCONNECT CURRENT:$CLOSE DATABASE; /* close the current connection */ EXEC SQL CLOSE DATABASE; FREE cursor_name- Due to differences in how ECPG works compared to Informix's ESQL/C (namely, which steps are purely grammar transformations and which steps rely on the underlying run-time library) there is no
FREE cursor_namestatement in ECPG. This is because in ECPG,DECLARE CURSORdoesn't translate to a function call into the run-time library that uses to the cursor name. This means that there's no run-time bookkeeping of SQL cursors in the ECPG run-time library, only in the PostgreSQL server. FREE statement_nameFREE statement_nameis a synonym forDEALLOCATE PREPARE statement_name.
Informix-compatible SQLDA Descriptor Areas
Informix-compatible mode supports a different structure than the one described in SQLDA Descriptor Areas. See below:
struct sqlvar_compat
{
short sqltype;
int sqllen;
char *sqldata;
short *sqlind;
char *sqlname;
char *sqlformat;
short sqlitype;
short sqlilen;
char *sqlidata;
int sqlxid;
char *sqltypename;
short sqltypelen;
short sqlownerlen;
short sqlsourcetype;
char *sqlownername;
int sqlsourceid;
char *sqlilongdata;
int sqlflags;
void *sqlreserved;
};
struct sqlda_compat
{
short sqld;
struct sqlvar_compat *sqlvar;
char desc_name[19];
short desc_occ;
struct sqlda_compat *desc_next;
void *reserved;
};
typedef struct sqlvar_compat sqlvar_t;
typedef struct sqlda_compat sqlda_t;
The global properties are:
sqld- The number of fields in the
SQLDAdescriptor. sqlvar- Pointer to the per-field properties.
desc_name- Unused, filled with zero-bytes.
desc_occ- Size of the allocated structure.
desc_next- Pointer to the next SQLDA structure if the result set contains more than one record.
reserved- Unused pointer, contains NULL. Kept for Informix-compatibility.
The per-field properties are below, they are stored in the
sqlvararray:
sqltype- Type of the field. Constants are in
sqltypes.h sqllen- Length of the field data.
sqldata-
Pointer to the field data. The pointer is of
char *type, the data pointed by it is in a binary format. Example:int intval; switch (sqldata->sqlvar[i].sqltype) { case SQLINTEGER: intval = *(int *)sqldata->sqlvar[i].sqldata; break; ... } sqlind-
Pointer to the NULL indicator. If returned by DESCRIBE or FETCH then it's always a valid pointer. If used as input for
EXECUTE ... USING sqlda;then NULL-pointer value means that the value for this field is non-NULL. Otherwise a valid pointer andsqlitypehas to be properly set. Example:if (*(int2 *)sqldata->sqlvar[i].sqlind != 0) printf("value is NULL\n"); sqlname- Name of the field. 0-terminated string.
sqlformat- Reserved in Informix, value of PQfformat for the field.
sqlitype- Type of the NULL indicator data. It's always SQLSMINT when returning data from the server. When the
SQLDAis used for a parameterized query, the data is treated according to the set type. sqlilen- Length of the NULL indicator data.
sqlxid- Extended type of the field, result of PQftype.
sqltypename,sqltypelen,sqlownerlen,sqlsourcetype,sqlownername,sqlsourceid,sqlflags,sqlreserved- Unused.
sqlilongdata- It equals to
sqldataifsqllenis larger than 32kB. Example:
EXEC SQL INCLUDE sqlda.h;
sqlda_t *sqlda; /* This doesn't need to be under embedded DECLARE SECTION */
EXEC SQL BEGIN DECLARE SECTION;
char *prep_stmt = "select * from table1";
int i;
EXEC SQL END DECLARE SECTION;
...
EXEC SQL PREPARE mystmt FROM :prep_stmt;
EXEC SQL DESCRIBE mystmt INTO sqlda;
printf("# of fields: %d\n", sqlda->sqld);
for (i = 0; i < sqlda->sqld; i++)
printf("field %d: \"%s\"\n", sqlda->sqlvar[i]->sqlname);
EXEC SQL DECLARE mycursor CURSOR FOR mystmt;
EXEC SQL OPEN mycursor;
EXEC SQL WHENEVER NOT FOUND GOTO out;
while (1)
{
EXEC SQL FETCH mycursor USING sqlda;
}
EXEC SQL CLOSE mycursor;
free(sqlda); /* The main structure is all to be free(),
* sqlda and sqlda->sqlvar is in one allocated area */
sqlda.h header and the src/interfaces/ecpg/test/compat_informix/sqlda.pgc regression test.
Additional Functions
decadd-
Add two decimal type values.
The function receives a pointer to the first operand of type decimal (int decadd(decimal *arg1, decimal *arg2, decimal *sum);arg1), a pointer to the second operand of type decimal (arg2) and a pointer to a value of type decimal that will contain the sum (sum). On success, the function returns 0.ECPG_INFORMIX_NUM_OVERFLOWis returned in case of overflow andECPG_INFORMIX_NUM_UNDERFLOWin case of underflow. -1 is returned for other failures anderrnois set to the respectiveerrnonumber of the pgtypeslib. deccmp-
Compare two variables of type decimal.
The function receives a pointer to the first decimal value (int deccmp(decimal *arg1, decimal *arg2);arg1), a pointer to the second decimal value (arg2) and returns an integer value that indicates which is the bigger value. deccopy-
Copy a decimal value.
The function receives a pointer to the decimal value that should be copied as the first argument (void deccopy(decimal *src, decimal *target);src) and a pointer to the target structure of type decimal (target) as the second argument. deccvasc-
Convert a value from its ASCII representation into a decimal type.
The function receives a pointer to string that contains the string representation of the number to be converted (int deccvasc(char *cp, int len, decimal *np);cp) as well as its lengthlen.npis a pointer to the decimal value that saves the result of the operation.Valid formats are for example:
-2,.794,+3.44,592.49E07or-32.84e-4.The function returns 0 on success. If overflow or underflow occurred,
ECPG_INFORMIX_NUM_OVERFLOWorECPG_INFORMIX_NUM_UNDERFLOWis returned. If the ASCII representation could not be parsed,ECPG_INFORMIX_BAD_NUMERICis returned orECPG_INFORMIX_BAD_EXPONENTif this problem occurred while parsing the exponent. deccvdbl-
Convert a value of type double to a value of type decimal.
The function receives the variable of type double that should be converted as its first argument (int deccvdbl(double dbl, decimal *np);dbl). As the second argument (np), the function receives a pointer to the decimal variable that should hold the result of the operation.The function returns 0 on success and a negative value if the conversion failed.
deccvint-
Convert a value of type int to a value of type decimal.
The function receives the variable of type int that should be converted as its first argument (int deccvint(int in, decimal *np);in). As the second argument (np), the function receives a pointer to the decimal variable that should hold the result of the operation.The function returns 0 on success and a negative value if the conversion failed.
deccvlong-
Convert a value of type long to a value of type decimal.
The function receives the variable of type long that should be converted as its first argument (int deccvlong(long lng, decimal *np);lng). As the second argument (np), the function receives a pointer to the decimal variable that should hold the result of the operation.The function returns 0 on success and a negative value if the conversion failed.
decdiv-
Divide two variables of type decimal.
The function receives pointers to the variables that are the first (int decdiv(decimal *n1, decimal *n2, decimal *result);n1) and the second (n2) operands and calculatesn1/n2.resultis a pointer to the variable that should hold the result of the operation.On success, 0 is returned and a negative value if the division fails. If overflow or underflow occurred, the function returns
ECPG_INFORMIX_NUM_OVERFLOWorECPG_INFORMIX_NUM_UNDERFLOWrespectively. If an attempt to divide by zero is observed, the function returnsECPG_INFORMIX_DIVIDE_ZERO. decmul-
Multiply two decimal values.
The function receives pointers to the variables that are the first (int decmul(decimal *n1, decimal *n2, decimal *result);n1) and the second (n2) operands and calculatesn1*n2.resultis a pointer to the variable that should hold the result of the operation.On success, 0 is returned and a negative value if the multiplication fails. If overflow or underflow occurred, the function returns
ECPG_INFORMIX_NUM_OVERFLOWorECPG_INFORMIX_NUM_UNDERFLOWrespectively. decsub-
Subtract one decimal value from another.
The function receives pointers to the variables that are the first (int decsub(decimal *n1, decimal *n2, decimal *result);n1) and the second (n2) operands and calculatesn1-n2.resultis a pointer to the variable that should hold the result of the operation.On success, 0 is returned and a negative value if the subtraction fails. If overflow or underflow occurred, the function returns
ECPG_INFORMIX_NUM_OVERFLOWorECPG_INFORMIX_NUM_UNDERFLOWrespectively. dectoasc-
Convert a variable of type decimal to its ASCII representation in a C char* string.
The function receives a pointer to a variable of type decimal (int dectoasc(decimal *np, char *cp, int len, int right)np) that it converts to its textual representation.cpis the buffer that should hold the result of the operation. The parameterrightspecifies, how many digits right of the decimal point should be included in the output. The result will be rounded to this number of decimal digits. Settingrightto -1 indicates that all available decimal digits should be included in the output. If the length of the output buffer, which is indicated bylenis not sufficient to hold the textual representation including the trailing zero byte, only a single*character is stored in the result and -1 is returned.The function returns either -1 if the buffer
cpwas too small orECPG_INFORMIX_OUT_OF_MEMORYif memory was exhausted. dectodbl-
Convert a variable of type decimal to a double.
The function receives a pointer to the decimal value to convert (int dectodbl(decimal *np, double *dblp);np) and a pointer to the double variable that should hold the result of the operation (dblp).On success, 0 is returned and a negative value if the conversion failed.
dectoint-
Convert a variable of type decimal to an integer.
The function receives a pointer to the decimal value to convert (int dectoint(decimal *np, int *ip);np) and a pointer to the integer variable that should hold the result of the operation (ip).On success, 0 is returned and a negative value if the conversion failed. If an overflow occurred,
ECPG_INFORMIX_NUM_OVERFLOWis returned.Note that the ECPG implementation differs from the Informix implementation. Informix limits an integer to the range from -32767 to 32767, while the limits in the ECPG implementation depend on the architecture (
INT_MIN .. INT_MAX). dectolong-
Convert a variable of type decimal to a long integer.
The function receives a pointer to the decimal value to convert (int dectolong(decimal *np, long *lngp);np) and a pointer to the long variable that should hold the result of the operation (lngp).On success, 0 is returned and a negative value if the conversion failed. If an overflow occurred,
ECPG_INFORMIX_NUM_OVERFLOWis returned.Note that the ECPG implementation differs from the Informix implementation. Informix limits a long integer to the range from -2,147,483,647 to 2,147,483,647, while the limits in the ECPG implementation depend on the architecture (
-LONG_MAX .. LONG_MAX). rdatestr-
Converts a date to a C char* string.
The function receives two arguments, the first one is the date to convert (int rdatestr(date d, char *str);d) and the second one is a pointer to the target string. The output format is alwaysyyyy-mm-dd, so you need to allocate at least 11 bytes (including the zero-byte terminator) for the string.The function returns 0 on success and a negative value in case of error.
Note that ECPG's implementation differs from the Informix implementation. In Informix the format can be influenced by setting environment variables. In ECPG however, you cannot change the output format.
rstrdate-
Parse the textual representation of a date.
The function receives the textual representation of the date to convert (int rstrdate(char *str, date *d);str) and a pointer to a variable of type date (d). This function does not allow you to specify a format mask. It uses the default format mask of Informix which ismm/dd/yyyy. Internally, this function is implemented by means ofrdefmtdate. Therefore,rstrdateis not faster and if you have the choice you should opt forrdefmtdatewhich allows you to specify the format mask explicitly. rtoday-
Get the current date.
The function receives a pointer to a date variable (void rtoday(date *d);d) that it sets to the current date.Internally this function uses the PGTYPESdate_today function.
rjulmdy-
Extract the values for the day, the month and the year from a variable of type date.
The function receives the dateint rjulmdy(date d, short mdy[3]);dand a pointer to an array of 3 short integer valuesmdy. The variable name indicates the sequential order:mdy[0]will be set to contain the number of the month,mdy[1]will be set to the value of the day andmdy[2]will contain the year.The function always returns 0 at the moment.
Internally the function uses the PGTYPESdate_julmdy function.
rdefmtdate-
Use a format mask to convert a character string to a value of type date.
The function receives a pointer to the date value that should hold the result of the operation (int rdefmtdate(date *d, char *fmt, char *str);d), the format mask to use for parsing the date (fmt) and the C char* string containing the textual representation of the date (str). The textual representation is expected to match the format mask. However you do not need to have a 1:1 mapping of the string to the format mask. The function only analyzes the sequential order and looks for the literalsyyoryyyythat indicate the position of the year,mmto indicate the position of the month andddto indicate the position of the day.The function returns the following values:
- 0 - The function terminated successfully.
ECPG_INFORMIX_ENOSHORTDATE- The date does not contain delimiters between day, month and year. In this case the input string must be exactly 6 or 8 bytes long but isn't.ECPG_INFORMIX_ENOTDMY- The format string did not correctly indicate the sequential order of year, month and day.ECPG_INFORMIX_BAD_DAY- The input string does not contain a valid day.ECPG_INFORMIX_BAD_MONTH- The input string does not contain a valid month.ECPG_INFORMIX_BAD_YEAR- The input string does not contain a valid year.
Internally this function is implemented to use the PGTYPESdate_defmt_asc function. See the reference there for a table of example input.
rfmtdate-
Convert a variable of type date to its textual representation using a format mask.
The function receives the date to convert (int rfmtdate(date d, char *fmt, char *str);d), the format mask (fmt) and the string that will hold the textual representation of the date (str).On success, 0 is returned and a negative value if an error occurred.
Internally this function uses the PGTYPESdate_fmt_asc function, see the reference there for examples.
rmdyjul-
Create a date value from an array of 3 short integers that specify the day, the month and the year of the date.
The function receives the array of the 3 short integers (int rmdyjul(short mdy[3], date *d);mdy) and a pointer to a variable of type date that should hold the result of the operation.Currently the function returns always 0.
Internally the function is implemented to use the function PGTYPESdate_mdyjul.
rdayofweek-
Return a number representing the day of the week for a date value.
The function receives the date variableint rdayofweek(date d);das its only argument and returns an integer that indicates the day of the week for this date.- 0 - Sunday
- 1 - Monday
- 2 - Tuesday
- 3 - Wednesday
- 4 - Thursday
- 5 - Friday
- 6 - Saturday
Internally the function is implemented to use the function PGTYPESdate_dayofweek.
dtcurrent-
Retrieve the current timestamp.
The function retrieves the current timestamp and saves it into the timestamp variable thatvoid dtcurrent(timestamp *ts);tspoints to. dtcvasc-
Parses a timestamp from its textual representation into a timestamp variable.
The function receives the string to parse (int dtcvasc(char *str, timestamp *ts);str) and a pointer to the timestamp variable that should hold the result of the operation (ts).The function returns 0 on success and a negative value in case of error.
Internally this function uses the PGTYPEStimestamp_from_asc function. See the reference there for a table with example inputs.
dtcvfmtasc-
Parses a timestamp from its textual representation using a format mask into a timestamp variable.
The function receives the string to parse (dtcvfmtasc(char *inbuf, char *fmtstr, timestamp *dtvalue)inbuf), the format mask to use (fmtstr) and a pointer to the timestamp variable that should hold the result of the operation (dtvalue).This function is implemented by means of the PGTYPEStimestamp_defmt_asc function. See the documentation there for a list of format specifiers that can be used.
The function returns 0 on success and a negative value in case of error.
dtsub-
Subtract one timestamp from another and return a variable of type interval.
The function will subtract the timestamp variable thatint dtsub(timestamp *ts1, timestamp *ts2, interval *iv);ts2points to from the timestamp variable thatts1points to and will store the result in the interval variable thativpoints to.Upon success, the function returns 0 and a negative value if an error occurred.
dttoasc-
Convert a timestamp variable to a C char* string.
The function receives a pointer to the timestamp variable to convert (int dttoasc(timestamp *ts, char *output);ts) and the string that should hold the result of the operation (output). It convertststo its textual representation according to the SQL standard, which is beYYYY-MM-DD HH:MM:SS.Upon success, the function returns 0 and a negative value if an error occurred.
dttofmtasc-
Convert a timestamp variable to a C char* using a format mask.
The function receives a pointer to the timestamp to convert as its first argument (int dttofmtasc(timestamp *ts, char *output, int str_len, char *fmtstr);ts), a pointer to the output buffer (output), the maximal length that has been allocated for the output buffer (str_len) and the format mask to use for the conversion (fmtstr).Upon success, the function returns 0 and a negative value if an error occurred.
Internally, this function uses the PGTYPEStimestamp_fmt_asc function. See the reference there for information on what format mask specifiers can be used.
intoasc-
Convert an interval variable to a C char* string.
The function receives a pointer to the interval variable to convert (int intoasc(interval *i, char *str);i) and the string that should hold the result of the operation (str). It convertsito its textual representation according to the SQL standard, which is beYYYY-MM-DD HH:MM:SS.Upon success, the function returns 0 and a negative value if an error occurred.
rfmtlong-
Convert a long integer value to its textual representation using a format mask.
The function receives the long valueint rfmtlong(long lng_val, char *fmt, char *outbuf);lng_val, the format maskfmtand a pointer to the output bufferoutbuf. It converts the long value according to the format mask to its textual representation.The format mask can be composed of the following format specifying characters:
*(asterisk) - if this position would be blank otherwise, fill it with an asterisk.&(ampersand) - if this position would be blank otherwise, fill it with a zero.#- turn leading zeroes into blanks.<- left-justify the number in the string.,(comma) - group numbers of four or more digits into groups of three digits separated by a comma..(period) - this character separates the whole-number part of the number from the fractional part.-(minus) - the minus sign appears if the number is a negative value.+(plus) - the plus sign appears if the number is a positive value.(- this replaces the minus sign in front of the negative number. The minus sign will not appear.)- this character replaces the minus and is printed behind the negative value.$- the currency symbol.
rupshift-
Convert a string to upper case.
The function receives a pointer to the string and transforms every lower case character to upper case.void rupshift(char *str); byleng-
Return the number of characters in a string without counting trailing blanks.
The function expects a fixed-length string as its first argument (int byleng(char *str, int len);str) and its length as its second argument (len). It returns the number of significant characters, that is the length of the string without trailing blanks. ldchar-
Copy a fixed-length string into a null-terminated string.
The function receives the fixed-length string to copy (void ldchar(char *src, int len, char *dest);src), its length (len) and a pointer to the destination memory (dest). Note that you need to reserve at leastlen+1bytes for the string thatdestpoints to. The function copies at mostlenbytes to the new location (less if the source string has trailing blanks) and adds the null-terminator. rgetmsg-
```
int rgetmsg(int msgnum, char *s, int maxsize); ``` This function exists but is not implemented at the moment!
rtypalign-
```
int rtypalign(int offset, int type); ``` This function exists but is not implemented at the moment!
rtypmsize-
```
int rtypmsize(int type, int len); ``` This function exists but is not implemented at the moment!
rtypwidth-
```
int rtypwidth(int sqltype, int sqllen); ``` This function exists but is not implemented at the moment!
rsetnull-
Set a variable to NULL.
The function receives an integer that indicates the type of the variable and a pointer to the variable itself that is cast to a C char* pointer.int rsetnull(int t, char *ptr);The following types exist:
CCHARTYPE- For a variable of typecharorchar*CSHORTTYPE- For a variable of typeshort intCINTTYPE- For a variable of typeintCBOOLTYPE- For a variable of typebooleanCFLOATTYPE- For a variable of typefloatCLONGTYPE- For a variable of typelongCDOUBLETYPE- For a variable of typedoubleCDECIMALTYPE- For a variable of typedecimalCDATETYPE- For a variable of typedateCDTIMETYPE- For a variable of typetimestamp
Here is an example of a call to this function:
$char c[] = "abc "; $short s = 17; $int i = -74874; rsetnull(CCHARTYPE, (char *) c); rsetnull(CSHORTTYPE, (char *) &s); rsetnull(CINTTYPE, (char *) &i); risnull-
Test if a variable is NULL.
The function receives the type of the variable to test (int risnull(int t, char *ptr);t) as well a pointer to this variable (ptr). Note that the latter needs to be cast to a char*. See the function rsetnull for a list of possible variable types.Here is an example of how to use this function:
$char c[] = "abc "; $short s = 17; $int i = -74874; risnull(CCHARTYPE, (char *) c); risnull(CSHORTTYPE, (char *) &s); risnull(CINTTYPE, (char *) &i);
Additional Constants
Note that all constants here describe errors and all of them are defined to represent negative values. In the descriptions of the different constants you can also find the value that the constants represent in the current implementation. However you should not rely on this number. You can however rely on the fact all of them are defined to represent negative values.
ECPG_INFORMIX_NUM_OVERFLOW- Functions return this value if an overflow occurred in a calculation. Internally it is defined as -1200 (the Informix definition).
ECPG_INFORMIX_NUM_UNDERFLOW- Functions return this value if an underflow occurred in a calculation. Internally it is defined as -1201 (the Informix definition).
ECPG_INFORMIX_DIVIDE_ZERO- Functions return this value if an attempt to divide by zero is observed. Internally it is defined as -1202 (the Informix definition).
ECPG_INFORMIX_BAD_YEAR- Functions return this value if a bad value for a year was found while parsing a date. Internally it is defined as -1204 (the Informix definition).
ECPG_INFORMIX_BAD_MONTH- Functions return this value if a bad value for a month was found while parsing a date. Internally it is defined as -1205 (the Informix definition).
ECPG_INFORMIX_BAD_DAY- Functions return this value if a bad value for a day was found while parsing a date. Internally it is defined as -1206 (the Informix definition).
ECPG_INFORMIX_ENOSHORTDATE- Functions return this value if a parsing routine needs a short date representation but did not get the date string in the right length. Internally it is defined as -1209 (the Informix definition).
ECPG_INFORMIX_DATE_CONVERT- Functions return this value if an error occurred during date formatting. Internally it is defined as -1210 (the Informix definition).
ECPG_INFORMIX_OUT_OF_MEMORY- Functions return this value if memory was exhausted during their operation. Internally it is defined as -1211 (the Informix definition).
ECPG_INFORMIX_ENOTDMY- Functions return this value if a parsing routine was supposed to get a format mask (like
mmddyy) but not all fields were listed correctly. Internally it is defined as -1212 (the Informix definition). ECPG_INFORMIX_BAD_NUMERIC- Functions return this value either if a parsing routine cannot parse the textual representation for a numeric value because it contains errors or if a routine cannot complete a calculation involving numeric variables because at least one of the numeric variables is invalid. Internally it is defined as -1213 (the Informix definition).
ECPG_INFORMIX_BAD_EXPONENT- Functions return this value if a parsing routine cannot parse an exponent. Internally it is defined as -1216 (the Informix definition).
ECPG_INFORMIX_BAD_DATE- Functions return this value if a parsing routine cannot parse a date. Internally it is defined as -1218 (the Informix definition).
ECPG_INFORMIX_EXTRA_CHARS- Functions return this value if a parsing routine is passed extra characters it cannot parse. Internally it is defined as -1264 (the Informix definition).