Commit 4505653e authored by Michael Meskes's avatar Michael Meskes

Added just another compatibility level for Informix.

parent b1432106
......@@ -1514,6 +1514,16 @@ Fri Jun 20 15:34:29 CEST 2003
Sun Jun 22 11:20:29 CEST 2003
- Fixed missing '\0' in output char pointer.
Wed Jun 25 09:29:34 CEST 2003
- Synced keyword.x and preproc.y/gram.y.
- Implemented Informix special way to treat NULLs.
Thu Jun 26 13:26:13 CEST 2003
- Added another compatibility level INFORMIX_SE.
- Synced again.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.8 2003/06/25 10:44:21 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.9 2003/06/26 11:37:05 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
......@@ -304,7 +304,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
ECPGinit_sqlca(sqlca);
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE(compat))
{
char *envname;
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.8 2003/06/25 10:44:21 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.9 2003/06/26 11:37:05 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
......@@ -78,7 +78,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
break;
#endif /* HAVE_LONG_LONG_INT_64 */
case ECPGt_NO_INDICATOR:
if (force_indicator == false && compat == ECPG_COMPAT_INFORMIX)
if (force_indicator == false)
{
/* Informix has an additional way to specify NULLs
* note that this uses special values to denote NULL */
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.12 2003/06/25 10:44:21 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.13 2003/06/26 11:37:05 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
......@@ -508,7 +508,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
break;
#endif /* HAVE_LONG_LONG_INT_64 */
case ECPGt_NO_INDICATOR:
if (stmt->force_indicator == false && stmt->compat == ECPG_COMPAT_INFORMIX)
if (stmt->force_indicator == false)
{
if (ECPGis_informix_null(var->type, var->value))
*tobeinserted_p = "null";
......@@ -1186,7 +1186,9 @@ ECPGexecute(struct statement * stmt)
sqlca->sqlerrd[1] = PQoidValue(results);
sqlca->sqlerrd[2] = atol(PQcmdTuples(results));
ECPGlog("ECPGexecute line %d Ok: %s\n", stmt->lineno, cmdstat);
if (!sqlca->sqlerrd[2] && ( !strncmp(cmdstat, "UPDATE", 6)
if (stmt->compat != ECPG_COMPAT_INFORMIX_SE &&
!sqlca->sqlerrd[2] &&
( !strncmp(cmdstat, "UPDATE", 6)
|| !strncmp(cmdstat, "INSERT", 6)
|| !strncmp(cmdstat, "DELETE", 6)))
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, NULL);
......
......@@ -5,7 +5,8 @@
#include "libpq-fe.h"
#include "sqlca.h"
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX};
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE};
#define INFORMIX_MODE(X) ((X) == ECPG_COMPAT_INFORMIX || (X) == ECPG_COMPAT_INFORMIX_SE)
/* Here are some methods used by the lib. */
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.4 2003/06/25 10:44:21 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.5 2003/06/26 11:37:05 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
......@@ -110,7 +110,7 @@ ECPGdeallocate(int lineno, int c, char *name)
bool ret = ECPGdeallocate_one(lineno, name);
enum COMPAT_MODE compat = c;
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE(compat))
{
/* Just ignore all errors since we do not know the list of cursors we
* are allowed to free. We have to trust that the software. */
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.74 2003/06/25 10:44:21 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.75 2003/06/26 11:37:05 meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
......@@ -45,7 +45,9 @@ help(const char *progname)
printf(" -d generate parser debug output\n");
#endif
printf(" -C <mode> set compatibility mode\n"
" mode may be \"INFORMIX\" only at the moment\n");
" mode may be one of\n"
" \"INFORMIX\"\n"
" \"INFORMIX_SE\"\n");
printf(" -r <option> specify runtime behaviour\n"
" option may be only \"no_indicator\" at the moment\n");
printf(" -D SYMBOL define SYMBOL\n");
......@@ -165,9 +167,9 @@ main(int argc, char *const argv[])
system_includes = true;
break;
case 'C':
if (strcmp(optarg, "INFORMIX") == 0)
if (strncmp(optarg, "INFORMIX", strlen("INFORMIX")) == 0)
{
compat = ECPG_COMPAT_INFORMIX;
compat = (strcmp(optarg, "INFORMIX") == 0) ? ECPG_COMPAT_INFORMIX : ECPG_COMPAT_INFORMIX_SE;
/* system_includes = true; */
add_preprocessor_define("dec_t=Numeric");
add_preprocessor_define("intrvl_t=Interval");
......@@ -383,7 +385,7 @@ main(int argc, char *const argv[])
fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These four include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
/* add some compatibility headers */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
/* and parse the source */
......
......@@ -96,7 +96,8 @@ extern ScanKeyword *ScanKeywordLookup(char *text);
#define INDICATOR_NOT_STRUCT 6
#define INDICATOR_NOT_SIMPLE 7
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX};
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE};
extern enum COMPAT_MODE compat;
#define INFORMIX_MODE (compat == ECPG_COMPAT_INFORMIX || compat == ECPG_COMPAT_INFORMIX_SE)
#endif /* _ECPG_PREPROC_EXTERN_H */
......@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.117 2003/06/20 15:16:06 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.118 2003/06/26 11:37:05 meskes Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -420,7 +420,7 @@ cppline {space}*#(.*\\{space})+.*
<SQL>{typecast} { return TYPECAST; }
<SQL>{informix_special} {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
unput(':');
}
......@@ -605,7 +605,7 @@ cppline {space}*#(.*\\{space})+.*
<C>{exec_sql} { BEGIN SQL; return SQL_START; }
<C>{informix_special} {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
BEGIN SQL;
return SQL_START;
......@@ -715,7 +715,7 @@ cppline {space}*#(.*\\{space})+.*
<C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
<C>{informix_special}{define}{space}* {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
BEGIN(def_ident);
}
......@@ -730,7 +730,7 @@ cppline {space}*#(.*\\{space})+.*
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
<C>{informix_special}{include}{space}* {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
BEGIN(incl);
}
......@@ -745,7 +745,7 @@ cppline {space}*#(.*\\{space})+.*
<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); }
<C,xskip>{informix_special}{ifdef}{space}* {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
ifcond = TRUE;
BEGIN(xcond);
......@@ -761,7 +761,7 @@ cppline {space}*#(.*\\{space})+.*
<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
<C,xskip>{informix_special}{ifndef}{space}* {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
ifcond = FALSE;
BEGIN(xcond);
......@@ -787,7 +787,7 @@ cppline {space}*#(.*\\{space})+.*
}
<C,xskip>{informix_special}{elif}{space}* {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
if ( preproc_tos == 0 ) {
mmerror(PARSE_ERROR, ET_FATAL, "Missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
......@@ -826,7 +826,7 @@ cppline {space}*#(.*\\{space})+.*
}
<C,xskip>{informix_special}{else}{space}* {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
if ( stacked_if_value[preproc_tos].else_branch ) {
mmerror(PARSE_ERROR, ET_FATAL, "Duplicated 'EXEC SQL ELSE;'");
......@@ -864,7 +864,7 @@ cppline {space}*#(.*\\{space})+.*
}
<C,xskip>{informix_special}{endif}{space}*";" {
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
{
if ( preproc_tos == 0 )
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.239 2003/06/25 21:30:33 momjian Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.240 2003/06/26 11:37:05 meskes Exp $ */
/* Copyright comment */
%{
......@@ -2674,7 +2674,7 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
argsinsert = argsresult = NULL;
cur = this;
if (compat == ECPG_COMPAT_INFORMIX)
if (INFORMIX_MODE)
$$ = cat_str(5, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("/*"), mm_strdup(this->command), make_str("*/"));
else
$$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
......@@ -3476,8 +3476,6 @@ a_expr: c_expr
{ $$ = cat_str(3, $1, make_str("not in"), $4); }
| a_expr qual_all_Op sub_type select_with_parens %prec Op
{ $$ = cat_str(4, $1, $2, $3, $4); }
| a_expr qual_all_Op sub_type '(' a_expr ')' %prec Op
{ $$ = cat_str(6, $1, $2, $3, make_str("("), $5, make_str(")")); }
| UNIQUE select_with_parens %prec Op
{ $$ = cat2_str(make_str("unique"), $2); }
| r_expr
......
......@@ -35,7 +35,12 @@ int main()
printf("%d %d\n", i, j);
}
$delete from test where i=87;
printf("delete: %ld\n", sqlca.sqlcode);
$commit;
$drop table test;
$commit;
$disconnect;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment