Commit e9c3f025 authored by Michael Meskes's avatar Michael Meskes

*** empty log message ***

parent a5a290ca
...@@ -925,3 +925,13 @@ Wed May 17 07:52:59 CEST 2000 ...@@ -925,3 +925,13 @@ Wed May 17 07:52:59 CEST 2000
handling. handling.
- Set library version to 3.1.1. - Set library version to 3.1.1.
Mon Sep 4 14:10:38 PDT 2000
- Synced preproc.y with gram.y.
- Synced keyword.c.
Mon Sep 18 13:55:11 PDT 2000
- Added int8 support based on a patch by Martijn Schoemaker <martijn@osp.nl>
- Set ecpg version to 2.8.0.
- Set library version to 3.2.0.
...@@ -26,5 +26,6 @@ instead of libpq so we can write backend functions using ecpg. ...@@ -26,5 +26,6 @@ instead of libpq so we can write backend functions using ecpg.
remove space_or_nl and line_end from pgc.l remove space_or_nl and line_end from pgc.l
Missing statements: Missing features:
- SQLSTATE - SQLSTATE
- LONG LONG datatype
...@@ -47,13 +47,14 @@ extern "C" ...@@ -47,13 +47,14 @@ extern "C"
ECPGt_char_variable, ECPGt_char_variable,
ECPGt_EOIT, /* End of insert types. */ ECPGt_EOIT, /* End of insert types. */
ECPGt_EORT, /* End of result types. */ ECPGt_EORT, /* End of result types. */
ECPGt_NO_INDICATOR /* no indicator */ ECPGt_NO_INDICATOR, /* no indicator */
ECPGt_long_long, ECPGt_unsigned_long_long
}; };
/* descriptor items */ /* descriptor items */
enum ECPGdtype enum ECPGdtype
{ {
ECPGd_count, ECPGd_count = 1,
ECPGd_data, ECPGd_data,
ECPGd_di_code, ECPGd_di_code,
ECPGd_di_precision, ECPGd_di_precision,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.8 2000/09/17 13:02:46 petere Exp $ # $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.9 2000/09/19 11:47:13 meskes Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global ...@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg NAME= ecpg
SO_MAJOR_VERSION= 3 SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 1.1 SO_MINOR_VERSION= 2.0
CPPFLAGS += -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) CPPFLAGS += -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir)
......
...@@ -60,6 +60,12 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -60,6 +60,12 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
((long *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field); ((long *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
break; break;
case ECPGt_long_long:
((long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
break;
case ECPGt_unsigned_long_long:
((unsigned long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
break;
case ECPGt_NO_INDICATOR: case ECPGt_NO_INDICATOR:
if (PQgetisnull(results, act_tuple, act_field)) if (PQgetisnull(results, act_tuple, act_field))
{ {
...@@ -93,7 +99,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -93,7 +99,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ECPGraise(lineno, ECPG_INT_FORMAT, pval); ECPGraise(lineno, ECPG_INT_FORMAT, pval);
return (false); return (false);
res = 0L;
} }
} }
else else
...@@ -127,7 +132,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -127,7 +132,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ECPGraise(lineno, ECPG_UINT_FORMAT, pval); ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
return (false); return (false);
ures = 0L;
} }
} }
else else
...@@ -150,7 +154,38 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -150,7 +154,38 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
} }
break; break;
case ECPGt_long_long:
if (pval)
{
((long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
if ((isarray && *scan_length != ',' && *scan_length != '}')
|| (!isarray && *scan_length != '\0')) /* Garbage left */
{
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
return (false);
}
}
else
((long long int *) var)[act_tuple] = 0LL;
break;
case ECPGt_unsigned_long_long:
if (pval)
{
((unsigned long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
if ((isarray && *scan_length != ',' && *scan_length != '}')
|| (!isarray && *scan_length != '\0')) /* Garbage left */
{
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
return (false);
}
}
else
((unsigned long long int *) var)[act_tuple] = 0LL;
break;
case ECPGt_float: case ECPGt_float:
case ECPGt_double: case ECPGt_double:
if (pval) if (pval)
......
...@@ -63,29 +63,35 @@ get_int_item(int lineno, void *var, enum ECPGdtype vartype, int value) ...@@ -63,29 +63,35 @@ get_int_item(int lineno, void *var, enum ECPGdtype vartype, int value)
{ {
switch (vartype) switch (vartype)
{ {
case ECPGt_short: case ECPGt_short:
*(short *) var = value; *(short *) var = (short) value;
break; break;
case ECPGt_int: case ECPGt_int:
*(int *) var = value; *(int *) var = (int) value;
break; break;
case ECPGt_long: case ECPGt_long:
*(long *) var = value; *(long *) var = (long) value;
break; break;
case ECPGt_unsigned_short: case ECPGt_unsigned_short:
*(unsigned short *) var = value; *(unsigned short *) var = (unsigned short) value;
break; break;
case ECPGt_unsigned_int: case ECPGt_unsigned_int:
*(unsigned int *) var = value; *(unsigned int *) var = (unsigned int) value;
break; break;
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
*(unsigned long *) var = value; *(unsigned long *) var = (unsigned long) value;
break;
case ECPGt_long_long:
*(long long int *) var = (long long int) value;
break;
case ECPGt_unsigned_long_long:
*(unsigned long long int *) var = (unsigned long long int) value;
break; break;
case ECPGt_float: case ECPGt_float:
*(float *) var = value; *(float *) var = (float) value;
break; break;
case ECPGt_double: case ECPGt_double:
*(double *) var = value; *(double *) var = (double) value;
break; break;
default: default:
ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, NULL); ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, NULL);
......
...@@ -305,6 +305,11 @@ ECPGexecute(struct statement * stmt) ...@@ -305,6 +305,11 @@ ECPGexecute(struct statement * stmt)
if (*(long *) var->ind_value < 0L) if (*(long *) var->ind_value < 0L)
strcpy(buff, "null"); strcpy(buff, "null");
break; break;
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
if (*(long long int*) var->ind_value < 0LL)
strcpy(buff, "null");
break;
default: default:
break; break;
} }
...@@ -428,6 +433,44 @@ ECPGexecute(struct statement * stmt) ...@@ -428,6 +433,44 @@ ECPGexecute(struct statement * stmt)
tobeinserted = mallocedval; tobeinserted = mallocedval;
break; break;
case ECPGt_long_long:
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
return false;
if (var->arrsize > 1)
{
strncpy(mallocedval, "'{", sizeof("'{"));
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long *) var->value)[element]);
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
}
else
sprintf(mallocedval, "%lld", *((long long *) var->value));
tobeinserted = mallocedval;
break;
case ECPGt_unsigned_long_long:
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
return false;
if (var->arrsize > 1)
{
strncpy(mallocedval, "'{", sizeof("'{"));
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long *) var->value)[element]);
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
}
else
sprintf(mallocedval, "%llu", *((unsigned long long*) var->value));
tobeinserted = mallocedval;
break;
case ECPGt_float: case ECPGt_float:
if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno))) if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
...@@ -868,7 +911,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...) ...@@ -868,7 +911,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
* *
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de> * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* *
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.7 2000/05/29 21:25:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.8 2000/09/19 11:47:13 meskes Exp $
*/ */
PGconn *ECPG_internal_get_connection(char *name); PGconn *ECPG_internal_get_connection(char *name);
......
...@@ -28,6 +28,10 @@ ECPGtype_name(enum ECPGttype typ) ...@@ -28,6 +28,10 @@ ECPGtype_name(enum ECPGttype typ)
return "long"; return "long";
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
return "unsigned long"; return "unsigned long";
case ECPGt_long_long:
return "long long";
case ECPGt_unsigned_long_long:
return "unsigned long long";
case ECPGt_float: case ECPGt_float:
return "float"; return "float";
case ECPGt_double: case ECPGt_double:
......
...@@ -3,8 +3,8 @@ top_builddir = ../../../.. ...@@ -3,8 +3,8 @@ top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
MAJOR_VERSION=2 MAJOR_VERSION=2
MINOR_VERSION=7 MINOR_VERSION=8
PATCHLEVEL=1 PATCHLEVEL=0
CPPFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ CPPFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
......
...@@ -46,9 +46,11 @@ ECPGnumeric_lvalue(FILE *f, char *name) ...@@ -46,9 +46,11 @@ ECPGnumeric_lvalue(FILE *f, char *name)
case ECPGt_short: case ECPGt_short:
case ECPGt_int: case ECPGt_int:
case ECPGt_long: case ECPGt_long:
case ECPGt_long_long:
case ECPGt_unsigned_short: case ECPGt_unsigned_short:
case ECPGt_unsigned_int: case ECPGt_unsigned_int:
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
case ECPGt_unsigned_long_long:
fputs(name, yyout); fputs(name, yyout);
break; break;
default: default:
......
...@@ -50,7 +50,6 @@ static ScanKeyword ScanKeywords[] = { ...@@ -50,7 +50,6 @@ static ScanKeyword ScanKeywords[] = {
{"name", SQL_NAME}, {"name", SQL_NAME},
{"nullable", SQL_NULLABLE}, {"nullable", SQL_NULLABLE},
{"octet_length", SQL_OCTET_LENGTH}, {"octet_length", SQL_OCTET_LENGTH},
{"off", SQL_OFF},
{"open", SQL_OPEN}, {"open", SQL_OPEN},
{"prepare", SQL_PREPARE}, {"prepare", SQL_PREPARE},
{"reference", SQL_REFERENCE}, {"reference", SQL_REFERENCE},
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.28 2000/06/12 19:40:55 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.29 2000/09/19 11:47:14 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -55,8 +55,10 @@ static ScanKeyword ScanKeywords[] = { ...@@ -55,8 +55,10 @@ static ScanKeyword ScanKeywords[] = {
{"cascade", CASCADE}, {"cascade", CASCADE},
{"case", CASE}, {"case", CASE},
{"cast", CAST}, {"cast", CAST},
{"chain", CHAIN},
{"char", CHAR}, {"char", CHAR},
{"character", CHARACTER}, {"character", CHARACTER},
{"characteristics", CHARACTERISTICS},
{"check", CHECK}, {"check", CHECK},
{"close", CLOSE}, {"close", CLOSE},
{"cluster", CLUSTER}, {"cluster", CLUSTER},
...@@ -100,6 +102,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -100,6 +102,7 @@ static ScanKeyword ScanKeywords[] = {
{"else", ELSE}, {"else", ELSE},
{"encoding", ENCODING}, {"encoding", ENCODING},
{"end", END_TRANS}, {"end", END_TRANS},
{"escape", ESCAPE},
{"except", EXCEPT}, {"except", EXCEPT},
{"exclusive", EXCLUSIVE}, {"exclusive", EXCLUSIVE},
{"execute", EXECUTE}, {"execute", EXECUTE},
...@@ -123,6 +126,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -123,6 +126,7 @@ static ScanKeyword ScanKeywords[] = {
{"handler", HANDLER}, {"handler", HANDLER},
{"having", HAVING}, {"having", HAVING},
{"hour", HOUR_P}, {"hour", HOUR_P},
{"ilike", ILIKE},
{"immediate", IMMEDIATE}, {"immediate", IMMEDIATE},
{"in", IN}, {"in", IN},
{"increment", INCREMENT}, {"increment", INCREMENT},
...@@ -130,6 +134,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -130,6 +134,7 @@ static ScanKeyword ScanKeywords[] = {
{"inherits", INHERITS}, {"inherits", INHERITS},
{"initially", INITIALLY}, {"initially", INITIALLY},
{"inner", INNER_P}, {"inner", INNER_P},
{"inout", INOUT},
{"insensitive", INSENSITIVE}, {"insensitive", INSENSITIVE},
{"insert", INSERT}, {"insert", INSERT},
{"instead", INSTEAD}, {"instead", INSTEAD},
...@@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = {
{"nullif", NULLIF}, {"nullif", NULLIF},
{"numeric", NUMERIC}, {"numeric", NUMERIC},
{"of", OF}, {"of", OF},
{"off", OFF},
{"offset", OFFSET}, {"offset", OFFSET},
{"oids", OIDS}, {"oids", OIDS},
{"old", OLD}, {"old", OLD},
...@@ -188,9 +194,11 @@ static ScanKeyword ScanKeywords[] = { ...@@ -188,9 +194,11 @@ static ScanKeyword ScanKeywords[] = {
{"overlaps", OVERLAPS}, {"overlaps", OVERLAPS},
{"or", OR}, {"or", OR},
{"order", ORDER}, {"order", ORDER},
{"out", OUT},
{"outer", OUTER_P}, {"outer", OUTER_P},
{"partial", PARTIAL}, {"partial", PARTIAL},
{"password", PASSWORD}, {"password", PASSWORD},
{"path", PATH_P},
{"pendant", PENDANT}, {"pendant", PENDANT},
{"position", POSITION}, {"position", POSITION},
{"precision", PRECISION}, {"precision", PRECISION},
...@@ -213,12 +221,14 @@ static ScanKeyword ScanKeywords[] = { ...@@ -213,12 +221,14 @@ static ScanKeyword ScanKeywords[] = {
{"rollback", ROLLBACK}, {"rollback", ROLLBACK},
{"row", ROW}, {"row", ROW},
{"rule", RULE}, {"rule", RULE},
{"schema", SCHEMA},
{"scroll", SCROLL}, {"scroll", SCROLL},
{"second", SECOND_P}, {"second", SECOND_P},
{"select", SELECT}, {"select", SELECT},
{"sequence", SEQUENCE}, {"sequence", SEQUENCE},
{"serial", SERIAL}, {"serial", SERIAL},
{"serializable", SERIALIZABLE}, {"serializable", SERIALIZABLE},
{"session", SESSION},
{"session_user", SESSION_USER}, {"session_user", SESSION_USER},
{"set", SET}, {"set", SET},
{"setof", SETOF}, {"setof", SETOF},
...@@ -240,6 +250,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -240,6 +250,7 @@ static ScanKeyword ScanKeywords[] = {
{"timezone_hour", TIMEZONE_HOUR}, {"timezone_hour", TIMEZONE_HOUR},
{"timezone_minute", TIMEZONE_MINUTE}, {"timezone_minute", TIMEZONE_MINUTE},
{"to", TO}, {"to", TO},
{"toast", TOAST},
{"trailing", TRAILING}, {"trailing", TRAILING},
{"transaction", TRANSACTION}, {"transaction", TRANSACTION},
{"trigger", TRIGGER}, {"trigger", TRIGGER},
...@@ -267,6 +278,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -267,6 +278,7 @@ static ScanKeyword ScanKeywords[] = {
{"when", WHEN}, {"when", WHEN},
{"where", WHERE}, {"where", WHERE},
{"with", WITH}, {"with", WITH},
{"without", WITHOUT},
{"work", WORK}, {"work", WORK},
{"year", YEAR_P}, {"year", YEAR_P},
{"zone", ZONE}, {"zone", ZONE},
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.60 2000/06/28 18:29:40 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.61 2000/09/19 11:47:14 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -50,6 +50,8 @@ static char *literalbuf = NULL; /* expandable buffer */ ...@@ -50,6 +50,8 @@ static char *literalbuf = NULL; /* expandable buffer */
static int literallen; /* actual current length */ static int literallen; /* actual current length */
static int literalalloc; /* current allocated buffer size */ static int literalalloc; /* current allocated buffer size */
static int xcdepth = 0;
#define startlit() (literalbuf[0] = '\0', literallen = 0) #define startlit() (literalbuf[0] = '\0', literallen = 0)
static void addlit(char *ytext, int yleng); static void addlit(char *ytext, int yleng);
...@@ -140,6 +142,7 @@ xqcat {quote}{whitespace_with_newline}{quote} ...@@ -140,6 +142,7 @@ xqcat {quote}{whitespace_with_newline}{quote}
dquote \" dquote \"
xdstart {dquote} xdstart {dquote}
xdstop {dquote} xdstop {dquote}
xddouble {dquote}{dquote}
xdinside [^"]+ xdinside [^"]+
/* special stuff for C strings */ /* special stuff for C strings */
...@@ -169,7 +172,7 @@ xdcinside ({xdcqq}|{xdcqdq}|{xdcother}) ...@@ -169,7 +172,7 @@ xdcinside ({xdcqq}|{xdcqdq}|{xdcother})
*/ */
xcstart \/\*{op_chars}* xcstart \/\*{op_chars}*
xcstop \*+\/ xcstop \*+\/
xcinside ([^*]+)|(\*+[^/]) xcinside [^*/]+
digit [0-9] digit [0-9]
letter [\200-\377_A-Za-z] letter [\200-\377_A-Za-z]
...@@ -190,7 +193,7 @@ typecast "::" ...@@ -190,7 +193,7 @@ typecast "::"
* rule for "operator"! * rule for "operator"!
*/ */
self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|] self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
op_chars [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=] op_chars [\~\!\@\#\^\&\|\`\?\$\+\-\*\/\%\<\>\=]
operator {op_chars}+ operator {op_chars}+
/* we no longer allow unary minus in numbers. /* we no longer allow unary minus in numbers.
...@@ -281,15 +284,30 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -281,15 +284,30 @@ cppline {space}*#(.*\\{line_end})*.*
{xcstart} { {xcstart} {
state_before = YYSTATE; state_before = YYSTATE;
xcdepth = 0;
BEGIN(xc); BEGIN(xc);
/* Put back any characters past slash-star; see above */ /* Put back any characters past slash-star; see above */
yyless(2); yyless(2);
fputs("/*", yyout); fputs("/*", yyout);
} }
<xc>{xcstop} { ECHO; BEGIN(state_before); } <xc>{xcstart} {
xcdepth++;
/* Put back any characters past slash-star; see above */
yyless(2);
fputs("/*", yyout);
}
<xc>{xcstop} {
ECHO;
if (xcdepth <= 0)
BEGIN(state_before);
else
xcdepth--;
}
<xc>{xcinside} { ECHO; } <xc>{xcinside} { ECHO; }
<xc>{op_chars} { ECHO; }
<xc><<EOF>> { mmerror(ET_ERROR, "Unterminated /* comment"); } <xc><<EOF>> { mmerror(ET_ERROR, "Unterminated /* comment"); }
...@@ -361,11 +379,36 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -361,11 +379,36 @@ cppline {space}*#(.*\\{line_end})*.*
BEGIN(xd); BEGIN(xd);
startlit(); startlit();
} }
<xd,xdc>{xdstop} { <xd>{xdstop} {
BEGIN(state_before); BEGIN(state_before);
if (strlen(literalbuf) >= NAMEDATALEN)
{
#ifdef MULTIBYTE
int len;
len = pg_mbcliplen(literalbuf,strlen(literalbuf),NAMEDATALEN-1);
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
literalbuf, len, literalbuf);
literalbuf[len] = '\0';
#else
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
literalbuf, NAMEDATALEN-1, literalbuf);
literalbuf[NAMEDATALEN-1] = '\0';
#endif
mmerror(ET_WARN, errortext);
}
yylval.str = mm_strdup(literalbuf);
return CSTRING;
}
<xdc>{xdstop} {
BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); yylval.str = mm_strdup(literalbuf);
return CSTRING; return CSTRING;
} }
<xd>{xddouble} {
addlit(yytext, yyleng-1);
}
<xd>{xdinside} { <xd>{xdinside} {
addlit(yytext, yyleng); addlit(yytext, yyleng);
} }
...@@ -426,7 +469,7 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -426,7 +469,7 @@ cppline {space}*#(.*\\{line_end})*.*
for (ic = nchars-2; ic >= 0; ic--) for (ic = nchars-2; ic >= 0; ic--)
{ {
if (strchr("~!@#&`?$:%^|", yytext[ic])) if (strchr("~!@#^&|`?$%", yytext[ic]))
break; break;
} }
if (ic >= 0) if (ic >= 0)
...@@ -498,8 +541,19 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -498,8 +541,19 @@ cppline {space}*#(.*\\{line_end})*.*
if (i >= NAMEDATALEN) if (i >= NAMEDATALEN)
{ {
sprintf(errortext, "Identifier \"%s\" will be truncated to \"%.*s\"", yytext, NAMEDATALEN-1, yytext); #ifdef MULTIBYTE
mmerror (ET_WARN, errortext); int len;
len = pg_mbcliplen(lower_text,strlen(lower_text),NAMEDATALEN-1);
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
lower_text, len, lower_text);
lower_text[len] = '\0';
#else
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
lower_text, NAMEDATALEN-1, lower_text);
lower_text[NAMEDATALEN-1] = '\0';
#endif
mmerror(ET_WARN, errortext);
yytext[NAMEDATALEN-1] = '\0'; yytext[NAMEDATALEN-1] = '\0';
} }
......
...@@ -166,7 +166,7 @@ make_name(void) ...@@ -166,7 +166,7 @@ make_name(void)
%token SQL_IDENTIFIED SQL_INDICATOR SQL_INT SQL_KEY_MEMBER %token SQL_IDENTIFIED SQL_INDICATOR SQL_INT SQL_KEY_MEMBER
%token SQL_LENGTH SQL_LONG %token SQL_LENGTH SQL_LONG
%token SQL_NAME SQL_NULLABLE %token SQL_NAME SQL_NULLABLE
%token SQL_OCTET_LENGTH SQL_OFF SQL_OPEN SQL_PREPARE %token SQL_OCTET_LENGTH SQL_OPEN SQL_PREPARE
%token SQL_RELEASE SQL_REFERENCE SQL_RETURNED_LENGTH %token SQL_RELEASE SQL_REFERENCE SQL_RETURNED_LENGTH
%token SQL_RETURNED_OCTET_LENGTH %token SQL_RETURNED_OCTET_LENGTH
%token SQL_SCALE SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQL %token SQL_SCALE SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQL
...@@ -184,7 +184,8 @@ make_name(void) ...@@ -184,7 +184,8 @@ make_name(void)
/* Keywords (in SQL92 reserved words) */ /* Keywords (in SQL92 reserved words) */
%token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC, %token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC,
BEGIN_TRANS, BETWEEN, BOTH, BY, BEGIN_TRANS, BETWEEN, BOTH, BY,
CASCADE, CASE, CAST, CHAR, CHARACTER, CHECK, CLOSE, CASCADE, CASE, CAST, CHAIN, CHAR, CHARACTER,
CHARACTERISTICS, CHECK, CLOSE,
COALESCE, COLLATE, COLUMN, COMMIT, COALESCE, COLLATE, COLUMN, COMMIT,
CONSTRAINT, CONSTRAINTS, CREATE, CROSS, CURRENT, CURRENT_DATE, CONSTRAINT, CONSTRAINTS, CREATE, CROSS, CURRENT, CURRENT_DATE,
CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR,
...@@ -192,19 +193,19 @@ make_name(void) ...@@ -192,19 +193,19 @@ make_name(void)
ELSE, END_TRANS, EXCEPT, EXECUTE, EXISTS, EXTRACT, ELSE, END_TRANS, EXCEPT, EXECUTE, EXISTS, EXTRACT,
FALSE_P, FETCH, FLOAT, FOR, FOREIGN, FROM, FULL, FALSE_P, FETCH, FLOAT, FOR, FOREIGN, FROM, FULL,
GLOBAL, GRANT, GROUP, HAVING, HOUR_P, GLOBAL, GRANT, GROUP, HAVING, HOUR_P,
IN, INNER_P, INSENSITIVE, INSERT, INTERSECT, INTERVAL, INTO, IS, IN, INNER_P, INOUT, INSENSITIVE, INSERT, INTERSECT, INTERVAL, INTO, IS,
ISOLATION, JOIN, KEY, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LOCAL, ISOLATION, JOIN, KEY, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LOCAL,
MATCH, MINUTE_P, MONTH_P, NAMES, MATCH, MINUTE_P, MONTH_P, NAMES,
NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULLIF, NULL_P, NUMERIC, NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULLIF, NULL_P, NUMERIC,
OF, OLD, ON, ONLY, OPTION, OR, ORDER, OUTER_P, OVERLAPS, OF, OFF, OLD, ON, ONLY, OPTION, OR, ORDER, OUT, OUTER_P, OVERLAPS,
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC, PARTIAL, PATH_P, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC,
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK, READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
SCROLL, SECOND_P, SELECT, SESSION_USER, SET, SOME, SUBSTRING, SCHEMA, SCROLL, SECOND_P, SELECT, SESSION, SESSION_USER, SET, SOME, SUBSTRING,
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR, TABLE, TEMPORARY, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR,
TIMEZONE_MINUTE, TO, TRAILING, TRANSACTION, TRIM, TRUE_P, TIMEZONE_MINUTE, TO, TOAST, TRAILING, TRANSACTION, TRIM, TRUE_P,
UNION, UNIQUE, UPDATE, USER, USING, UNION, UNIQUE, UPDATE, USER, USING,
VALUES, VARCHAR, VARYING, VIEW, VALUES, VARCHAR, VARYING, VIEW,
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE WHEN, WHERE, WITH, WITHOUT, WORK, YEAR_P, ZONE
/* Keywords (in SQL3 reserved words) */ /* Keywords (in SQL3 reserved words) */
%token DEFERRABLE, DEFERRED, %token DEFERRABLE, DEFERRED,
...@@ -245,13 +246,14 @@ make_name(void) ...@@ -245,13 +246,14 @@ make_name(void)
/* these are not real. they are here so that they get generated as #define's*/ /* these are not real. they are here so that they get generated as #define's*/
%token OP %token OP
/* precedence */ /* precedence: lowest to highest */
%left UNION INTERSECT EXCEPT
%left OR %left OR
%left AND %left AND
%right NOT %right NOT
%right '=' %right '='
%nonassoc '<' '>' %nonassoc '<' '>'
%nonassoc LIKE %nonassoc LIKE ILIKE
%nonassoc OVERLAPS %nonassoc OVERLAPS
%nonassoc BETWEEN %nonassoc BETWEEN
%nonassoc IN %nonassoc IN
...@@ -263,15 +265,13 @@ make_name(void) ...@@ -263,15 +265,13 @@ make_name(void)
%left '+' '-' %left '+' '-'
%left '*' '/' '%' %left '*' '/' '%'
%left '^' %left '^'
%left '|' /* this is the relation union op, not logical or */ %left '|'
/* Unary Operators */ /* Unary Operators */
%right ':'
%left ';' /* end of statement or natural log */
%right UMINUS %right UMINUS
%left '.' %left '.'
%left '[' ']' %left '[' ']'
%left TYPECAST %left TYPECAST
%left UNION INTERSECT EXCEPT %left ESCAPE
%type <str> Iconst Fconst Sconst TransactionStmt CreateStmt UserId %type <str> Iconst Fconst Sconst TransactionStmt CreateStmt UserId
%type <str> CreateAsElement OptCreateAs CreateAsList CreateAsStmt %type <str> CreateAsElement OptCreateAs CreateAsList CreateAsStmt
...@@ -279,24 +279,24 @@ make_name(void) ...@@ -279,24 +279,24 @@ make_name(void)
%type <str> key_match ColLabel SpecialRuleRelation ColId columnDef %type <str> key_match ColLabel SpecialRuleRelation ColId columnDef
%type <str> ColConstraint ColConstraintElem NumericOnly FloatOnly %type <str> ColConstraint ColConstraintElem NumericOnly FloatOnly
%type <str> OptTableElementList OptTableElement TableConstraint %type <str> OptTableElementList OptTableElement TableConstraint
%type <str> ConstraintElem key_actions ColQualList TokenId %type <str> ConstraintElem key_actions ColQualList TokenId DropSchemaStmt
%type <str> target_list target_el update_target_list alias_clause %type <str> target_list target_el update_target_list alias_clause
%type <str> update_target_el opt_id relation_name database_name %type <str> update_target_el opt_id relation_name database_name
%type <str> access_method attr_name class index_name name func_name %type <str> access_method attr_name class index_name name func_name
%type <str> file_name AexprConst ParamNo c_expr %type <str> file_name AexprConst ParamNo c_expr ConstTypename
%type <str> in_expr_nodes a_expr b_expr TruncateStmt CommentStmt %type <str> in_expr_nodes a_expr b_expr TruncateStmt CommentStmt
%type <str> opt_indirection expr_list extract_list extract_arg %type <str> opt_indirection expr_list extract_list extract_arg
%type <str> position_list substr_list substr_from alter_column_action %type <str> position_list substr_list substr_from alter_column_action
%type <str> trim_list in_expr substr_for attr attrs drop_behavior %type <str> trim_list in_expr substr_for attr attrs drop_behavior
%type <str> Typename SimpleTypename Generic Numeric generic opt_float opt_numeric %type <str> Typename SimpleTypename Generic Numeric generic opt_float opt_numeric
%type <str> opt_decimal Character character opt_varying opt_charset %type <str> opt_decimal Character character opt_varying opt_charset
%type <str> opt_collate Datetime datetime opt_timezone opt_interval %type <str> opt_collate datetime opt_timezone opt_interval
%type <str> row_expr row_descriptor row_list typename numeric %type <str> row_expr row_descriptor row_list ConstDatetime opt_chain
%type <str> SelectStmt SubSelect result OptTemp ConstraintAttributeSpec %type <str> SelectStmt SubSelect result OptTemp ConstraintAttributeSpec
%type <str> opt_table opt_all sort_clause sortby_list ConstraintAttr %type <str> opt_table opt_all sort_clause sortby_list ConstraintAttr
%type <str> sortby OptUseOp opt_inh_star relation_name_list name_list %type <str> sortby OptUseOp opt_inh_star relation_name_list name_list
%type <str> group_clause having_clause from_clause opt_distinct %type <str> group_clause having_clause from_clause opt_distinct
%type <str> join_outer where_clause relation_expr sub_type %type <str> join_outer where_clause relation_expr sub_type opt_arg
%type <str> opt_column_list insert_rest InsertStmt OptimizableStmt %type <str> opt_column_list insert_rest InsertStmt OptimizableStmt
%type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt %type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt
%type <str> NotifyStmt columnElem copy_dirn UnlistenStmt copy_null %type <str> NotifyStmt columnElem copy_dirn UnlistenStmt copy_null
...@@ -304,8 +304,8 @@ make_name(void) ...@@ -304,8 +304,8 @@ make_name(void)
%type <str> opt_with_copy FetchStmt direction fetch_how_many from_in %type <str> opt_with_copy FetchStmt direction fetch_how_many from_in
%type <str> ClosePortalStmt DropStmt VacuumStmt opt_verbose func_arg %type <str> ClosePortalStmt DropStmt VacuumStmt opt_verbose func_arg
%type <str> opt_analyze opt_va_list va_list ExplainStmt index_params %type <str> opt_analyze opt_va_list va_list ExplainStmt index_params
%type <str> index_list func_index index_elem opt_type opt_class access_method_clause %type <str> index_list func_index index_elem opt_class access_method_clause
%type <str> index_opt_unique IndexStmt func_return %type <str> index_opt_unique IndexStmt func_return ConstInterval
%type <str> func_args_list func_args opt_with ProcedureStmt def_arg %type <str> func_args_list func_args opt_with ProcedureStmt def_arg
%type <str> def_elem def_list definition def_name def_type DefineStmt %type <str> def_elem def_list definition def_name def_type DefineStmt
%type <str> opt_instead event event_object RuleActionList opt_using %type <str> opt_instead event event_object RuleActionList opt_using
...@@ -324,21 +324,22 @@ make_name(void) ...@@ -324,21 +324,22 @@ make_name(void)
%type <str> TriggerActionTime CreateTrigStmt DropPLangStmt PLangTrusted %type <str> TriggerActionTime CreateTrigStmt DropPLangStmt PLangTrusted
%type <str> CreatePLangStmt IntegerOnly TriggerFuncArgs TriggerFuncArg %type <str> CreatePLangStmt IntegerOnly TriggerFuncArgs TriggerFuncArg
%type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_encoding %type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_encoding
%type <str> createdb_opt_location opt_encoding %type <str> createdb_opt_location opt_encoding OptInherit Geometric
%type <str> DropdbStmt ClusterStmt grantee RevokeStmt table_expr Bit bit %type <str> DropdbStmt ClusterStmt grantee RevokeStmt table_expr Bit bit
%type <str> GrantStmt privileges operation_commalist operation %type <str> GrantStmt privileges operation_commalist operation
%type <str> opt_cursor opt_lmode ConstraintsSetStmt comment_tg %type <str> opt_cursor opt_lmode ConstraintsSetStmt comment_tg
%type <str> case_expr when_clause_list case_default case_arg when_clause %type <str> case_expr when_clause_list case_default case_arg when_clause
%type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec %type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec
%type <str> select_offset_value using_expr join_expr ReindexStmt %type <str> select_offset_value using_expr join_expr ReindexStmt
%type <str> using_list from_expr join_clause join_type %type <str> using_list from_expr join_clause join_type opt_only opt_boolean
%type <str> join_qual update_list join_clause_with_union %type <str> join_qual update_list join_clause_with_union AlterSchemaStmt
%type <str> opt_level opt_lock lock_type users_in_new_group_clause %type <str> opt_level opt_lock lock_type users_in_new_group_clause
%type <str> OptConstrFromTable comment_op OptTempTableName %type <str> OptConstrFromTable comment_op OptTempTableName
%type <str> constraints_set_list constraints_set_namelist comment_fn %type <str> constraints_set_list constraints_set_namelist comment_fn
%type <str> constraints_set_mode comment_type comment_cl comment_ag %type <str> constraints_set_mode comment_type comment_cl comment_ag
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete %type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
%type <str> join_expr_with_union opt_force key_update %type <str> join_expr_with_union opt_force key_update CreateSchemaStmt
%type <str> SessionList SessionClause SetSessionStmt
/*** /***
#ifdef ENABLE_ORACLE_JOIN_SYNTAX #ifdef ENABLE_ORACLE_JOIN_SYNTAX
%type <str> oracle_list oracle_expr oracle_outer %type <str> oracle_list oracle_expr oracle_outer
...@@ -360,8 +361,8 @@ make_name(void) ...@@ -360,8 +361,8 @@ make_name(void)
%type <str> struct_type s_struct declaration declarations variable_declarations %type <str> struct_type s_struct declaration declarations variable_declarations
%type <str> s_union union_type ECPGSetAutocommit on_off %type <str> s_union union_type ECPGSetAutocommit on_off
%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol %type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol
%type <str> ECPGGetDescriptorHeader ECPGColId ECPGColLabel ECPGTypeName %type <str> ECPGGetDescriptorHeader ECPGColLabel ECPGTypeName
%type <str> ECPGLabelTypeName %type <str> ECPGLabelTypeName ECPGColId
%type <descriptor> ECPGFetchDescStmt ECPGGetDescriptor %type <descriptor> ECPGFetchDescStmt ECPGGetDescriptor
...@@ -393,7 +394,8 @@ statement: ecpgstart opt_at stmt ';' { connection = NULL; } ...@@ -393,7 +394,8 @@ statement: ecpgstart opt_at stmt ';' { connection = NULL; }
opt_at: SQL_AT connection_target { connection = $2; }; opt_at: SQL_AT connection_target { connection = $2; };
stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); } stmt: AlterSchemaStmt { output_statement($1, 0, NULL, connection); }
| AlterTableStmt { output_statement($1, 0, NULL, connection); }
| AlterGroupStmt { output_statement($1, 0, NULL, connection); } | AlterGroupStmt { output_statement($1, 0, NULL, connection); }
| AlterUserStmt { output_statement($1, 0, NULL, connection); } | AlterUserStmt { output_statement($1, 0, NULL, connection); }
| ClosePortalStmt { output_statement($1, 0, NULL, connection); } | ClosePortalStmt { output_statement($1, 0, NULL, connection); }
...@@ -401,6 +403,7 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); } ...@@ -401,6 +403,7 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); }
| CopyStmt { output_statement($1, 0, NULL, connection); } | CopyStmt { output_statement($1, 0, NULL, connection); }
| CreateStmt { output_statement($1, 0, NULL, connection); } | CreateStmt { output_statement($1, 0, NULL, connection); }
| CreateAsStmt { output_statement($1, 0, NULL, connection); } | CreateAsStmt { output_statement($1, 0, NULL, connection); }
| CreateSchemaStmt { output_statement($1, 0, NULL, connection); }
| CreateGroupStmt { output_statement($1, 0, NULL, connection); } | CreateGroupStmt { output_statement($1, 0, NULL, connection); }
| CreateSeqStmt { output_statement($1, 0, NULL, connection); } | CreateSeqStmt { output_statement($1, 0, NULL, connection); }
| CreatePLangStmt { output_statement($1, 0, NULL, connection); } | CreatePLangStmt { output_statement($1, 0, NULL, connection); }
...@@ -409,6 +412,7 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); } ...@@ -409,6 +412,7 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); }
| ClusterStmt { output_statement($1, 0, NULL, connection); } | ClusterStmt { output_statement($1, 0, NULL, connection); }
| DefineStmt { output_statement($1, 0, NULL, connection); } | DefineStmt { output_statement($1, 0, NULL, connection); }
| DropStmt { output_statement($1, 0, NULL, connection); } | DropStmt { output_statement($1, 0, NULL, connection); }
| DropSchemaStmt { output_statement($1, 0, NULL, connection); }
| TruncateStmt { output_statement($1, 0, NULL, connection); } | TruncateStmt { output_statement($1, 0, NULL, connection); }
| DropGroupStmt { output_statement($1, 0, NULL, connection); } | DropGroupStmt { output_statement($1, 0, NULL, connection); }
| DropPLangStmt { output_statement($1, 0, NULL, connection); } | DropPLangStmt { output_statement($1, 0, NULL, connection); }
...@@ -437,6 +441,7 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); } ...@@ -437,6 +441,7 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); }
output_statement($1, 1, NULL, connection); output_statement($1, 1, NULL, connection);
} }
| RuleStmt { output_statement($1, 0, NULL, connection); } | RuleStmt { output_statement($1, 0, NULL, connection); }
| SetSessionStmt { output_statement($1, 0, NULL, connection); }
| TransactionStmt { | TransactionStmt {
fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1); fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(2); whenever_action(2);
...@@ -739,6 +744,67 @@ DropGroupStmt: DROP GROUP UserId ...@@ -739,6 +744,67 @@ DropGroupStmt: DROP GROUP UserId
} }
; ;
/*****************************************************************************
*
* Manipulate a schema
*
*
*****************************************************************************/
CreateSchemaStmt: CREATE SCHEMA UserId
{
$$ = cat2_str(make_str("create scheme"), $3);
}
;
AlterSchemaStmt: ALTER SCHEMA UserId
{
$$ = cat2_str(make_str("alter scheme"), $3);
}
;
DropSchemaStmt: DROP SCHEMA UserId
{
$$ = cat2_str(make_str("drop scheme"), $3);
}
;
/*****************************************************************************
*
* Manipulate a postgresql session
*
*
*****************************************************************************/
SetSessionStmt: SET SESSION CHARACTERISTICS AS SessionList
{
$$ = cat2_str(make_str("set session characteristics as"), $5);
}
;
SessionList: SessionList ',' SessionClause
{
$$ = cat_str(3, $1, make_str(","), $3);
}
| SessionClause
{
$$ = $1;
}
;
SessionClause: TRANSACTION COMMIT opt_boolean
{
$$ = cat2_str(make_str("transaction commit"), $3);
}
| TIME ZONE zone_value
{
$$ = cat2_str(make_str("time zone"), $3);
}
| TRANSACTION ISOLATION LEVEL opt_level
{
$$ = cat2_str(make_str("transaction isolation level"), $4);
}
;
/***************************************************************************** /*****************************************************************************
* *
...@@ -780,18 +846,25 @@ opt_level: READ COMMITTED { $$ = make_str("read committed"); } ...@@ -780,18 +846,25 @@ opt_level: READ COMMITTED { $$ = make_str("read committed"); }
; ;
var_value: Sconst { $$ = $1; } var_value: opt_boolean { $$ = $1; }
| FCONST { $$ = make_name(); } | Sconst { $$ = $1; }
| Iconst { $$ = $1; } | Iconst { $$ = $1; }
| '-' Iconst { $$ = cat2_str(make_str("-"), $2); }
| Fconst { $$ = $1; }
| '-' Fconst { $$ = cat2_str(make_str("-"), $2); }
| name_list { | name_list {
if (strlen($1) == 0) if (strlen($1) == 0)
mmerror(ET_ERROR, "SET must have at least one argument."); mmerror(ET_ERROR, "SET must have at least one argument.");
$$ = $1; $$ = $1;
} }
/* "OFF" is not a token, so it is handled by the name_list production */ | DEFAULT { $$ = make_str("default"); }
| ON { $$ = make_str("on"); } ;
| DEFAULT { $$ = make_str("default"); }
opt_boolean: TRUE_P { $$ = make_str("true"); }
| FALSE_P { $$ = make_str("false"); }
| ON { $$ = make_str("on"); }
| OFF { $$ = make_str("off"); }
; ;
zone_value: Sconst { $$ = $1; } zone_value: Sconst { $$ = $1; }
...@@ -993,10 +1066,10 @@ copy_null: WITH NULL_P AS Sconst { $$ = cat2_str(make_str("with null as"), $4); ...@@ -993,10 +1066,10 @@ copy_null: WITH NULL_P AS Sconst { $$ = cat2_str(make_str("with null as"), $4);
* *
*****************************************************************************/ *****************************************************************************/
CreateStmt: CREATE OptTemp TABLE relation_name '(' OptTableElementList ')' CreateStmt: CREATE OptTemp TABLE relation_name OptUnder '(' OptTableElementList ')'
OptUnder OptInherit
{ {
$$ = cat_str(8, make_str("create"), $2, make_str("table"), $4, make_str("("), $6, make_str(")"), $8); $$ = cat_str(9, make_str("create"), $2, make_str("table"), $4, $5, make_str("("), $7, make_str(")"), $9);
} }
; ;
...@@ -1191,22 +1264,33 @@ key_reference: NO ACTION { $$ = make_str("no action"); } ...@@ -1191,22 +1264,33 @@ key_reference: NO ACTION { $$ = make_str("no action"); }
| SET NULL_P { $$ = make_str("set null"); } | SET NULL_P { $$ = make_str("set null"); }
; ;
OptUnder: UNDER relation_name_list { $$ = cat_str(2, make_str("under "), $2); } OptUnder: UNDER relation_name_list { $$ = cat2_str(make_str("under"), $2); }
| INHERITS '(' relation_name_list ')' { $$ = cat_str(3, make_str("inherits ("), $3, make_str(")")); } | /*EMPTY*/ { $$ = EMPTY; }
| /*EMPTY*/ { $$ = EMPTY; } ;
;
opt_only: ONLY { $$ = make_str("only"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
/* INHERITS is Deprecated */
OptInherit: INHERITS '(' relation_name_list ')' { $$ = cat_str(3, make_str("inherits ("), $3, make_str(")")); }
| /*EMPTY*/ { $$ = EMPTY; }
;
/* /*
* Note: CREATE TABLE ... AS SELECT ... is just another spelling for * Note: CREATE TABLE ... AS SELECT ... is just another spelling for
* SELECT ... INTO. * SELECT ... INTO.
*/ */
CreateAsStmt: CREATE OptTemp TABLE relation_name OptCreateAs AS SelectStmt CreateAsStmt: CREATE OptTemp TABLE relation_name OptUnder OptCreateAs AS SelectStmt
{ {
if (FoundInto == 1) if (FoundInto == 1)
mmerror(ET_ERROR, "CREATE TABLE/AS SELECT may not specify INTO"); mmerror(ET_ERROR, "CREATE TABLE/AS SELECT may not specify INTO");
$$ = cat_str(7, make_str("create"), $2, make_str("table"), $4, $5, make_str("as"), $7); if (strlen($5) > 0)
mmerror(ET_ERROR, "CREATE TABLE/AS SELECT does not support UNDER");
$$ = cat_str(8, make_str("create"), $2, make_str("table"), $4, $5, $6, make_str("as"), $8);
} }
; ;
...@@ -1391,7 +1475,7 @@ TriggerFuncArg: Iconst ...@@ -1391,7 +1475,7 @@ TriggerFuncArg: Iconst
$$ = $1; $$ = $1;
} }
| Sconst { $$ = $1; } | Sconst { $$ = $1; }
| ident { $$ = $1; } | ColId { $$ = $1; }
; ;
OptConstrFromTable: /* Empty */ OptConstrFromTable: /* Empty */
...@@ -1450,13 +1534,6 @@ DefineStmt: CREATE def_type def_name definition ...@@ -1450,13 +1534,6 @@ DefineStmt: CREATE def_type def_name definition
$$ = cat_str(3, make_str("create"), $2, $3, $4); $$ = cat_str(3, make_str("create"), $2, $3, $4);
} }
; ;
/*
def_rest: def_name definition
{
$$ = cat2_str($1, $2);
}
;
*/
def_type: OPERATOR { $$ = make_str("operator"); } def_type: OPERATOR { $$ = make_str("operator"); }
| TYPE_P { $$ = make_str("type"); } | TYPE_P { $$ = make_str("type"); }
...@@ -1466,12 +1543,8 @@ def_type: OPERATOR { $$ = make_str("operator"); } ...@@ -1466,12 +1543,8 @@ def_type: OPERATOR { $$ = make_str("operator"); }
def_name: PROCEDURE { $$ = make_str("procedure"); } def_name: PROCEDURE { $$ = make_str("procedure"); }
| JOIN { $$ = make_str("join"); } | JOIN { $$ = make_str("join"); }
| all_Op { $$ = $1; } | all_Op { $$ = $1; }
| typename { $$ = $1; } | ColId { $$ = $1; }
| TokenId { $$ = $1; } ;
| INTERVAL { $$ = make_str("interval"); }
| TIME { $$ = make_str("time"); }
| TIMESTAMP { $$ = make_str("timestamp"); }
;
definition: '(' def_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); } definition: '(' def_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
; ;
...@@ -1795,30 +1868,36 @@ index_list: index_list ',' index_elem { $$ = cat_str(3, $1, make_str(","), $3) ...@@ -1795,30 +1868,36 @@ index_list: index_list ',' index_elem { $$ = cat_str(3, $1, make_str(","), $3)
| index_elem { $$ = $1; } | index_elem { $$ = $1; }
; ;
func_index: func_name '(' name_list ')' opt_type opt_class func_index: func_name '(' name_list ')' opt_class
{ {
$$ = cat_str(6, $1, make_str("("), $3, ")", $5, $6); $$ = cat_str(5, $1, make_str("("), $3, ")", $5);
} }
; ;
index_elem: attr_name opt_type opt_class index_elem: attr_name opt_class
{ {
$$ = cat_str(3, $1, $2, $3); $$ = cat2_str($1, $2);
} }
; ;
opt_type: ':' Typename { $$ = cat2_str(make_str(":"), $2); } opt_class: class {
| FOR Typename { $$ = cat2_str(make_str("for"), $2); } /*
| /*EMPTY*/ { $$ = EMPTY; } * Release 7.0 removed network_ops, timespan_ops, and
; * datetime_ops, so we suppress it from being passed to
* the parser so the default *_ops is used. This can be
/* opt_class "WITH class" conflicts with preceeding opt_type * removed in some later release. bjm 2000/02/07
* for Typename of "TIMESTAMP WITH TIME ZONE" *
* So, remove "WITH class" from the syntax. OK?? * Release 7.1 removes lztext_ops, so suppress that too
* - thomas 1997-10-12 * for a while. tgl 2000/07/30
* | WITH class { $$ = $2; } */
*/ if (strcmp($1, "network_ops") != 0 &&
opt_class: class { $$ = $1; } strcmp($1, "timespan_ops") != 0 &&
strcmp($1, "datetime_ops") != 0 &&
strcmp($1, "lztext_ops") != 0)
$$ = $1;
else
$$ = EMPTY;
}
| USING class { $$ = cat2_str(make_str("using"), $2); } | USING class { $$ = cat2_str(make_str("using"), $2); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
...@@ -1892,17 +1971,45 @@ func_args_list: func_arg { $$ = $1; } ...@@ -1892,17 +1971,45 @@ func_args_list: func_arg { $$ = $1; }
* so that won't work here. The only thing we give up is array notation, * so that won't work here. The only thing we give up is array notation,
* which isn't meaningful in this context anyway. * which isn't meaningful in this context anyway.
* - thomas 2000-03-25 * - thomas 2000-03-25
*/ * The following productions are difficult, since it is difficult to
func_arg: SimpleTypename * distinguish between TokenId and SimpleTypename:
opt_arg TokenId SimpleTypename
{
$$ = $3;
}
| TokenId SimpleTypename
{
$$ = $2;
}
*/
func_arg: opt_arg SimpleTypename
{ {
/* We can catch over-specified arguments here if we want to, /* We can catch over-specified arguments here if we want to,
* but for now better to silently swallow typmod, etc. * but for now better to silently swallow typmod, etc.
* - thomas 2000-03-22 * - thomas 2000-03-22
*/ */
$$ = $1; $$ = cat2_str($1, $2);
} }
| SimpleTypename
{
$$ = $1;
}
; ;
opt_arg: IN { $$ = make_str("in"); }
| OUT {
mmerror(ET_ERROR, "CREATE FUNCTION/OUT parameters are not supported");
$$ = make_str("out");
}
| INOUT {
mmerror(ET_ERROR, "CREATE FUNCTION/INOUT parameters are not supported");
$$ = make_str("oinut");
}
;
func_as: Sconst { $$ = $1; } func_as: Sconst { $$ = $1; }
| Sconst ',' Sconst { $$ = cat_str(3, $1, make_str(","), $3); } | Sconst ',' Sconst { $$ = cat_str(3, $1, make_str(","), $3); }
...@@ -2135,14 +2242,25 @@ UnlistenStmt: UNLISTEN relation_name ...@@ -2135,14 +2242,25 @@ UnlistenStmt: UNLISTEN relation_name
TransactionStmt: ABORT_TRANS opt_trans { $$ = make_str("rollback"); } TransactionStmt: ABORT_TRANS opt_trans { $$ = make_str("rollback"); }
| BEGIN_TRANS opt_trans { $$ = make_str("begin transaction"); } | BEGIN_TRANS opt_trans { $$ = make_str("begin transaction"); }
| COMMIT opt_trans { $$ = make_str("commit"); } | COMMIT opt_trans { $$ = make_str("commit"); }
| END_TRANS opt_trans { $$ = make_str("commit"); } | COMMIT opt_trans opt_chain { $$ = cat2_str(make_str("commit"), $3); }
| ROLLBACK opt_trans { $$ = make_str("rollback"); } | END_TRANS opt_trans { $$ = make_str("commit"); }
| ROLLBACK opt_trans { $$ = make_str("rollback"); }
| ROLLBACK opt_trans opt_chain { $$ = cat2_str(make_str("rollback"), $3); }
;
opt_trans: WORK { $$ = ""; } opt_trans: WORK { $$ = ""; }
| TRANSACTION { $$ = ""; } | TRANSACTION { $$ = ""; }
| /*EMPTY*/ { $$ = ""; } | /*EMPTY*/ { $$ = ""; }
; ;
opt_chain: AND NO CHAIN { $$ = make_str("and no chain"); }
| AND CHAIN {
mmerror(ET_ERROR, "COMMIT/CHAIN not yet supported");
$$ = make_str("and chain");
}
;
/***************************************************************************** /*****************************************************************************
* *
* QUERY: * QUERY:
...@@ -2394,10 +2512,9 @@ columnElem: ColId opt_indirection ...@@ -2394,10 +2512,9 @@ columnElem: ColId opt_indirection
* *
*****************************************************************************/ *****************************************************************************/
DeleteStmt: DELETE FROM relation_name DeleteStmt: DELETE FROM opt_only name where_clause
where_clause
{ {
$$ = cat_str(3, make_str("delete from"), $3, $4); $$ = cat_str(4, make_str("delete from"), $3, $4, $5);
} }
; ;
...@@ -2428,12 +2545,12 @@ opt_lmode: SHARE { $$ = make_str("share"); } ...@@ -2428,12 +2545,12 @@ opt_lmode: SHARE { $$ = make_str("share"); }
* *
*****************************************************************************/ *****************************************************************************/
UpdateStmt: UPDATE relation_name UpdateStmt: UPDATE opt_only relation_name
SET update_target_list SET update_target_list
from_clause from_clause
where_clause where_clause
{ {
$$ = cat_str(6, make_str("update"), $2, make_str("set"), $4, $5, $6); $$ = cat_str(7, make_str("update"), $2, $3, make_str("set"), $5, $6, $7);
} }
; ;
...@@ -2880,7 +2997,7 @@ relation_expr: relation_name ...@@ -2880,7 +2997,7 @@ relation_expr: relation_name
| ONLY relation_name %prec '=' | ONLY relation_name %prec '='
{ {
/* inheritance query */ /* inheritance query */
$$ = cat2_str(make_str("ONLY "), $2); $$ = cat2_str(make_str("ONLY "), $2);
} }
opt_array_bounds: '[' ']' opt_array_bounds opt_array_bounds: '[' ']' opt_array_bounds
...@@ -2936,20 +3053,18 @@ Typename: SimpleTypename opt_array_bounds ...@@ -2936,20 +3053,18 @@ Typename: SimpleTypename opt_array_bounds
} }
; ;
SimpleTypename: Generic { $$ = $1; } SimpleTypename: ConstTypename { $$ = $1; }
| Datetime { $$ = $1; } | ConstInterval { $$ = $1; }
;
ConstTypename: Generic { $$ = $1; }
| ConstDatetime { $$ = $1; }
| Numeric { $$ = $1; } | Numeric { $$ = $1; }
| Geometric { $$ = $1; }
| Bit { $$ = $1; } | Bit { $$ = $1; }
| Character { $$ = $1; } | Character { $$ = $1; }
; ;
typename: generic { $$ = $1; }
| numeric { $$ = $1; }
| bit { $$ = $1; }
| character { $$ = $1; }
| datetime { $$ = $1; }
;
Generic: generic Generic: generic
{ {
$$ = $1; $$ = $1;
...@@ -2958,50 +3073,8 @@ Generic: generic ...@@ -2958,50 +3073,8 @@ Generic: generic
generic: ident { $$ = $1; } generic: ident { $$ = $1; }
| TYPE_P { $$ = make_str("type"); } | TYPE_P { $$ = make_str("type"); }
| SQL_AT { $$ = make_str("at"); } | ECPGKeywords { $$ = $1; }
| SQL_AUTOCOMMIT { $$ = make_str("autocommit"); } | ECPGTypeName { $$ = $1; }
| SQL_BOOL { $$ = make_str("bool"); }
| SQL_BREAK { $$ = make_str("break"); }
| SQL_CALL { $$ = make_str("call"); }
| SQL_CONNECT { $$ = make_str("connect"); }
| SQL_CONNECTION { $$ = make_str("connection"); }
| SQL_CONTINUE { $$ = make_str("continue"); }
| SQL_COUNT { $$ = make_str("count"); }
| SQL_DATA { $$ = make_str("data"); }
| SQL_DATETIME_INTERVAL_CODE { $$ = make_str("datetime_interval_code"); }
| SQL_DATETIME_INTERVAL_PRECISION { $$ = make_str("datetime_interval_precision"); }
| SQL_DEALLOCATE { $$ = make_str("deallocate"); }
| SQL_DISCONNECT { $$ = make_str("disconnect"); }
| SQL_FOUND { $$ = make_str("found"); }
| SQL_GO { $$ = make_str("go"); }
| SQL_GOTO { $$ = make_str("goto"); }
| SQL_IDENTIFIED { $$ = make_str("identified"); }
| SQL_INDICATOR { $$ = make_str("indicator"); }
| SQL_INT { $$ = make_str("int"); }
| SQL_KEY_MEMBER { $$ = make_str("key_member"); }
| SQL_LENGTH { $$ = make_str("length"); }
| SQL_LONG { $$ = make_str("long"); }
| SQL_NAME { $$ = make_str("name"); }
| SQL_NULLABLE { $$ = make_str("nullable"); }
| SQL_OCTET_LENGTH { $$ = make_str("octet_length"); }
| SQL_OFF { $$ = make_str("off"); }
| SQL_OPEN { $$ = make_str("open"); }
| SQL_PREPARE { $$ = make_str("prepare"); }
| SQL_RELEASE { $$ = make_str("release"); }
| SQL_RETURNED_LENGTH { $$ = make_str("returned_length"); }
| SQL_RETURNED_OCTET_LENGTH { $$ = make_str("returned_octet_length"); }
| SQL_SCALE { $$ = make_str("scale"); }
| SQL_SECTION { $$ = make_str("section"); }
| SQL_SHORT { $$ = make_str("short"); }
| SQL_SIGNED { $$ = make_str("signed"); }
| SQL_SQLERROR { $$ = make_str("sqlerror"); }
| SQL_SQLPRINT { $$ = make_str("sqlprint"); }
| SQL_SQLWARNING { $$ = make_str("sqlwarning"); }
| SQL_STOP { $$ = make_str("stop"); }
| SQL_STRUCT { $$ = make_str("struct"); }
| SQL_UNSIGNED { $$ = make_str("unsigned"); }
| SQL_VAR { $$ = make_str("var"); }
| SQL_WHENEVER { $$ = make_str("whenever"); }
; ;
/* SQL92 numeric data types /* SQL92 numeric data types
...@@ -3031,12 +3104,7 @@ Numeric: FLOAT opt_float ...@@ -3031,12 +3104,7 @@ Numeric: FLOAT opt_float
} }
; ;
numeric: FLOAT { $$ = make_str("float"); } Geometric: PATH_P { $$ = make_str("path"); };
| DOUBLE PRECISION { $$ = make_str("double precision"); }
| DECIMAL { $$ = make_str("decimal"); }
| DEC { $$ = make_str("dec"); }
| NUMERIC { $$ = make_str("numeric"); }
;
opt_float: '(' Iconst ')' opt_float: '(' Iconst ')'
{ {
...@@ -3183,7 +3251,7 @@ opt_collate: COLLATE ColId { $$ = cat2_str(make_str("collate"), $2); } ...@@ -3183,7 +3251,7 @@ opt_collate: COLLATE ColId { $$ = cat2_str(make_str("collate"), $2); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
Datetime: datetime ConstDatetime: datetime
{ {
$$ = $1; $$ = $1;
} }
...@@ -3195,7 +3263,9 @@ Datetime: datetime ...@@ -3195,7 +3263,9 @@ Datetime: datetime
{ {
$$ = cat2_str(make_str("time"), $2); $$ = cat2_str(make_str("time"), $2);
} }
| INTERVAL opt_interval ;
ConstInterval: INTERVAL opt_interval
{ {
$$ = cat2_str(make_str("interval"), $2); $$ = cat2_str(make_str("interval"), $2);
} }
...@@ -3210,6 +3280,7 @@ datetime: YEAR_P { $$ = make_str("year"); } ...@@ -3210,6 +3280,7 @@ datetime: YEAR_P { $$ = make_str("year"); }
; ;
opt_timezone: WITH TIME ZONE { $$ = make_str("with time zone"); } opt_timezone: WITH TIME ZONE { $$ = make_str("with time zone"); }
| WITHOUT TIME ZONE { $$ = make_str("without time zone"); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
...@@ -3336,14 +3407,6 @@ a_expr: c_expr ...@@ -3336,14 +3407,6 @@ a_expr: c_expr
{ $$ = cat2_str(make_str("^"), $2); } { $$ = cat2_str(make_str("^"), $2); }
| '|' a_expr | '|' a_expr
{ $$ = cat2_str(make_str("|"), $2); } { $$ = cat2_str(make_str("|"), $2); }
/* not possible in embedded sql | ':' a_expr
{ $$ = cat2_str(make_str(":"), $2); }
*/
| ';' a_expr
{ $$ = cat2_str(make_str(";"), $2);
mmerror(ET_WARN, "The ';' operator is deprecated. Use ln(x) instead."
"\n\tThis operator will be removed in a future release.");
}
| a_expr '%' | a_expr '%'
{ $$ = cat2_str($1, make_str("%")); } { $$ = cat2_str($1, make_str("%")); }
| a_expr '^' | a_expr '^'
...@@ -3384,8 +3447,20 @@ a_expr: c_expr ...@@ -3384,8 +3447,20 @@ a_expr: c_expr
{ $$ = cat2_str(make_str("not"), $2); } { $$ = cat2_str(make_str("not"), $2); }
| a_expr LIKE a_expr | a_expr LIKE a_expr
{ $$ = cat_str(3, $1, make_str("like"), $3); } { $$ = cat_str(3, $1, make_str("like"), $3); }
| a_expr LIKE a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("like"), $3, make_str("escape"), $5); }
| a_expr NOT LIKE a_expr | a_expr NOT LIKE a_expr
{ $$ = cat_str(3, $1, make_str("not like"), $4); } { $$ = cat_str(3, $1, make_str("not like"), $4); }
| a_expr NOT LIKE a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("not like"), $4, make_str("escape"), $6); }
| a_expr ILIKE a_expr
{ $$ = cat_str(3, $1, make_str("ilike"), $3); }
| a_expr ILIKE a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("ilike"), $3, make_str("escape"), $5); }
| a_expr NOT ILIKE a_expr
{ $$ = cat_str(3, $1, make_str("not ilike"), $4); }
| a_expr NOT ILIKE a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("not ilike"), $4, make_str("escape"), $6); }
| a_expr ISNULL | a_expr ISNULL
{ $$ = cat2_str($1, make_str("isnull")); } { $$ = cat2_str($1, make_str("isnull")); }
| a_expr IS NULL_P | a_expr IS NULL_P
...@@ -3457,14 +3532,6 @@ b_expr: c_expr ...@@ -3457,14 +3532,6 @@ b_expr: c_expr
{ $$ = cat2_str(make_str("^"), $2); } { $$ = cat2_str(make_str("^"), $2); }
| '|' b_expr | '|' b_expr
{ $$ = cat2_str(make_str("|"), $2); } { $$ = cat2_str(make_str("|"), $2); }
/* not possible in embedded sql | ':' b_expr
{ $$ = cat2_str(make_str(":"), $2); }
*/
| ';' b_expr
{ $$ = cat2_str(make_str(";"), $2);
mmerror(ET_WARN, "The ';' operator is deprecated. Use ln(x) instead."
"\n\tThis operator will be removed in a future release.");
}
| b_expr '%' | b_expr '%'
{ $$ = cat2_str($1, make_str("%")); } { $$ = cat2_str($1, make_str("%")); }
| b_expr '^' | b_expr '^'
...@@ -3814,9 +3881,9 @@ relation_name: SpecialRuleRelation ...@@ -3814,9 +3881,9 @@ relation_name: SpecialRuleRelation
; ;
database_name: ColId { $$ = $1; }; database_name: ColId { $$ = $1; };
access_method: ident { $$ = $1; }; access_method: ColId { $$ = $1; };
attr_name: ColId { $$ = $1; }; attr_name: ColId { $$ = $1; };
class: ident { $$ = $1; }; class: ColId { $$ = $1; };
index_name: ColId { $$ = $1; }; index_name: ColId { $$ = $1; };
/* Functions /* Functions
...@@ -3827,7 +3894,6 @@ name: ColId { $$ = $1; }; ...@@ -3827,7 +3894,6 @@ name: ColId { $$ = $1; };
func_name: ColId { $$ = $1; }; func_name: ColId { $$ = $1; };
file_name: Sconst { $$ = $1; }; file_name: Sconst { $$ = $1; };
/* NOT USED recipe_name: ident { $$ = $1; };*/
/* Constants /* Constants
* Include TRUE/FALSE for SQL3 support. - thomas 1997-10-24 * Include TRUE/FALSE for SQL3 support. - thomas 1997-10-24
...@@ -3844,13 +3910,14 @@ AexprConst: Iconst ...@@ -3844,13 +3910,14 @@ AexprConst: Iconst
{ {
$$ = $1; $$ = $1;
} }
/* this rule formerly used Typename, but that causes reduce conf licts | ConstTypename Sconst
* with subscripted column names ...
*/
| SimpleTypename Sconst
{ {
$$ = cat2_str($1, $2); $$ = cat2_str($1, $2);
} }
| ConstInterval Sconst opt_interval
{
$$ = cat_str(3, $1, $2, $3);
}
| ParamNo | ParamNo
{ $$ = $1; } { $$ = $1; }
| TRUE_P | TRUE_P
...@@ -3883,18 +3950,12 @@ Sconst: SCONST { ...@@ -3883,18 +3950,12 @@ Sconst: SCONST {
$$[strlen($1)+1]='\''; $$[strlen($1)+1]='\'';
free($1); free($1);
} }
UserId: ident { $$ = $1;}; UserId: ColId { $$ = $1;};
/* Column identifier /* Column identifier
* Include date/time keywords as SQL92 extension.
* Include TYPE as a SQL92 unreserved keyword. - thomas 1997-10-05
* Add other keywords. Note that as the syntax expands,
* some of these keywords will have to be removed from this
* list due to shift/reduce conflicts in yacc. If so, move
* down to the ColLabel entity. - thomas 1997-11-06
*/ */
ColId: ECPGColId { $$ = $1; } ColId: ECPGColId { $$ = $1; }
| ECPGTypeName { $$ = $1; } /* | ECPGTypeName { $$ = $1; }*/
; ;
/* Column label /* Column label
...@@ -3959,18 +4020,18 @@ connection_target: database_name opt_server opt_port ...@@ -3959,18 +4020,18 @@ connection_target: database_name opt_server opt_port
$$ = make3_str(make_str("\""), make3_str($1, $2, $3), make_str("\"")); $$ = make3_str(make_str("\""), make3_str($1, $2, $3), make_str("\""));
} }
| db_prefix server opt_port '/' database_name opt_options | db_prefix ':' server opt_port '/' database_name opt_options
{ {
/* new style: <tcp|unix>:postgresql://server[:port][/dbname] */ /* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
if (strncmp($2, "://", strlen("://")) != 0) if (strncmp($3, "//", strlen("//")) != 0)
{ {
sprintf(errortext, "parse error at or near '%s'", $2); sprintf(errortext, "parse error at or near '%s'", $3);
mmerror(ET_ERROR, errortext); mmerror(ET_ERROR, errortext);
} }
if (strncmp($1, "unix", strlen("unix")) == 0 && strncmp($2 + strlen("://"), "localhost", strlen("localhost")) != 0) if (strncmp($1, "unix", strlen("unix")) == 0 && strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0)
{ {
sprintf(errortext, "unix domain sockets only work on 'localhost' but not on '%9.9s'", $2); sprintf(errortext, "unix domain sockets only work on 'localhost' but not on '%9.9s'", $3 +strlen("//"));
mmerror(ET_ERROR, errortext); mmerror(ET_ERROR, errortext);
} }
...@@ -3980,7 +4041,7 @@ connection_target: database_name opt_server opt_port ...@@ -3980,7 +4041,7 @@ connection_target: database_name opt_server opt_port
mmerror(ET_ERROR, errortext); mmerror(ET_ERROR, errortext);
} }
$$ = make2_str(make3_str(make_str("\""), $1, $2), make3_str(make3_str($3, make_str("/"), $5), $6, make_str("\""))); $$ = make3_str(make3_str(make_str("\""), $1, make_str(":")), $3, make3_str(make3_str($4, make_str("/"), $6), $7, make_str("\"")));
} }
| char_variable | char_variable
{ {
...@@ -4008,12 +4069,12 @@ db_prefix: ident cvariable ...@@ -4008,12 +4069,12 @@ db_prefix: ident cvariable
mmerror(ET_ERROR, errortext); mmerror(ET_ERROR, errortext);
} }
$$ = make3_str( $1, make_str(":"), $2); $$ = make3_str($1, make_str(":"), $2);
} }
server: Op server_name server: Op server_name
{ {
if (strcmp($1, "@") != 0 && strcmp($1, "://") != 0) if (strcmp($1, "@") != 0 && strcmp($1, "//") != 0)
{ {
sprintf(errortext, "parse error at or near '%s'", $1); sprintf(errortext, "parse error at or near '%s'", $1);
mmerror(ET_ERROR, errortext); mmerror(ET_ERROR, errortext);
...@@ -4317,24 +4378,28 @@ simple_type: unsigned_type { $$=$1; } ...@@ -4317,24 +4378,28 @@ simple_type: unsigned_type { $$=$1; }
| opt_signed signed_type { $$=$2; } | opt_signed signed_type { $$=$2; }
; ;
unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ = ECPGt_unsigned_short; } unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ = ECPGt_unsigned_short; }
| SQL_UNSIGNED SQL_SHORT SQL_INT { $$ = ECPGt_unsigned_short; } | SQL_UNSIGNED SQL_SHORT SQL_INT { $$ = ECPGt_unsigned_short; }
| SQL_UNSIGNED { $$ = ECPGt_unsigned_int; } | SQL_UNSIGNED { $$ = ECPGt_unsigned_int; }
| SQL_UNSIGNED SQL_INT { $$ = ECPGt_unsigned_int; } | SQL_UNSIGNED SQL_INT { $$ = ECPGt_unsigned_int; }
| SQL_UNSIGNED SQL_LONG { $$ = ECPGt_unsigned_long; } | SQL_UNSIGNED SQL_LONG { $$ = ECPGt_unsigned_long; }
| SQL_UNSIGNED SQL_LONG SQL_INT { $$ = ECPGt_unsigned_long; } | SQL_UNSIGNED SQL_LONG SQL_INT { $$ = ECPGt_unsigned_long; }
| SQL_UNSIGNED CHAR { $$ = ECPGt_unsigned_char; } | SQL_UNSIGNED SQL_LONG SQL_LONG { $$ = ECPGt_unsigned_long_long; }
; | SQL_UNSIGNED SQL_LONG SQL_LONG SQL_INT { $$ = ECPGt_unsigned_long_long; }
| SQL_UNSIGNED CHAR { $$ = ECPGt_unsigned_char; }
signed_type: SQL_SHORT { $$ = ECPGt_short; } ;
| SQL_SHORT SQL_INT { $$ = ECPGt_short; }
| SQL_INT { $$ = ECPGt_int; } signed_type: SQL_SHORT { $$ = ECPGt_short; }
| SQL_LONG { $$ = ECPGt_long; } | SQL_SHORT SQL_INT { $$ = ECPGt_short; }
| SQL_LONG SQL_INT { $$ = ECPGt_long; } | SQL_INT { $$ = ECPGt_int; }
| SQL_BOOL { $$ = ECPGt_bool; }; | SQL_LONG { $$ = ECPGt_long; }
| FLOAT { $$ = ECPGt_float; } | SQL_LONG SQL_INT { $$ = ECPGt_long; }
| DOUBLE { $$ = ECPGt_double; } | SQL_LONG SQL_LONG { $$ = ECPGt_long_long; }
| CHAR { $$ = ECPGt_char; } | SQL_LONG SQL_LONG SQL_INT { $$ = ECPGt_long; }
| SQL_BOOL { $$ = ECPGt_bool; };
| FLOAT { $$ = ECPGt_float; }
| DOUBLE { $$ = ECPGt_double; }
| CHAR { $$ = ECPGt_char; }
; ;
opt_signed: SQL_SIGNED opt_signed: SQL_SIGNED
...@@ -4662,7 +4727,7 @@ ECPGSetAutocommit: SET SQL_AUTOCOMMIT to_equal on_off ...@@ -4662,7 +4727,7 @@ ECPGSetAutocommit: SET SQL_AUTOCOMMIT to_equal on_off
}; };
on_off: ON { $$ = make_str("on"); } on_off: ON { $$ = make_str("on"); }
| SQL_OFF { $$ = make_str("off"); } | OFF { $$ = make_str("off"); }
; ;
to_equal: TO | '='; to_equal: TO | '=';
...@@ -4905,7 +4970,7 @@ action : SQL_CONTINUE ...@@ -4905,7 +4970,7 @@ action : SQL_CONTINUE
/* some other stuff for ecpg */ /* some other stuff for ecpg */
/* additional ColId entries */ /* additional ColId entries */
ECPGKeywords: SQL_AT { $$ = make_str("at"); } ECPGKeywords: SQL_AT { $$ = make_str("at"); }
| SQL_BREAK { $$ = make_str("break"); } | SQL_BREAK { $$ = make_str("break"); }
| SQL_CALL { $$ = make_str("call"); } | SQL_CALL { $$ = make_str("call"); }
| SQL_CONNECT { $$ = make_str("connect"); } | SQL_CONNECT { $$ = make_str("connect"); }
...@@ -4926,7 +4991,6 @@ ECPGKeywords: SQL_AT { $$ = make_str("at"); } ...@@ -4926,7 +4991,6 @@ ECPGKeywords: SQL_AT { $$ = make_str("at"); }
| SQL_NAME { $$ = make_str("name"); } | SQL_NAME { $$ = make_str("name"); }
| SQL_NULLABLE { $$ = make_str("nullable"); } | SQL_NULLABLE { $$ = make_str("nullable"); }
| SQL_OCTET_LENGTH { $$ = make_str("octet_length"); } | SQL_OCTET_LENGTH { $$ = make_str("octet_length"); }
| SQL_OFF { $$ = make_str("off"); }
| SQL_OPEN { $$ = make_str("open"); } | SQL_OPEN { $$ = make_str("open"); }
| SQL_PREPARE { $$ = make_str("prepare"); } | SQL_PREPARE { $$ = make_str("prepare"); }
| SQL_RELEASE { $$ = make_str("release"); } | SQL_RELEASE { $$ = make_str("release"); }
...@@ -4940,6 +5004,7 @@ ECPGKeywords: SQL_AT { $$ = make_str("at"); } ...@@ -4940,6 +5004,7 @@ ECPGKeywords: SQL_AT { $$ = make_str("at"); }
| SQL_STOP { $$ = make_str("stop"); } | SQL_STOP { $$ = make_str("stop"); }
| SQL_VAR { $$ = make_str("var"); } | SQL_VAR { $$ = make_str("var"); }
| SQL_WHENEVER { $$ = make_str("whenever"); } | SQL_WHENEVER { $$ = make_str("whenever"); }
/* | ECPGTypeName { $$ = $1 }*/
; ;
ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); } ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); }
...@@ -4958,7 +5023,7 @@ ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); } ...@@ -4958,7 +5023,7 @@ ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); }
ECPGLabelTypeName: CHAR { $$ = make_str("char"); } ECPGLabelTypeName: CHAR { $$ = make_str("char"); }
| FLOAT { $$ = make_str("float"); } | FLOAT { $$ = make_str("float"); }
| VARCHAR { $$ = make_str("varchar"); } | VARCHAR { $$ = make_str("varchar"); }
| ECPGTypeName { $$ = $1; } /* | ECPGTypeName { $$ = $1; }*/
; ;
opt_symbol: symbol { $$ = $1; } opt_symbol: symbol { $$ = $1; }
...@@ -4972,16 +5037,6 @@ symbol: ColLabel { $$ = $1; }; ...@@ -4972,16 +5037,6 @@ symbol: ColLabel { $$ = $1; };
* BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS * BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS
* Thanks to Tom Lane for pointing this out. - thomas 2000-03-29 * Thanks to Tom Lane for pointing this out. - thomas 2000-03-29
*/ */
ECPGColId: /* to be used instead of ColId */
ECPGKeywords { $$ = $1; }
| ident { $$ = $1; }
| TokenId { $$ = $1; }
| datetime { $$ = $1; }
| INTERVAL { $$ = make_str("interval"); }
| TIME { $$ = make_str("time"); }
| TIMESTAMP { $$ = make_str("timestamp"); }
| TYPE_P { $$ = make_str("type"); }
;
/* Parser tokens to be used as identifiers. /* Parser tokens to be used as identifiers.
* Tokens involving data types should appear in ColId only, * Tokens involving data types should appear in ColId only,
...@@ -4999,6 +5054,7 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -4999,6 +5054,7 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| BEGIN_TRANS { $$ = make_str("begin"); } | BEGIN_TRANS { $$ = make_str("begin"); }
| CACHE { $$ = make_str("cache"); } | CACHE { $$ = make_str("cache"); }
| CASCADE { $$ = make_str("cascade"); } | CASCADE { $$ = make_str("cascade"); }
| CHAIN { $$ = make_str("chain"); }
| CLOSE { $$ = make_str("close"); } | CLOSE { $$ = make_str("close"); }
| COMMENT { $$ = make_str("comment"); } | COMMENT { $$ = make_str("comment"); }
| COMMIT { $$ = make_str("commit"); } | COMMIT { $$ = make_str("commit"); }
...@@ -5009,12 +5065,13 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5009,12 +5065,13 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| CYCLE { $$ = make_str("cycle"); } | CYCLE { $$ = make_str("cycle"); }
| DATABASE { $$ = make_str("database"); } | DATABASE { $$ = make_str("database"); }
| DECLARE { $$ = make_str("declare"); } | DECLARE { $$ = make_str("declare"); }
| DEFERRED { $$ = make_str("deferred"); } | DEFERRED { $$ = make_str("deferred"); }
| DELETE { $$ = make_str("delete"); } | DELETE { $$ = make_str("delete"); }
| DELIMITERS { $$ = make_str("delimiters"); } | DELIMITERS { $$ = make_str("delimiters"); }
| DROP { $$ = make_str("drop"); } | DROP { $$ = make_str("drop"); }
| EACH { $$ = make_str("each"); } | EACH { $$ = make_str("each"); }
| ENCODING { $$ = make_str("encoding"); } | ENCODING { $$ = make_str("encoding"); }
| ESCAPE { $$ = make_str("escape"); }
| EXCLUSIVE { $$ = make_str("exclusive"); } | EXCLUSIVE { $$ = make_str("exclusive"); }
| EXECUTE { $$ = make_str("execute"); } | EXECUTE { $$ = make_str("execute"); }
| FETCH { $$ = make_str("fetch"); } | FETCH { $$ = make_str("fetch"); }
...@@ -5023,7 +5080,8 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5023,7 +5080,8 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| FUNCTION { $$ = make_str("function"); } | FUNCTION { $$ = make_str("function"); }
| GRANT { $$ = make_str("grant"); } | GRANT { $$ = make_str("grant"); }
| HANDLER { $$ = make_str("handler"); } | HANDLER { $$ = make_str("handler"); }
| IMMEDIATE { $$ = make_str("immediate"); } | ILIKE { $$ = make_str("ilike"); }
| IMMEDIATE { $$ = make_str("immediate"); }
| INCREMENT { $$ = make_str("increment"); } | INCREMENT { $$ = make_str("increment"); }
| INDEX { $$ = make_str("index"); } | INDEX { $$ = make_str("index"); }
| INHERITS { $$ = make_str("inherits"); } | INHERITS { $$ = make_str("inherits"); }
...@@ -5035,13 +5093,13 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5035,13 +5093,13 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| LANGUAGE { $$ = make_str("language"); } | LANGUAGE { $$ = make_str("language"); }
| LANCOMPILER { $$ = make_str("lancompiler"); } | LANCOMPILER { $$ = make_str("lancompiler"); }
| LEVEL { $$ = make_str("level"); } | LEVEL { $$ = make_str("level"); }
| LIKE { $$ = make_str("like"); }
| LOCATION { $$ = make_str("location"); } | LOCATION { $$ = make_str("location"); }
| MATCH { $$ = make_str("match"); } | MATCH { $$ = make_str("match"); }
| MAXVALUE { $$ = make_str("maxvalue"); } | MAXVALUE { $$ = make_str("maxvalue"); }
| MINVALUE { $$ = make_str("minvalue"); } | MINVALUE { $$ = make_str("minvalue"); }
| MODE { $$ = make_str("mode"); } | MODE { $$ = make_str("mode"); }
| NAMES { $$ = make_str("names"); } | NAMES { $$ = make_str("names"); }
| NATIONAL { $$ = make_str("national"); }
| NEXT { $$ = make_str("next"); } | NEXT { $$ = make_str("next"); }
| NO { $$ = make_str("no"); } | NO { $$ = make_str("no"); }
| NOCREATEDB { $$ = make_str("nocreatedb"); } | NOCREATEDB { $$ = make_str("nocreatedb"); }
...@@ -5050,7 +5108,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5050,7 +5108,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| NOTIFY { $$ = make_str("notify"); } | NOTIFY { $$ = make_str("notify"); }
| OF { $$ = make_str("of"); } | OF { $$ = make_str("of"); }
| OIDS { $$ = make_str("oids"); } | OIDS { $$ = make_str("oids"); }
| ONLY { $$ = make_str("only"); }
| OPERATOR { $$ = make_str("operator"); } | OPERATOR { $$ = make_str("operator"); }
| OPTION { $$ = make_str("option"); } | OPTION { $$ = make_str("option"); }
| PARTIAL { $$ = make_str("partial"); } | PARTIAL { $$ = make_str("partial"); }
...@@ -5069,9 +5126,10 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5069,9 +5126,10 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| ROLLBACK { $$ = make_str("rollback"); } | ROLLBACK { $$ = make_str("rollback"); }
| ROW { $$ = make_str("row"); } | ROW { $$ = make_str("row"); }
| RULE { $$ = make_str("rule"); } | RULE { $$ = make_str("rule"); }
| SCHEMA { $$ = make_str("schema"); }
| SCROLL { $$ = make_str("scroll"); } | SCROLL { $$ = make_str("scroll"); }
| SESSION { $$ = make_str("session"); }
| SEQUENCE { $$ = make_str("sequence"); } | SEQUENCE { $$ = make_str("sequence"); }
| SERIAL { $$ = make_str("serial"); }
| SERIALIZABLE { $$ = make_str("serializable"); } | SERIALIZABLE { $$ = make_str("serializable"); }
| SET { $$ = make_str("set"); } | SET { $$ = make_str("set"); }
| SHARE { $$ = make_str("share"); } | SHARE { $$ = make_str("share"); }
...@@ -5083,7 +5141,8 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5083,7 +5141,8 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| TEMP { $$ = make_str("temp"); } | TEMP { $$ = make_str("temp"); }
| TEMPORARY { $$ = make_str("temporary"); } | TEMPORARY { $$ = make_str("temporary"); }
| TIMEZONE_HOUR { $$ = make_str("timezone_hour"); } | TIMEZONE_HOUR { $$ = make_str("timezone_hour"); }
| TIMEZONE_MINUTE { $$ = make_str("timezone_minute"); } | TIMEZONE_MINUTE { $$ = make_str("timezone_minute"); }
| TOAST { $$ = make_str("toast"); }
| TRIGGER { $$ = make_str("trigger"); } | TRIGGER { $$ = make_str("trigger"); }
| TRUNCATE { $$ = make_str("truncate"); } | TRUNCATE { $$ = make_str("truncate"); }
| TRUSTED { $$ = make_str("trusted"); } | TRUSTED { $$ = make_str("trusted"); }
...@@ -5097,114 +5156,131 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5097,114 +5156,131 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| VERSION { $$ = make_str("version"); } | VERSION { $$ = make_str("version"); }
| VIEW { $$ = make_str("view"); } | VIEW { $$ = make_str("view"); }
| WITH { $$ = make_str("with"); } | WITH { $$ = make_str("with"); }
| WITHOUT { $$ = make_str("without"); }
| WORK { $$ = make_str("work"); } | WORK { $$ = make_str("work"); }
| ZONE { $$ = make_str("zone"); } | ZONE { $$ = make_str("zone"); }
; ;
ECPGColLabel: ECPGColId { $$ = $1; } ECPGColId: ident { $$ = $1; }
| TYPE_P { $$ = make_str("type"); }
| datetime { $$ = $1; }
| TokenId { $$ = $1; }
| INTERVAL { $$ = make_str("interval"); }
| NATIONAL { $$ = make_str("national"); }
| PATH_P { $$ = make_str("path_p"); }
| SERIAL { $$ = make_str("serial"); }
| TIME { $$ = make_str("time"); }
| TIMESTAMP { $$ = make_str("timestamp"); }
| ECPGKeywords { $$ = $1; }
;
ECPGColLabel: ECPGColId { $$ = $1; }
| ABORT_TRANS { $$ = make_str("abort"); } | ABORT_TRANS { $$ = make_str("abort"); }
| ALL { $$ = make_str("all"); } | ALL { $$ = make_str("all"); }
| ANALYZE { $$ = make_str("analyze"); } | ANALYZE { $$ = make_str("analyze"); }
| ANY { $$ = make_str("any"); } | ANY { $$ = make_str("any"); }
| ASC { $$ = make_str("asc"); } | ASC { $$ = make_str("asc"); }
| BETWEEN { $$ = make_str("between"); } | BETWEEN { $$ = make_str("between"); }
| BINARY { $$ = make_str("binary"); } | BINARY { $$ = make_str("binary"); }
| BIT { $$ = make_str("bit"); } | BIT { $$ = make_str("bit"); }
| BOTH { $$ = make_str("both"); } | BOTH { $$ = make_str("both"); }
| CASE { $$ = make_str("case"); } | CASE { $$ = make_str("case"); }
| CAST { $$ = make_str("cast"); } | CAST { $$ = make_str("cast"); }
| CHARACTER { $$ = make_str("character"); } | CHARACTER { $$ = make_str("character"); }
| CHECK { $$ = make_str("check"); } | CHECK { $$ = make_str("check"); }
| CLUSTER { $$ = make_str("cluster"); } | CLUSTER { $$ = make_str("cluster"); }
| COALESCE { $$ = make_str("coalesce"); } | COALESCE { $$ = make_str("coalesce"); }
| COLLATE { $$ = make_str("collate"); } | COLLATE { $$ = make_str("collate"); }
| COLUMN { $$ = make_str("column"); } | COLUMN { $$ = make_str("column"); }
| CONSTRAINT { $$ = make_str("constraint"); } | CONSTRAINT { $$ = make_str("constraint"); }
| COPY { $$ = make_str("copy"); } | COPY { $$ = make_str("copy"); }
| CROSS { $$ = make_str("cross"); } | CROSS { $$ = make_str("cross"); }
| CURRENT_DATE { $$ = make_str("current_date"); } | CURRENT_DATE { $$ = make_str("current_date"); }
| CURRENT_TIME { $$ = make_str("current_time"); } | CURRENT_TIME { $$ = make_str("current_time"); }
| CURRENT_TIMESTAMP { $$ = make_str("current_timestamp"); } | CURRENT_TIMESTAMP { $$ = make_str("current_timestamp"); }
| CURRENT_USER { $$ = make_str("current_user"); } | CURRENT_USER { $$ = make_str("current_user"); }
| DEC { $$ = make_str("dec"); } | DEC { $$ = make_str("dec"); }
| DECIMAL { $$ = make_str("decimal"); } | DECIMAL { $$ = make_str("decimal"); }
| DEFAULT { $$ = make_str("default"); } | DEFAULT { $$ = make_str("default"); }
| DEFERRABLE { $$ = make_str("deferrable"); } | DEFERRABLE { $$ = make_str("deferrable"); }
| DESC { $$ = make_str("desc"); } | DESC { $$ = make_str("desc"); }
| DISTINCT { $$ = make_str("distinct"); } | DISTINCT { $$ = make_str("distinct"); }
| DO { $$ = make_str("do"); } | DO { $$ = make_str("do"); }
| ELSE { $$ = make_str("else"); } | ELSE { $$ = make_str("else"); }
| END_TRANS { $$ = make_str("end"); } | END_TRANS { $$ = make_str("end"); }
| EXCEPT { $$ = make_str("except"); } | EXCEPT { $$ = make_str("except"); }
| EXISTS { $$ = make_str("exists"); } | EXISTS { $$ = make_str("exists"); }
| EXPLAIN { $$ = make_str("explain"); } | EXPLAIN { $$ = make_str("explain"); }
| EXTEND { $$ = make_str("extend"); } | EXTEND { $$ = make_str("extend"); }
| EXTRACT { $$ = make_str("extract"); } | EXTRACT { $$ = make_str("extract"); }
| FALSE_P { $$ = make_str("false"); } | FALSE_P { $$ = make_str("false"); }
| FOR { $$ = make_str("for"); } | FOR { $$ = make_str("for"); }
| FOREIGN { $$ = make_str("foreign"); } | FOREIGN { $$ = make_str("foreign"); }
| FROM { $$ = make_str("from"); } | FROM { $$ = make_str("from"); }
| FULL { $$ = make_str("full"); } | FULL { $$ = make_str("full"); }
| IN { $$ = make_str("in"); } | IN { $$ = make_str("in"); }
| IS { $$ = make_str("is"); } | IS { $$ = make_str("is"); }
| ISNULL { $$ = make_str("isnull"); } | ISNULL { $$ = make_str("isnull"); }
| GLOBAL { $$ = make_str("global"); } | GLOBAL { $$ = make_str("global"); }
| GROUP { $$ = make_str("group"); } | GROUP { $$ = make_str("group"); }
| HAVING { $$ = make_str("having"); } | HAVING { $$ = make_str("having"); }
| INITIALLY { $$ = make_str("initially"); } | INITIALLY { $$ = make_str("initially"); }
| INNER_P { $$ = make_str("inner"); } | INNER_P { $$ = make_str("inner"); }
| INTERSECT { $$ = make_str("intersect"); } | INTERSECT { $$ = make_str("intersect"); }
| INTO { $$ = make_str("into"); } | INTO { $$ = make_str("into"); }
| JOIN { $$ = make_str("join"); } | INOUT { $$ = make_str("inout"); }
| LEADING { $$ = make_str("leading"); } | JOIN { $$ = make_str("join"); }
| LEFT { $$ = make_str("left"); } | LEADING { $$ = make_str("leading"); }
| LIKE { $$ = make_str("like"); } | LEFT { $$ = make_str("left"); }
| LISTEN { $$ = make_str("listen"); } | LISTEN { $$ = make_str("listen"); }
| LOAD { $$ = make_str("load"); } | LOAD { $$ = make_str("load"); }
| LOCK_P { $$ = make_str("lock"); } | LOCK_P { $$ = make_str("lock"); }
| MOVE { $$ = make_str("move"); } | MOVE { $$ = make_str("move"); }
| NATURAL { $$ = make_str("natural"); } | NATURAL { $$ = make_str("natural"); }
| NCHAR { $$ = make_str("nchar"); } | NCHAR { $$ = make_str("nchar"); }
| NEW { $$ = make_str("new"); } | NEW { $$ = make_str("new"); }
| NONE { $$ = make_str("none"); } | NONE { $$ = make_str("none"); }
| NOT { $$ = make_str("not"); } | NOT { $$ = make_str("not"); }
| NOTNULL { $$ = make_str("notnull"); } | NOTNULL { $$ = make_str("notnull"); }
| NULLIF { $$ = make_str("nullif"); } | NULLIF { $$ = make_str("nullif"); }
| NULL_P { $$ = make_str("null"); } | NULL_P { $$ = make_str("null"); }
| NUMERIC { $$ = make_str("numeric"); } | NUMERIC { $$ = make_str("numeric"); }
| OFFSET { $$ = make_str("offset"); } | OFF { $$ = make_str("off"); }
| OLD { $$ = make_str("old"); } | OFFSET { $$ = make_str("offset"); }
| ON { $$ = make_str("on"); } | OLD { $$ = make_str("old"); }
| OR { $$ = make_str("or"); } | ON { $$ = make_str("on"); }
| ORDER { $$ = make_str("order"); } | ONLY { $$ = make_str("only"); }
| OUTER_P { $$ = make_str("outer"); } | OR { $$ = make_str("or"); }
| OVERLAPS { $$ = make_str("overlaps"); } | ORDER { $$ = make_str("order"); }
| POSITION { $$ = make_str("position"); } | OUT { $$ = make_str("out"); }
| PRECISION { $$ = make_str("precision"); } | OUTER_P { $$ = make_str("outer"); }
| PRIMARY { $$ = make_str("primary"); } | OVERLAPS { $$ = make_str("overlaps"); }
| PROCEDURE { $$ = make_str("procedure"); } | POSITION { $$ = make_str("position"); }
| PUBLIC { $$ = make_str("public"); } | PRECISION { $$ = make_str("precision"); }
| PRIMARY { $$ = make_str("primary"); }
| PROCEDURE { $$ = make_str("procedure"); }
| PUBLIC { $$ = make_str("public"); }
| REFERENCES { $$ = make_str("references"); } | REFERENCES { $$ = make_str("references"); }
| RESET { $$ = make_str("reset"); } | RESET { $$ = make_str("reset"); }
| RIGHT { $$ = make_str("right"); } | RIGHT { $$ = make_str("right"); }
| SELECT { $$ = make_str("select"); } | SELECT { $$ = make_str("select"); }
| SESSION_USER { $$ = make_str("session_user"); } | SESSION_USER { $$ = make_str("session_user"); }
| SETOF { $$ = make_str("setof"); } | SETOF { $$ = make_str("setof"); }
| SHOW { $$ = make_str("show"); } | SHOW { $$ = make_str("show"); }
| SUBSTRING { $$ = make_str("substring"); } | SUBSTRING { $$ = make_str("substring"); }
| TABLE { $$ = make_str("table"); } | TABLE { $$ = make_str("table"); }
| THEN { $$ = make_str("then"); } | THEN { $$ = make_str("then"); }
| TO { $$ = make_str("to"); } | TO { $$ = make_str("to"); }
| TRANSACTION { $$ = make_str("transaction"); } | TRANSACTION { $$ = make_str("transaction"); }
| TRIM { $$ = make_str("trim"); } | TRIM { $$ = make_str("trim"); }
| TRUE_P { $$ = make_str("true"); } | TRUE_P { $$ = make_str("true"); }
| UNIQUE { $$ = make_str("unique"); } | UNIQUE { $$ = make_str("unique"); }
| USER { $$ = make_str("user"); } | USER { $$ = make_str("user"); }
| USING { $$ = make_str("using"); } | USING { $$ = make_str("using"); }
| VACUUM { $$ = make_str("vacuum"); } | VACUUM { $$ = make_str("vacuum"); }
| VERBOSE { $$ = make_str("verbose"); } | VERBOSE { $$ = make_str("verbose"); }
| WHEN { $$ = make_str("when"); } | WHEN { $$ = make_str("when"); }
| WHERE { $$ = make_str("where"); } | WHERE { $$ = make_str("where"); }
; ;
into_list : coutputvariable | into_list ',' coutputvariable; into_list : coutputvariable | into_list ',' coutputvariable;
......
...@@ -146,7 +146,13 @@ get_type(enum ECPGttype typ) ...@@ -146,7 +146,13 @@ get_type(enum ECPGttype typ)
return ("ECPGt_long"); return ("ECPGt_long");
break; break;
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
return ("ECPGt_unsigned_int"); return ("ECPGt_unsigned_long");
break;
case ECPGt_long_long:
return ("ECPGt_long_long");
break;
case ECPGt_unsigned_long_long:
return ("ECPGt_unsigned_long_long");
break; break;
case ECPGt_float: case ECPGt_float:
return ("ECPGt_float"); return ("ECPGt_float");
......
...@@ -260,9 +260,11 @@ check_indicator(struct ECPGtype * var) ...@@ -260,9 +260,11 @@ check_indicator(struct ECPGtype * var)
case ECPGt_short: case ECPGt_short:
case ECPGt_int: case ECPGt_int:
case ECPGt_long: case ECPGt_long:
case ECPGt_long_long:
case ECPGt_unsigned_short: case ECPGt_unsigned_short:
case ECPGt_unsigned_int: case ECPGt_unsigned_int:
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
case ECPGt_unsigned_long_long:
break; break;
case ECPGt_struct: case ECPGt_struct:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment