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

Commita50f285

Browse files
author
Michael Meskes
committed
Added some more informix compatibility functions.
1 parentcd203f3 commita50f285

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,12 @@ Sat Mar 29 22:03:16 CET 2003
13851385
Sun Mar 30 13:43:13 CEST 2003
13861386

13871387
- Interval datetype now fully functional.
1388+
1389+
Tue Apr 8 14:03:32 CEST 2003
1390+
1391+
- Added rstrdate function.
1392+
- Made Informix mode honor environment variable to set dbname to
1393+
connect to.
13881394
- Set ecpg version to 2.12.0.
13891395
- Set ecpg library to 3.4.2.
13901396
- Set pgtypes library to 1.0.0

‎src/interfaces/ecpg/compatlib/informix.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ rstrdate (char *str, Date *d)
223223
{
224224
Datedat=PGTYPESdate_from_asc(str,NULL);
225225

226-
/* XXX: ERROR handling hier und in datetime.c */
226+
if (errno!=PGTYPES_DATE_BAD_DATE&&dat==0)
227+
return-1218;
228+
229+
*d=dat;
227230
return0;
228231
}
229232

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

Lines changed: 17 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.2 2003/04/04 20:42:13 momjian Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.3 2003/04/08 12:34:25 meskes Exp $ */
22

33
#include"postgres_fe.h"
44

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

14+
externenumCOMPAT_MODEecpg_compat_mode;
15+
1416
structconnection*
1517
ECPGget_connection(constchar*connection_name)
1618
{
@@ -267,13 +269,26 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
267269
*tmp,
268270
*port=NULL,
269271
*realname=NULL,
270-
*options=NULL;
272+
*options=NULL,
273+
*envname;
271274

272275
ECPGinit_sqlca();
273276

274277
if ((this= (structconnection*)ECPGalloc(sizeof(structconnection),lineno))==NULL)
275278
return false;
276279

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+
277292
if (dbname==NULL&&connection_name==NULL)
278293
connection_name="DEFAULT";
279294

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ boolECPGget_desc(int, char *, int,...);
7474
/* dynamic result allocation */
7575
voidECPGfree_auto_mem(void);
7676

77+
enumCOMPAT_MODE {ECPG_COMPAT_PGSQL=0,ECPG_COMPAT_INFORMIX};
78+
7779
#ifdef__cplusplus
7880
}
7981

‎src/interfaces/ecpg/pgtypeslib/datetime.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,18 @@ PGTYPESdate_from_asc(char *str, char **endptr)
5151

5252
boolEuroDates= FALSE;
5353

54+
errno=0;
5455
if (strlen(str) >=sizeof(lowstr))
5556
{
5657
errno=PGTYPES_DATE_BAD_DATE;
57-
return-1;
58+
return0;
5859
}
5960

6061
if ((ParseDateTime(str,lowstr,field,ftype,MAXDATEFIELDS,&nf,ptr)!=0)
6162
|| (DecodeDateTime(field,ftype,nf,&dtype,tm,&fsec,&tzp,EuroDates)!=0))
6263
{
6364
errno=PGTYPES_DATE_BAD_DATE;
64-
return-1;
65+
return0;
6566
}
6667

6768
switch (dtype)

‎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.65 2003/04/04 20:42:13 momjian Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.66 2003/04/08 12:34:25 meskes Exp $ */
22

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

334334
/* we need several includes */
335-
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);
335+
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);
336336

337337
/* add some compatibility headers */
338338
if (compat==ECPG_COMPAT_INFORMIX)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp