Skip to content

Commit 4505653

Browse files
author
Michael Meskes
committed
Added just another compatibility level for Informix.
1 parent b143210 commit 4505653

File tree

11 files changed

+50
-31
lines changed

11 files changed

+50
-31
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,16 @@ Fri Jun 20 15:34:29 CEST 2003
15141514
Sun Jun 22 11:20:29 CEST 2003
15151515

15161516
- Fixed missing '\0' in output char pointer.
1517+
1518+
Wed Jun 25 09:29:34 CEST 2003
1519+
1520+
- Synced keyword.x and preproc.y/gram.y.
1521+
- Implemented Informix special way to treat NULLs.
1522+
1523+
Thu Jun 26 13:26:13 CEST 2003
1524+
1525+
- Added another compatibility level INFORMIX_SE.
1526+
- Synced again.
15171527
- Set ecpg version to 3.0.0
15181528
- Set ecpg library to 4.0.0
15191529
- Set pgtypes library to 1.0.0

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.8 2003/06/25 10:44:21 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.9 2003/06/26 11:37:05 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -304,7 +304,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
304304

305305
ECPGinit_sqlca(sqlca);
306306

307-
if (compat == ECPG_COMPAT_INFORMIX)
307+
if (INFORMIX_MODE(compat))
308308
{
309309
char *envname;
310310

src/interfaces/ecpg/ecpglib/data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.8 2003/06/25 10:44:21 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.9 2003/06/26 11:37:05 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -78,7 +78,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
7878
break;
7979
#endif /* HAVE_LONG_LONG_INT_64 */
8080
case ECPGt_NO_INDICATOR:
81-
if (force_indicator == false && compat == ECPG_COMPAT_INFORMIX)
81+
if (force_indicator == false)
8282
{
8383
/* Informix has an additional way to specify NULLs
8484
* note that this uses special values to denote NULL */

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.12 2003/06/25 10:44:21 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.13 2003/06/26 11:37:05 meskes Exp $ */
22

33
/*
44
* 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,
508508
break;
509509
#endif /* HAVE_LONG_LONG_INT_64 */
510510
case ECPGt_NO_INDICATOR:
511-
if (stmt->force_indicator == false && stmt->compat == ECPG_COMPAT_INFORMIX)
511+
if (stmt->force_indicator == false)
512512
{
513513
if (ECPGis_informix_null(var->type, var->value))
514514
*tobeinserted_p = "null";
@@ -1186,7 +1186,9 @@ ECPGexecute(struct statement * stmt)
11861186
sqlca->sqlerrd[1] = PQoidValue(results);
11871187
sqlca->sqlerrd[2] = atol(PQcmdTuples(results));
11881188
ECPGlog("ECPGexecute line %d Ok: %s\n", stmt->lineno, cmdstat);
1189-
if (!sqlca->sqlerrd[2] && ( !strncmp(cmdstat, "UPDATE", 6)
1189+
if (stmt->compat != ECPG_COMPAT_INFORMIX_SE &&
1190+
!sqlca->sqlerrd[2] &&
1191+
( !strncmp(cmdstat, "UPDATE", 6)
11901192
|| !strncmp(cmdstat, "INSERT", 6)
11911193
|| !strncmp(cmdstat, "DELETE", 6)))
11921194
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, NULL);

src/interfaces/ecpg/ecpglib/extern.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#include "libpq-fe.h"
66
#include "sqlca.h"
77

8-
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX};
8+
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE};
9+
#define INFORMIX_MODE(X) ((X) == ECPG_COMPAT_INFORMIX || (X) == ECPG_COMPAT_INFORMIX_SE)
910

1011
/* Here are some methods used by the lib. */
1112

src/interfaces/ecpg/ecpglib/prepare.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.4 2003/06/25 10:44:21 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.5 2003/06/26 11:37:05 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -110,7 +110,7 @@ ECPGdeallocate(int lineno, int c, char *name)
110110
bool ret = ECPGdeallocate_one(lineno, name);
111111
enum COMPAT_MODE compat = c;
112112

113-
if (compat == ECPG_COMPAT_INFORMIX)
113+
if (INFORMIX_MODE(compat))
114114
{
115115
/* Just ignore all errors since we do not know the list of cursors we
116116
* are allowed to free. We have to trust that the software. */

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.74 2003/06/25 10:44:21 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.75 2003/06/26 11:37:05 meskes Exp $ */
22

33
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
44
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -45,7 +45,9 @@ help(const char *progname)
4545
printf(" -d generate parser debug output\n");
4646
#endif
4747
printf(" -C <mode> set compatibility mode\n"
48-
" mode may be \"INFORMIX\" only at the moment\n");
48+
" mode may be one of\n"
49+
" \"INFORMIX\"\n"
50+
" \"INFORMIX_SE\"\n");
4951
printf(" -r <option> specify runtime behaviour\n"
5052
" option may be only \"no_indicator\" at the moment\n");
5153
printf(" -D SYMBOL define SYMBOL\n");
@@ -165,9 +167,9 @@ main(int argc, char *const argv[])
165167
system_includes = true;
166168
break;
167169
case 'C':
168-
if (strcmp(optarg, "INFORMIX") == 0)
170+
if (strncmp(optarg, "INFORMIX", strlen("INFORMIX")) == 0)
169171
{
170-
compat = ECPG_COMPAT_INFORMIX;
172+
compat = (strcmp(optarg, "INFORMIX") == 0) ? ECPG_COMPAT_INFORMIX : ECPG_COMPAT_INFORMIX_SE;
171173
/* system_includes = true; */
172174
add_preprocessor_define("dec_t=Numeric");
173175
add_preprocessor_define("intrvl_t=Interval");
@@ -383,7 +385,7 @@ main(int argc, char *const argv[])
383385
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);
384386

385387
/* add some compatibility headers */
386-
if (compat == ECPG_COMPAT_INFORMIX)
388+
if (INFORMIX_MODE)
387389
fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
388390

389391
/* and parse the source */

src/interfaces/ecpg/preproc/extern.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ extern ScanKeyword *ScanKeywordLookup(char *text);
9696
#define INDICATOR_NOT_STRUCT 6
9797
#define INDICATOR_NOT_SIMPLE 7
9898

99-
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX};
99+
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE};
100100
extern enum COMPAT_MODE compat;
101+
#define INFORMIX_MODE (compat == ECPG_COMPAT_INFORMIX || compat == ECPG_COMPAT_INFORMIX_SE)
101102

