#include <time.h>
#include <config.h>
+#include <postgres.h>
+#include <miscadmin.h>
#include <parser/sysfunc.h>
/*
time(&cur_time_secs);
cur_time_expanded = localtime(&cur_time_secs);
-#if defined(EUROPEAN_DATES)
- sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
+ if (EuroDates == 1)
+ sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
cur_time_expanded->tm_mon+1, cur_time_expanded->tm_year+1900);
-#else
- sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon+1,
+ else
+ sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon+1,
cur_time_expanded->tm_mday, cur_time_expanded->tm_year+1900);
-#endif
+
return &buf[0];
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.34 1997/01/24 18:27:29 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.35 1997/01/26 15:30:23 scrappy Exp $
*
* NOTES
*
DataDir = getenv("PGDATA"); /* default value */
opterr = 0;
- while ((opt = getopt(argc, argv, "a:B:b:D:dmM:no:p:Ss")) != EOF) {
+ while ((opt = getopt(argc, argv, "a:B:b:D:demM:no:p:Ss")) != EOF) {
switch (opt) {
case 'a':
/* Set the authentication system. */
else
DebugLvl = 1;
break;
- case 'm':
+ case 'e':
+ /*
+ * Use european date formats.
+ */
+ EuroDates = 1;
+ break;
+ case 'm':
MultiplexedBackends = 1;
MultiplexedBackendPort = atoi(optarg);
break;
case 'M':
/* ignore this flag. This may be passed in because the
- program was run as 'postgres -M' instead of 'postmaster' */
+ program was run as 'postgres -M' instead of 'postmaster' */
break;
case 'n':
/* Don't reinit shared mem after abnormal exit */
#endif /* WIN32 */
}
+
+ /* tell the backend we're using European dates */
+ if (EuroDates == 1)
+ av[ac++] = "-e";
/* tell the multiplexed backend to start on a certain port */
if (MultiplexedBackends) {
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.25 1997/01/14 08:05:26 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.26 1997/01/26 15:30:48 scrappy Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
int flagQ;
int flagS;
int flagE;
+ int flagEu;
int flag;
char *DBName = NULL;
* parse command line arguments
* ----------------
*/
- flagC = flagQ = flagS = flagE = ShowStats = 0;
+ flagC = flagQ = flagS = flagE = flagEu = ShowStats = 0;
ShowParserStats = ShowPlannerStats = ShowExecutorStats = 0;
/* get hostname is either the environment variable PGHOST
DataDir = getenv("PGDATA"); /* default */
multiplexedBackend = false; /* default */
- while ((flag = getopt(argc, argv, "B:bCD:d:Ef:iLm:MNo:P:pQSst:x:F"))
+ while ((flag = getopt(argc, argv, "B:bCD:d:Eef:iLm:MNo:P:pQSst:x:F"))
!= EOF)
switch (flag) {
flagE = 1;
break;
+ case 'e':
+ /* --------------------------
+ * Use european date formats.
+ * --------------------------
+ */
+ flagEu = 1;
+ break;
+
case 'F':
/* --------------------
* turn off fsync
Noversion = flagC;
Quiet = flagQ;
EchoQuery = flagE;
+ EuroDates = flagEu;
/* ----------------
* print flags
printf("\tNoversion = %c\n", Noversion ? 't' : 'f');
printf("\tstable = %c\n", flagS ? 't' : 'f');
printf("\ttimings = %c\n", ShowStats ? 't' : 'f');
+ printf("\tdates = %s\n", EuroDates ? "European" : "Normal");
printf("\tbufsize = %d\n", NBuffers);
printf("\tquery echo = %c\n", EchoQuery ? 't' : 'f');
*/
if (IsUnderPostmaster == false) {
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.25 $ $Date: 1997/01/14 08:05:26 $");
+ puts("$Revision: 1.26 $ $Date: 1997/01/26 15:30:48 $");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/datetimes.c,v 1.7 1996/11/14 21:38:58 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/datetimes.c,v 1.8 1997/01/26 15:31:12 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <string.h>
#include <postgres.h>
+#include <miscadmin.h>
#include <utils/builtins.h>
#include <utils/datetime.h>
# define CHECK_DATE_LEN(datestr) 1
#endif
-#ifndef EUROPEAN_DATES
- if (!CHECK_DATE_LEN(datestr) ||
- sscanf(datestr, "%d%*c%d%*c%d", &m, &d, &y) != 3) {
- elog(WARN, "date_in: date \"%s\" not of the form mm-dd-yyyy",
- datestr);
- }
-#else
- if (!CHECK_DATE_LEN(datestr) ||
- sscanf(datestr, "%d%*c%d%*c%d", &d, &m, &y) != 3) {
- elog(WARN, "date_in: date \"%s\" not of the form dd-mm-yyyy",
- datestr);
+ if (EuroDates == 1) { /* Expect european format dates */
+ if (!CHECK_DATE_LEN(datestr) ||
+ sscanf(datestr, "%d%*c%d%*c%d", &d, &m, &y) != 3) {
+ elog(WARN, "date_in: date \"%s\" not of the form dd-mm-yyyy",
+ datestr);
+ }
+ } else {
+ if (!CHECK_DATE_LEN(datestr) ||
+ sscanf(datestr, "%d%*c%d%*c%d", &m, &d, &y) != 3) {
+ elog(WARN, "date_in: date \"%s\" not of the form mm-dd-yyyy",
+ datestr);
+ }
}
-#endif
if (y < 0 || y > 32767)
elog(WARN, "date_in: year must be limited to values 0 through 32767 in \"%s\"", datestr);
if (m < 1 || m > 12)
date = (DateADT*)&dateStore;
dateStore = dateVal;
-#ifndef EUROPEAN_DATES
- sprintf(datestr, "%02d-%02d-%04d",
- (int)date->month, (int)date->day, (int)date->year);
-#else
- sprintf(datestr, "%02d-%02d-%04d",
- (int)date->day, (int)date->month, (int)date->year);
-#endif
+ if (EuroDates == 1) /* Output european format dates */
+ sprintf(datestr, "%02d-%02d-%04d",
+ (int)date->day, (int)date->month, (int)date->year);
+ else
+ sprintf(datestr, "%02d-%02d-%04d",
+ (int)date->month, (int)date->day, (int)date->year);
return datestr;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.4 1997/01/14 08:05:36 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.5 1997/01/26 15:31:29 scrappy Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
short DebugLvl = 0;
+int EuroDates = 0;
+
char *IndexedCatalogNames[] = {
AttributeRelationName,
ProcedureRelationName,
/* Define one for either <history.h> or <readline/history.h>
*/
-/* #undef HAVE_HISTORY */
+/* #undef HAVE_HISTORY */
#define HAVE_SYS_SELECT_H
#define DEF_PGPORT "5432"
-/* turn this on if you prefer European style dates instead of American
- * style dates
- */
-/* #define EUROPEAN_DATES */
-
/*
* If you do not plan to use Host based authentication,
* comment out the following line
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.4 1996/11/14 10:25:42 bryanh Exp $
+ * $Id: miscadmin.h,v 1.5 1997/01/26 15:32:06 scrappy Exp $
*
* NOTES
* some of the information in this file will be moved to
extern short DebugLvl;
+extern int EuroDates;
+
extern Oid LastOidProcessed; /* for query rewrite */
#define MAX_PARSE_BUFFER 8192
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/postgres.1,v 1.4 1996/12/11 22:58:14 momjian Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/postgres.1,v 1.5 1997/01/26 15:32:20 scrappy Exp $
.TH POSTGRES95 UNIX 12/08/96 Postgres95 Postgres95
.SH NAME
postgres \(em the Postgres backend server
[\c
.BR "-Q"
]
+[\c
+.BR "-e"
+]
.br
[\c
.BR "-d"
backend is running standalone, this specifies the number of buffers to
allocate. This value defaults to 64.
.TP
-.BR "-E"
-Echo all queries.
-.TP
.BR "-F"
Disable automatic fsync() call after each transaction.
This option improves performance, but an operating system crash
.BR "-Q"
Specifies \*(lqquiet\*(rq mode.
.TP
+.BR "-E"
+Echo all queries.
+.TP
+.BR "-e"
+The
+.IR "-e"
+option controls how dates are input to and output from the database.
+.IP
+If the
+.IR "-e"
+option is supplied, then all dates passed to and from the frontend
+processes will be assumed to be in
+.IR "European"
+format ie.
+.IR "DD-MM-YYYY"
+otherwise dates are input and output in
+.IR "American"
+format ie.
+.IR "MM-DD-YYYY"
+.TP
.BR "-d" " debug_level"
Turns on debugging at the numeric level
.IR "debug_level" .
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/postmaster.1,v 1.2 1996/12/11 00:28:02 momjian Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/postmaster.1,v 1.3 1997/01/26 15:32:28 scrappy Exp $
.TH POSTMASTER UNIX 11/05/95 PostgreSQL PostgreSQL
.SH "NAME"
postmaster \(em run the Postgres postmaster
[\c
.BR "-n" \c
]
+[\c
+.BR "-e" \c
+]
.br
[\c
.BR "-o"
.IR shmemdoc
program to examine shared memory and semaphore state.
.TP
+.BR "-e"
+The
+.IR "-e"
+option controls how dates are input to and output from the database.
+.IP
+If the
+.IR "-e"
+option is supplied, then all dates passed to and from the frontend
+processes will be assumed to be in
+.IR "European"
+format ie.
+.IR "DD-MM-YYYY"
+otherwise dates are input and output in
+.IR "American"
+format ie.
+.IR "MM-DD-YYYY"
+.TP
.BR "-o" " backend_options"
The
.IR postgres (1)