mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Added some more informix compatibility functions.
This commit is contained in:
parent
cd203f3395
commit
a50f285d8d
@ -1385,6 +1385,12 @@ Sat Mar 29 22:03:16 CET 2003
|
||||
Sun Mar 30 13:43:13 CEST 2003
|
||||
|
||||
- Interval datetype now fully functional.
|
||||
|
||||
Tue Apr 8 14:03:32 CEST 2003
|
||||
|
||||
- Added rstrdate function.
|
||||
- Made Informix mode honor environment variable to set dbname to
|
||||
connect to.
|
||||
- Set ecpg version to 2.12.0.
|
||||
- Set ecpg library to 3.4.2.
|
||||
- Set pgtypes library to 1.0.0
|
||||
|
@ -223,7 +223,10 @@ rstrdate (char *str, Date *d)
|
||||
{
|
||||
Date dat = PGTYPESdate_from_asc(str, NULL);
|
||||
|
||||
/* XXX: ERROR handling hier und in datetime.c */
|
||||
if (errno != PGTYPES_DATE_BAD_DATE && dat == 0)
|
||||
return -1218;
|
||||
|
||||
*d=dat;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.2 2003/04/04 20:42:13 momjian Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.3 2003/04/08 12:34:25 meskes Exp $ */
|
||||
|
||||
#include "postgres_fe.h"
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
static struct connection *all_connections = NULL,
|
||||
*actual_connection = NULL;
|
||||
|
||||
extern enum COMPAT_MODE ecpg_compat_mode;
|
||||
|
||||
struct connection *
|
||||
ECPGget_connection(const char *connection_name)
|
||||
{
|
||||
@ -267,13 +269,26 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
|
||||
*tmp,
|
||||
*port = NULL,
|
||||
*realname = NULL,
|
||||
*options = NULL;
|
||||
*options = NULL,
|
||||
*envname;
|
||||
|
||||
ECPGinit_sqlca();
|
||||
|
||||
if ((this = (struct connection *) ECPGalloc(sizeof(struct connection), lineno)) == NULL)
|
||||
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)
|
||||
connection_name = "DEFAULT";
|
||||
|
||||
|
@ -74,6 +74,8 @@ bool ECPGget_desc(int, char *, int,...);
|
||||
/* dynamic result allocation */
|
||||
void ECPGfree_auto_mem(void);
|
||||
|
||||
enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
|
@ -51,17 +51,18 @@ PGTYPESdate_from_asc(char *str, char **endptr)
|
||||
|
||||
bool EuroDates = FALSE;
|
||||
|
||||
errno = 0;
|
||||
if (strlen(str) >= sizeof(lowstr))
|
||||
{
|
||||
errno = PGTYPES_DATE_BAD_DATE;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0)
|
||||
|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp, EuroDates) != 0))
|
||||
{
|
||||
errno = PGTYPES_DATE_BAD_DATE;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (dtype)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.65 2003/04/04 20:42:13 momjian Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.66 2003/04/08 12:34:25 meskes Exp $ */
|
||||
|
||||
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
|
||||
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
|
||||
@ -332,7 +332,7 @@ main(int argc, char *const argv[])
|
||||
lex_init();
|
||||
|
||||
/* 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\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
|
||||
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);
|
||||
|
||||
/* add some compatibility headers */
|
||||
if (compat == ECPG_COMPAT_INFORMIX)
|
||||
|
Loading…
Reference in New Issue
Block a user