102103
#endif /* _ECPG_PREPROC_EXTERN_H */

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.117 2003/06/20 15:16:06 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.118 2003/06/26 11:37:05 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -420,7 +420,7 @@ cppline {space}*#(.*\\{space})+.*
420420
<SQL>{typecast} { return TYPECAST; }
421421
<SQL>{informix_special} {
422422
/* are we simulating Informix? */
423-
if (compat == ECPG_COMPAT_INFORMIX)
423+
if (INFORMIX_MODE)
424424
{
425425
unput(':');
426426
}
@@ -605,7 +605,7 @@ cppline {space}*#(.*\\{space})+.*
605605
<C>{exec_sql} { BEGIN SQL; return SQL_START; }
606606
<C>{informix_special} {
607607
/* are we simulating Informix? */
608-
if (compat == ECPG_COMPAT_INFORMIX)
608+
if (INFORMIX_MODE)
609609
{
610610
BEGIN SQL;
611611
return SQL_START;
@@ -715,7 +715,7 @@ cppline {space}*#(.*\\{space})+.*
715715
<C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
716716
<C>{informix_special}{define}{space}* {
717717
/* are we simulating Informix? */
718-
if (compat == ECPG_COMPAT_INFORMIX)
718+
if (INFORMIX_MODE)
719719
{
720720
BEGIN(def_ident);
721721
}
@@ -730,7 +730,7 @@ cppline {space}*#(.*\\{space})+.*
730730
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
731731
<C>{informix_special}{include}{space}* {
732732
/* are we simulating Informix? */
733-
if (compat == ECPG_COMPAT_INFORMIX)
733+
if (INFORMIX_MODE)
734734
{
735735
BEGIN(incl);
736736
}
@@ -745,7 +745,7 @@ cppline {space}*#(.*\\{space})+.*
745745
<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); }
746746
<C,xskip>{informix_special}{ifdef}{space}* {
747747
/* are we simulating Informix? */
748-
if (compat == ECPG_COMPAT_INFORMIX)
748+
if (INFORMIX_MODE)
749749
{
750750
ifcond = TRUE;
751751
BEGIN(xcond);
@@ -761,7 +761,7 @@ cppline {space}*#(.*\\{space})+.*
761761
<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
762762
<C,xskip>{informix_special}{ifndef}{space}* {
763763
/* are we simulating Informix? */
764-
if (compat == ECPG_COMPAT_INFORMIX)
764+
if (INFORMIX_MODE)
765765
{
766766
ifcond = FALSE;
767767
BEGIN(xcond);
@@ -787,7 +787,7 @@ cppline {space}*#(.*\\{space})+.*
787787
}
788788
<C,xskip>{informix_special}{elif}{space}* {
789789
/* are we simulating Informix? */
790-
if (compat == ECPG_COMPAT_INFORMIX)
790+
if (INFORMIX_MODE)
791791
{
792792
if ( preproc_tos == 0 ) {
793793
mmerror(PARSE_ERROR, ET_FATAL, "Missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
@@ -826,7 +826,7 @@ cppline {space}*#(.*\\{space})+.*
826826
}
827827
<C,xskip>{informix_special}{else}{space}* {
828828
/* are we simulating Informix? */
829-
if (compat == ECPG_COMPAT_INFORMIX)
829+
if (INFORMIX_MODE)
830830
{
831831
if ( stacked_if_value[preproc_tos].else_branch ) {
832832
mmerror(PARSE_ERROR, ET_FATAL, "Duplicated 'EXEC SQL ELSE;'");
@@ -864,7 +864,7 @@ cppline {space}*#(.*\\{space})+.*
864864
}
865865
<C,xskip>{informix_special}{endif}{space}*";" {
866866
/* are we simulating Informix? */
867-
if (compat == ECPG_COMPAT_INFORMIX)
867+
if (INFORMIX_MODE)
868868
{
869869
if ( preproc_tos == 0 )
870870
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.239 2003/06/25 21:30:33 momjian Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.240 2003/06/26 11:37:05 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -2674,7 +2674,7 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
26742674
argsinsert = argsresult = NULL;
26752675
cur = this;
26762676

2677-
if (compat == ECPG_COMPAT_INFORMIX)
2677+
if (INFORMIX_MODE)
26782678
$$ = cat_str(5, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("/*"), mm_strdup(this->command), make_str("*/"));
26792679
else
26802680
$$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
@@ -3476,8 +3476,6 @@ a_expr: c_expr
34763476
{ $$ = cat_str(3, $1, make_str("not in"), $4); }
34773477
| a_expr qual_all_Op sub_type select_with_parens %prec Op
34783478
{ $$ = cat_str(4, $1, $2, $3, $4); }
3479-
| a_expr qual_all_Op sub_type '(' a_expr ')' %prec Op
3480-
{ $$ = cat_str(6, $1, $2, $3, make_str("("), $5, make_str(")")); }
34813479
| UNIQUE select_with_parens %prec Op
34823480
{ $$ = cat2_str(make_str("unique"), $2); }
34833481
| r_expr

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy