aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2000-09-21 11:56:08 +0000
committerMichael Meskes <meskes@postgresql.org>2000-09-21 11:56:08 +0000
commitb4c8d47ab0c3c570e31c29696f74a204a33df647 (patch)
tree69cec3091fef44b7910e695d27f4b586e5e51999 /src
parenteab8ee9524eb935dcf9339e829ac2c990ef50a5f (diff)
downloadpostgresql-b4c8d47ab0c3c570e31c29696f74a204a33df647.tar.gz
postgresql-b4c8d47ab0c3c570e31c29696f74a204a33df647.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/ChangeLog4
-rw-r--r--src/interfaces/ecpg/lib/execute.c4
-rw-r--r--src/interfaces/ecpg/preproc/pgc.l8
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y11
-rw-r--r--src/interfaces/ecpg/test/test2.pgc3
5 files changed, 22 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 82d28b80bc5..dcd7ff197ee 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -940,5 +940,9 @@ Mit Sep 20 12:40:27 PDT 2000
backend NOTICEs.
- Added patch by Christof Petig <christof.petig@wtal.de> to cache
type information.
+
+Don Sep 21 13:54:13 PDT 2000
+
+ - Enabled parser to accept ip addresses instead of host names.
- Set ecpg version to 2.8.0.
- Set library version to 3.2.0.
diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c
index 762aab49c7e..a0bef5ae2ae 100644
--- a/src/interfaces/ecpg/lib/execute.c
+++ b/src/interfaces/ecpg/lib/execute.c
@@ -262,7 +262,7 @@ static void
ECPGtypeinfocache_push(struct ECPGtype_information_cache **cache, int oid, bool isarray, int lineno)
{
struct ECPGtype_information_cache *new_entry
- = ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno);
+ = (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno);
new_entry->oid = oid;
new_entry->isarray = isarray;
new_entry->next = *cache;
@@ -989,7 +989,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.9 2000/09/20 13:25:51 meskes Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.10 2000/09/21 11:56:07 meskes Exp $
*/
PGconn *ECPG_internal_get_connection(char *name);
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index c23bb9cd479..4993d2ded7b 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.61 2000/09/19 11:47:14 meskes Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.62 2000/09/21 11:56:07 meskes Exp $
*
*-------------------------------------------------------------------------
*/
@@ -260,6 +260,8 @@ elif [eE][lL][iI][fF]
endif [eE][nN][dD][iI][fF]
exec_sql {exec}{space_or_nl}*{sql}{space_or_nl}*
+ipdigit ({digit}|{digit}{digit}|{digit}{digit}{digit})
+ip {ipdigit}\.{ipdigit}\.{ipdigit}\.{ipdigit}
/* Take care of cpp continuation lines */
cppline {space}*#(.*\\{line_end})*.*
@@ -516,6 +518,10 @@ cppline {space}*#(.*\\{line_end})*.*
}
return ICONST;
}
+<SQL>{ip} {
+ yylval.str = mm_strdup((char*)yytext);
+ return IP;
+ }
{decimal} {
yylval.str = mm_strdup((char*)yytext);
return FCONST;
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index e32b524f79b..888e5f139b9 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -239,7 +239,7 @@ make_name(void)
VALID, VERBOSE, VERSION
/* Special keywords, not in the query language - see the "lex" file */
-%token <str> IDENT SCONST Op CSTRING CVARIABLE CPP_LINE
+%token <str> IDENT SCONST Op CSTRING CVARIABLE CPP_LINE IP
%token <ival> ICONST PARAM
%token <dval> FCONST
@@ -4029,9 +4029,11 @@ connection_target: database_name opt_server opt_port
mmerror(ET_ERROR, errortext);
}
- if (strncmp($1, "unix", strlen("unix")) == 0 && strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0)
+ if (strncmp($1, "unix", strlen("unix")) == 0 &&
+ strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0 &&
+ strncmp($3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0)
{
- sprintf(errortext, "unix domain sockets only work on 'localhost' but not on '%9.9s'", $3 +strlen("//"));
+ sprintf(errortext, "unix domain sockets only work on 'localhost' but not on '%9.9s'", $3 + strlen("//"));
mmerror(ET_ERROR, errortext);
}
@@ -4087,7 +4089,8 @@ opt_server: server { $$ = $1; }
| /* empty */ { $$ = EMPTY; }
server_name: ColId { $$ = $1; }
- | ColId '.' server_name { $$ = make3_str($1, make_str("."), $3); }
+ | ColId '.' server_name { $$ = make3_str($1, make_str("."), $3); }
+ | IP { $$ = make_name(); }
opt_port: ':' Iconst { $$ = make2_str(make_str(":"), $2); }
| /* empty */ { $$ = EMPTY; }
diff --git a/src/interfaces/ecpg/test/test2.pgc b/src/interfaces/ecpg/test/test2.pgc
index a2da8181229..9de50aa5135 100644
--- a/src/interfaces/ecpg/test/test2.pgc
+++ b/src/interfaces/ecpg/test/test2.pgc
@@ -42,7 +42,7 @@ exec sql end declare section;
ECPGdebug(1, dbgs);
strcpy(msg, "connect");
- exec sql connect to unix:postgresql://localhost:5432/mm;
+ exec sql connect to unix:postgresql://127.0.0.1:5432/mm;
strcpy(msg, "create");
exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
@@ -124,5 +124,6 @@ exec sql end declare section;
if (dbgs != NULL)
fclose(dbgs);
+
return (0);
}