Commit a4f59da1 authored by Michael Meskes's avatar Michael Meskes

*** empty log message ***

parent 7395d9ab
Tue Aug 24 15:53:28 MEST 1999
- made NULL a valid bool value
- check for indicator variables on NULL
Wed Feb 11 10:58:13 CET 1998 Wed Feb 11 10:58:13 CET 1998
- Added '-d' option to turn on debugging. - Added '-d' option to turn on debugging.
...@@ -653,3 +648,29 @@ Mon Sep 27 07:40:20 CEST 1999 ...@@ -653,3 +648,29 @@ Mon Sep 27 07:40:20 CEST 1999
- Synced preproc.y with gram.y. - Synced preproc.y with gram.y.
- Synced keyword.c. - Synced keyword.c.
- Set ecpg version to 2.6.5 - Set ecpg version to 2.6.5
Tue Sep 28 17:58:37 CEST 1999
- Synced preproc.y with gram.y.
- Synced pgc.l with scan.l.
Fri Oct 1 18:34:30 CEST 1999
- Synced preproc.y with gram.y.
- Synced keyword.c.
- Include patch by Christof Petig <christof.petig@wtal.de>:
- made NULL a valid bool value
- check for indicator variables on NULL
Wed Oct 6 18:28:40 CEST 1999
- Synced preproc.y with gram.y.
Thu Oct 7 15:12:58 CEST 1999
- Fixed bug that caused mixed case relation names to be converted to
upper case.
- Synced preproc.y with gram.y.
- Set ecpg version to 2.6.6
- Set library version to 3.0.4
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.47 1999/09/17 18:28:10 meskes Exp $ # $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.48 1999/10/08 11:04:59 meskes Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
NAME= ecpg NAME= ecpg
SO_MAJOR_VERSION= 3 SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 0.3 SO_MINOR_VERSION= 0.4
SRCDIR= @top_srcdir@ SRCDIR= @top_srcdir@
include $(SRCDIR)/Makefile.global include $(SRCDIR)/Makefile.global
......
...@@ -802,7 +802,6 @@ ECPGexecute(struct statement * stmt) ...@@ -802,7 +802,6 @@ ECPGexecute(struct statement * stmt)
else else
res = 0L; res = 0L;
/* Again?! Yes */
switch (var->type) switch (var->type)
{ {
case ECPGt_short: case ECPGt_short:
...@@ -837,7 +836,6 @@ ECPGexecute(struct statement * stmt) ...@@ -837,7 +836,6 @@ ECPGexecute(struct statement * stmt)
else else
ures = 0L; ures = 0L;
/* Again?! Yes */
switch (var->type) switch (var->type)
{ {
case ECPGt_unsigned_short: case ECPGt_unsigned_short:
...@@ -872,7 +870,6 @@ ECPGexecute(struct statement * stmt) ...@@ -872,7 +870,6 @@ ECPGexecute(struct statement * stmt)
else else
dres = 0.0; dres = 0.0;
/* Again?! Yes */
switch (var->type) switch (var->type)
{ {
case ECPGt_float: case ECPGt_float:
......
...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global ...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2 MAJOR_VERSION=2
MINOR_VERSION=6 MINOR_VERSION=6
PATCHLEVEL=5 PATCHLEVEL=6
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
......
...@@ -35,7 +35,6 @@ static ScanKeyword ScanKeywords[] = { ...@@ -35,7 +35,6 @@ static ScanKeyword ScanKeywords[] = {
{"go", SQL_GO}, {"go", SQL_GO},
{"goto", SQL_GOTO}, {"goto", SQL_GOTO},
{"identified", SQL_IDENTIFIED}, {"identified", SQL_IDENTIFIED},
{"immediate", SQL_IMMEDIATE},
{"indicator", SQL_INDICATOR}, {"indicator", SQL_INDICATOR},
{"int", SQL_INT}, {"int", SQL_INT},
{"long", SQL_LONG}, {"long", SQL_LONG},
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.17 1999/09/27 10:41:02 meskes Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.18 1999/10/08 11:05:02 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -64,6 +64,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -64,6 +64,7 @@ static ScanKeyword ScanKeywords[] = {
{"commit", COMMIT}, {"commit", COMMIT},
{"committed", COMMITTED}, {"committed", COMMITTED},
{"constraint", CONSTRAINT}, {"constraint", CONSTRAINT},
{"constraints", CONSTRAINTS},
{"copy", COPY}, {"copy", COPY},
{"create", CREATE}, {"create", CREATE},
{"createdb", CREATEDB}, {"createdb", CREATEDB},
...@@ -80,6 +81,8 @@ static ScanKeyword ScanKeywords[] = { ...@@ -80,6 +81,8 @@ static ScanKeyword ScanKeywords[] = {
{"decimal", DECIMAL}, {"decimal", DECIMAL},
{"declare", DECLARE}, {"declare", DECLARE},
{"default", DEFAULT}, {"default", DEFAULT},
{"deferrable", DEFERRABLE},
{"deferred", DEFERRED},
{"delete", DELETE}, {"delete", DELETE},
{"delimiters", DELIMITERS}, {"delimiters", DELIMITERS},
{"desc", DESC}, {"desc", DESC},
...@@ -113,10 +116,12 @@ static ScanKeyword ScanKeywords[] = { ...@@ -113,10 +116,12 @@ static ScanKeyword ScanKeywords[] = {
{"handler", HANDLER}, {"handler", HANDLER},
{"having", HAVING}, {"having", HAVING},
{"hour", HOUR_P}, {"hour", HOUR_P},
{"immediate", IMMEDIATE},
{"in", IN}, {"in", IN},
{"increment", INCREMENT}, {"increment", INCREMENT},
{"index", INDEX}, {"index", INDEX},
{"inherits", INHERITS}, {"inherits", INHERITS},
{"initially", INITIALLY},
{"inner", INNER_P}, {"inner", INNER_P},
{"insensitive", INSENSITIVE}, {"insensitive", INSENSITIVE},
{"insert", INSERT}, {"insert", INSERT},
...@@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = {
{"outer", OUTER_P}, {"outer", OUTER_P},
{"partial", PARTIAL}, {"partial", PARTIAL},
{"password", PASSWORD}, {"password", PASSWORD},
{"pendant", PENDANT},
{"position", POSITION}, {"position", POSITION},
{"precision", PRECISION}, {"precision", PRECISION},
{"primary", PRIMARY}, {"primary", PRIMARY},
...@@ -191,6 +197,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -191,6 +197,7 @@ static ScanKeyword ScanKeywords[] = {
{"relative", RELATIVE}, {"relative", RELATIVE},
{"rename", RENAME}, {"rename", RENAME},
{"reset", RESET}, {"reset", RESET},
{"restrict", RESTRICT},
{"returns", RETURNS}, {"returns", RETURNS},
{"revoke", REVOKE}, {"revoke", REVOKE},
{"right", RIGHT}, {"right", RIGHT},
......
...@@ -60,7 +60,6 @@ static char *old; ...@@ -60,7 +60,6 @@ static char *old;
* <xc> extended C-style comments - tgl 1997-07-12 * <xc> extended C-style comments - tgl 1997-07-12
* <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27 * <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27
* <xh> hexadecimal numeric string - thomas 1997-11-16 * <xh> hexadecimal numeric string - thomas 1997-11-16
* <xm> numeric strings with embedded minus sign - tgl 1997-09-05
* <xq> quoted strings - tgl 1997-07-30 * <xq> quoted strings - tgl 1997-07-30
* *
* The "extended comment" syntax closely resembles allowable operator syntax. * The "extended comment" syntax closely resembles allowable operator syntax.
...@@ -75,7 +74,6 @@ static char *old; ...@@ -75,7 +74,6 @@ static char *old;
%x xd %x xd
%x xdc %x xdc
%x xh %x xh
%x xm
%x xq %x xq
/* Binary number /* Binary number
...@@ -128,7 +126,6 @@ xcinside [^*]* ...@@ -128,7 +126,6 @@ xcinside [^*]*
xcstar [^/] xcstar [^/]
digit [0-9] digit [0-9]
number [-+.0-9Ee]
letter [\200-\377_A-Za-z] letter [\200-\377_A-Za-z]
letter_or_digit [\200-\377_A-Za-z0-9] letter_or_digit [\200-\377_A-Za-z0-9]
...@@ -140,13 +137,15 @@ self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|] ...@@ -140,13 +137,15 @@ self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
op_and_self [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=] op_and_self [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
operator {op_and_self}+ operator {op_and_self}+
xmstop - /* we do not allow unary minus in numbers.
* instead we pass it verbatim to parser. there it gets
integer [\-]?{digit}+ * coerced via doNegate() -- Leon aug 20 1999
decimal [\-]?(({digit}*\.{digit}+)|({digit}+\.{digit}*)) */
real [\-]?((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+)) integer {digit}+
decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))
real ((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+))
/* /*
real [\-]?(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+)) real (((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
*/ */
param \${integer} param \${integer}
...@@ -291,18 +290,7 @@ cppline {space}*#.*(\\{space}*\n)*\n* ...@@ -291,18 +290,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
memcpy(literal+llen, yytext, yyleng+1); memcpy(literal+llen, yytext, yyleng+1);
llen += yyleng; llen += yyleng;
} }
<xm>{space}* { /* ignore */ }
<xm>{xmstop} {
BEGIN(SQL);
return yytext[0];
}
<SQL>{typecast} { return TYPECAST; } <SQL>{typecast} { return TYPECAST; }
<SQL>{self}/{space}*-[\.0-9] {
BEGIN(xm);
return yytext[0];
}
<SQL>{self} { /* <SQL>{self} { /*
* We may find a ';' inside a structure * We may find a ';' inside a structure
* definition in a TYPE or VAR statement. * definition in a TYPE or VAR statement.
...@@ -312,10 +300,6 @@ cppline {space}*#.*(\\{space}*\n)*\n* ...@@ -312,10 +300,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
BEGIN C; BEGIN C;
return yytext[0]; return yytext[0];
} }
<SQL>{operator}/-[\.0-9] {
yylval.str = mm_strdup((char*)yytext);
return Op;
}
<SQL>{operator} { <SQL>{operator} {
if (strcmp((char*)yytext,"!=") == 0) if (strcmp((char*)yytext,"!=") == 0)
yylval.str = mm_strdup("<>"); /* compatability */ yylval.str = mm_strdup("<>"); /* compatability */
...@@ -327,106 +311,6 @@ cppline {space}*#.*(\\{space}*\n)*\n* ...@@ -327,106 +311,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
yylval.ival = atoi((char*)&yytext[1]); yylval.ival = atoi((char*)&yytext[1]);
return PARAM; return PARAM;
} }
<SQL>{identifier}/{space}*-{number} {
int i;
ScanKeyword *keyword;
char lower_text[NAMEDATALEN];
BEGIN(xm);
/* this should leave the last byte set to '\0' */
strncpy(lower_text, yytext, NAMEDATALEN-1);
for(i = 0; lower_text[i]; i++)
if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
lower_text[i] = tolower(lower_text[i]);
keyword = ScanKeywordLookup((char*)lower_text);
if (keyword != NULL) {
return keyword->value;
}
else
{
keyword = ScanECPGKeywordLookup((char*)lower_text);
if (keyword != NULL) {
return keyword->value;
}
else
{
struct _defines *ptr;
for (ptr = defines; ptr; ptr = ptr->next)
{
if (strcmp(yytext, ptr->old) == 0)
{
struct _yy_buffer *yb;
yb = mm_alloc(sizeof(struct _yy_buffer));
yb->buffer = YY_CURRENT_BUFFER;
yb->lineno = yylineno;
yb->filename = mm_strdup(input_filename);
yb->next = yy_buffer;
yy_buffer = yb;
yy_scan_string(ptr->new);
break;
}
}
if (ptr == NULL)
{
yylval.str = mm_strdup((char*)yytext);
return IDENT;
}
}
}
}
<C,SQL>{integer}/{space}*-{number} {
char* endptr;
BEGIN(xm);
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
if (*endptr != '\0' || errno == ERANGE)
{
errno = 0;
#if 0
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
return FCONST;
#endif
yylval.str = mm_strdup((char*)yytext);
return SCONST;
}
return ICONST;
}
{decimal}/{space}*-{number} {
char* endptr;
BEGIN(xm);
if (strlen((char *)yytext) <= 17)
{
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad float8 input");
return FCONST;
}
yylval.str = mm_strdup((char*)yytext);
return SCONST;
}
<C,SQL>{real}/{space}*-{number} {
char* endptr;
BEGIN(xm);
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad float8 input");
return FCONST;
}
<C,SQL>{integer} { <C,SQL>{integer} {
char* endptr; char* endptr;
......
This diff is collapsed.
...@@ -35,8 +35,8 @@ exec sql end declare section; ...@@ -35,8 +35,8 @@ exec sql end declare section;
exec sql connect to pm; exec sql connect to pm;
strcpy(msg, "create"); strcpy(msg, "create");
exec sql at main create table test(name char(8), amount int, letter char(1)); exec sql at main create table "Test" (name char(8), amount int, letter char(1));
exec sql create table test(name char(8), amount int, letter char(1)); exec sql create table "Test" (name char(8), amount int, letter char(1));
strcpy(msg, "commit"); strcpy(msg, "commit");
exec sql at main commit; exec sql at main commit;
...@@ -46,25 +46,25 @@ exec sql end declare section; ...@@ -46,25 +46,25 @@ exec sql end declare section;
exec sql set connection to main; exec sql set connection to main;
strcpy(msg, "execute insert 1"); strcpy(msg, "execute insert 1");
sprintf(command, "insert into test(name, amount, letter) values ('db: ''mm''', 1, 'f')"); sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''mm''', 1, 'f')");
exec sql execute immediate :command; exec sql execute immediate :command;
printf("New tuple got OID = %d\n", sqlca.sqlerrd[1]); printf("New tuple got OID = %d\n", sqlca.sqlerrd[1]);
sprintf(command, "insert into test(name, amount, letter) values ('db: \\\'mm\\\'', 2, 't')"); sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: \\\'mm\\\'', 2, 't')");
exec sql execute immediate :command; exec sql execute immediate :command;
strcpy(msg, "execute insert 2"); strcpy(msg, "execute insert 2");
sprintf(command, "insert into test(name, amount, letter) values ('db: ''pm''', 1, 'f')"); sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''pm''', 1, 'f')");
exec sql at pm execute immediate :command; exec sql at pm execute immediate :command;
strcpy(msg, "execute insert 3"); strcpy(msg, "execute insert 3");
sprintf(command, "insert into test(name, amount, letter) select name, amount+10, letter from test"); sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+10, letter from \"Test\"");
exec sql execute immediate :command; exec sql execute immediate :command;
printf("Inserted %d tuples via execute immediate\n", sqlca.sqlerrd[2]); printf("Inserted %d tuples via execute immediate\n", sqlca.sqlerrd[2]);
strcpy(msg, "execute insert 4"); strcpy(msg, "execute insert 4");
sprintf(command, "insert into test(name, amount, letter) select name, amount+?, letter from test"); sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+?, letter from \"Test\"");
exec sql prepare I from :command; exec sql prepare I from :command;
exec sql at pm execute I using :increment; exec sql at pm execute I using :increment;
...@@ -77,19 +77,19 @@ exec sql end declare section; ...@@ -77,19 +77,19 @@ exec sql end declare section;
exec sql at pm set autocommit to off; exec sql at pm set autocommit to off;
strcpy(msg, "select"); strcpy(msg, "select");
exec sql select name, amount, letter into :name, :amount, :letter from test; exec sql select name, amount, letter into :name, :amount, :letter from "Test";
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++) for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]); printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
exec sql at pm select name, amount, letter into :name, :amount, :letter from test; exec sql at pm select name, amount, letter into :name, :amount, :letter from "Test";
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++) for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]); printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
strcpy(msg, "drop"); strcpy(msg, "drop");
exec sql drop table test; exec sql drop table "Test";
exec sql at pm drop table test; exec sql at pm drop table "Test";
strcpy(msg, "commit"); strcpy(msg, "commit");
exec sql commit; exec sql commit;
......
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