Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7d8362

Browse files
author
Michael Meskes
committed
Fixed double definition of ecpg_compat_mode.
1 parent9e9d8d5 commitf7d8362

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

‎src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 16 additions & 17 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.3 2003/04/08 12:34:25 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.4 2003/05/02 14:43:25 meskes Exp $ */
22

33
#include"postgres_fe.h"
44

@@ -11,8 +11,6 @@
1111
staticstructconnection*all_connections=NULL,
1212
*actual_connection=NULL;
1313

14-
externenumCOMPAT_MODEecpg_compat_mode;
15-
1614
structconnection*
1715
ECPGget_connection(constchar*connection_name)
1816
{
@@ -259,6 +257,20 @@ ECPGnoticeProcessor(void *arg, const char *message)
259257
sqlca.sqlwarn[0]='W';
260258
}
261259

260+
/* this contains some quick hacks, needs to be cleaned up, but it works */
261+
bool
262+
ECPGconnect_informix(intlineno,constchar*name,constchar*user,constchar*passwd,constchar*connection_name,intautocommit)
263+
{
264+
char*informix_name= (char*)name,*envname;
265+
266+
/* Informix uses an environment variable DBPATH that overrides
267+
* the connection parameters given here */
268+
envname=getenv("DBPATH");
269+
if (envname)
270+
informix_name=envname;
271+
return (ECPGconnect(lineno,informix_name,user,passwd,connection_name,autocommit));
272+
}
273+
262274
/* this contains some quick hacks, needs to be cleaned up, but it works */
263275
bool
264276
ECPGconnect(intlineno,constchar*name,constchar*user,constchar*passwd,constchar*connection_name,intautocommit)
@@ -269,26 +281,13 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
269281
*tmp,
270282
*port=NULL,
271283
*realname=NULL,
272-
*options=NULL,
273-
*envname;
284+
*options=NULL;
274285

275286
ECPGinit_sqlca();
276287

277288
if ((this= (structconnection*)ECPGalloc(sizeof(structconnection),lineno))==NULL)
278289
return false;
279290

280-
if (ecpg_compat_mode==ECPG_COMPAT_INFORMIX)
281-
{
282-
/* Informix uses an environment variable DBPATH that overrides
283-
* the connection parameters given here */
284-
envname=getenv("DBPATH");
285-
if (envname)
286-
{
287-
free(dbname);
288-
dbname=strdup(envname);
289-
}
290-
}
291-
292291
if (dbname==NULL&&connection_name==NULL)
293292
connection_name="DEFAULT";
294293

‎src/interfaces/ecpg/include/ecpglib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ voidECPGdebug(int, FILE *);
4242
boolECPGstatus(int,constchar*);
4343
boolECPGsetcommit(int,constchar*,constchar*);
4444
boolECPGsetconn(int,constchar*);
45+
boolECPGconnect_informix(int,constchar*,constchar*,constchar*,constchar*,int);
4546
boolECPGconnect(int,constchar*,constchar*,constchar*,constchar*,int);
4647
boolECPGdo(int,constchar*,char*,...);
4748
boolECPGtrans(int,constchar*,constchar*);

‎src/interfaces/ecpg/preproc/ecpg.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/preproc/ecpg.c,v 1.67 2003/05/01 17:16:57 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.68 2003/05/02 14:43:25 meskes Exp $ */
22

33
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
44
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -339,7 +339,7 @@ main(int argc, char *const argv[])
339339
lex_init();
340340

341341
/* we need several includes */
342-
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);
342+
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);
343343

344344
/* add some compatibility headers */
345345
if (compat==ECPG_COMPAT_INFORMIX)

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 5 additions & 2 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.215 2003/03/27 14:29:17 meskes Exp $*/
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.216 2003/05/02 14:43:25 meskes Exp $*/
22

33
/* Copyright comment*/
44
%{
@@ -528,7 +528,10 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
528528
if (connection)
529529
mmerror(PARSE_ERROR, ET_ERROR,"no at option for connect statement.\n");
530530

531-
fprintf(yyout,"{ ECPGconnect(__LINE__, %s, %d);", $1, autocommit);
531+
if (compat == ECPG_COMPAT_INFORMIX)
532+
fprintf(yyout,"{ ECPGconnect_informix(__LINE__, %s, %d);", $1, autocommit);
533+
else
534+
fprintf(yyout,"{ ECPGconnect(__LINE__, %s, %d);", $1, autocommit);
532535
reset_variables();
533536
whenever_action(2);
534537
free($1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp