mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fixed double definition of ecpg_compat_mode.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.3 2003/04/08 12:34:25 meskes Exp $ */
 | 
					/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.4 2003/05/02 14:43:25 meskes Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "postgres_fe.h"
 | 
					#include "postgres_fe.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -11,8 +11,6 @@
 | 
				
			|||||||
static struct connection *all_connections = NULL,
 | 
					static struct connection *all_connections = NULL,
 | 
				
			||||||
		   *actual_connection = NULL;
 | 
							   *actual_connection = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern enum COMPAT_MODE ecpg_compat_mode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct connection *
 | 
					struct connection *
 | 
				
			||||||
ECPGget_connection(const char *connection_name)
 | 
					ECPGget_connection(const char *connection_name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -259,6 +257,20 @@ ECPGnoticeProcessor(void *arg, const char *message)
 | 
				
			|||||||
	sqlca.sqlwarn[0] = 'W';
 | 
						sqlca.sqlwarn[0] = 'W';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* this contains some quick hacks, needs to be cleaned up, but it works */
 | 
				
			||||||
 | 
					bool
 | 
				
			||||||
 | 
					ECPGconnect_informix(int lineno, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char *informix_name = (char *)name, *envname;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						/* Informix uses an environment variable DBPATH that overrides
 | 
				
			||||||
 | 
						 * the connection parameters given here */
 | 
				
			||||||
 | 
						envname = getenv("DBPATH");
 | 
				
			||||||
 | 
						if (envname)
 | 
				
			||||||
 | 
							informix_name = envname;
 | 
				
			||||||
 | 
						return (ECPGconnect(lineno, informix_name, user, passwd, connection_name, autocommit));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
/* this contains some quick hacks, needs to be cleaned up, but it works */
 | 
					/* this contains some quick hacks, needs to be cleaned up, but it works */
 | 
				
			||||||
bool
 | 
					bool
 | 
				
			||||||
ECPGconnect(int lineno, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
 | 
					ECPGconnect(int lineno, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
 | 
				
			||||||
@@ -269,26 +281,13 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 | 
				
			|||||||
			   *tmp,
 | 
								   *tmp,
 | 
				
			||||||
			   *port = NULL,
 | 
								   *port = NULL,
 | 
				
			||||||
			   *realname = NULL,
 | 
								   *realname = NULL,
 | 
				
			||||||
			   *options = NULL,
 | 
								   *options = NULL;
 | 
				
			||||||
			   *envname;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ECPGinit_sqlca();
 | 
						ECPGinit_sqlca();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((this = (struct connection *) ECPGalloc(sizeof(struct connection), lineno)) == NULL)
 | 
						if ((this = (struct connection *) ECPGalloc(sizeof(struct connection), lineno)) == NULL)
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ecpg_compat_mode == ECPG_COMPAT_INFORMIX)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		/* Informix uses an environment variable DBPATH that overrides
 | 
					 | 
				
			||||||
		 * the connection parameters given here */
 | 
					 | 
				
			||||||
		envname = getenv("DBPATH");
 | 
					 | 
				
			||||||
		if (envname)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			free(dbname);
 | 
					 | 
				
			||||||
			dbname=strdup(envname);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if (dbname == NULL && connection_name == NULL)
 | 
						if (dbname == NULL && connection_name == NULL)
 | 
				
			||||||
		connection_name = "DEFAULT";
 | 
							connection_name = "DEFAULT";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,6 +42,7 @@ void		ECPGdebug(int, FILE *);
 | 
				
			|||||||
bool		ECPGstatus(int, const char *);
 | 
					bool		ECPGstatus(int, const char *);
 | 
				
			||||||
bool		ECPGsetcommit(int, const char *, const char *);
 | 
					bool		ECPGsetcommit(int, const char *, const char *);
 | 
				
			||||||
bool		ECPGsetconn(int, const char *);
 | 
					bool		ECPGsetconn(int, const char *);
 | 
				
			||||||
 | 
					bool		ECPGconnect_informix(int, const char *, const char *, const char *, const char *, int);
 | 
				
			||||||
bool		ECPGconnect(int, const char *, const char *, const char *, const char *, int);
 | 
					bool		ECPGconnect(int, const char *, const char *, const char *, const char *, int);
 | 
				
			||||||
bool		ECPGdo(int, const char *, char *,...);
 | 
					bool		ECPGdo(int, const char *, char *,...);
 | 
				
			||||||
bool		ECPGtrans(int, const char *, const char *);
 | 
					bool		ECPGtrans(int, const char *, const char *);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.67 2003/05/01 17:16:57 meskes Exp $ */
 | 
					/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.68 2003/05/02 14:43:25 meskes Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
 | 
					/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
 | 
				
			||||||
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
 | 
					/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
 | 
				
			||||||
@@ -339,7 +339,7 @@ main(int argc, char *const argv[])
 | 
				
			|||||||
				lex_init();
 | 
									lex_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				/* we need several includes */
 | 
									/* we need several includes */
 | 
				
			||||||
				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\"\nenum COMPAT_MODE ecpg_compat_mode=%d;\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename, compat);
 | 
									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 */
 | 
									/* add some compatibility headers */
 | 
				
			||||||
				if (compat == ECPG_COMPAT_INFORMIX)
 | 
									if (compat == ECPG_COMPAT_INFORMIX)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.215 2003/03/27 14:29:17 meskes Exp $ */
 | 
					/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.216 2003/05/02 14:43:25 meskes Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Copyright comment */
 | 
					/* Copyright comment */
 | 
				
			||||||
%{
 | 
					%{
 | 
				
			||||||
@@ -528,6 +528,9 @@ stmt:  AlterDatabaseSetStmt { output_statement($1, 0, connection); }
 | 
				
			|||||||
			if (connection)
 | 
								if (connection)
 | 
				
			||||||
				mmerror(PARSE_ERROR, ET_ERROR, "no at option for connect statement.\n");
 | 
									mmerror(PARSE_ERROR, ET_ERROR, "no at option for connect statement.\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (compat == ECPG_COMPAT_INFORMIX)
 | 
				
			||||||
 | 
									fprintf(yyout, "{ ECPGconnect_informix(__LINE__, %s, %d); ", $1, autocommit);
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
				fprintf(yyout, "{ ECPGconnect(__LINE__, %s, %d); ", $1, autocommit);
 | 
									fprintf(yyout, "{ ECPGconnect(__LINE__, %s, %d); ", $1, autocommit);
 | 
				
			||||||
			reset_variables();
 | 
								reset_variables();
 | 
				
			||||||
			whenever_action(2);
 | 
								whenever_action(2);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user