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
- Added '-d' option to turn on debugging.
......@@ -653,3 +648,29 @@ Mon Sep 27 07:40:20 CEST 1999
- Synced preproc.y with gram.y.
- Synced keyword.c.
- 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 @@
# Copyright (c) 1994, Regents of the University of California
#
# 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
SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 0.3
SO_MINOR_VERSION= 0.4
SRCDIR= @top_srcdir@
include $(SRCDIR)/Makefile.global
......
......@@ -802,7 +802,6 @@ ECPGexecute(struct statement * stmt)
else
res = 0L;
/* Again?! Yes */
switch (var->type)
{
case ECPGt_short:
......@@ -837,7 +836,6 @@ ECPGexecute(struct statement * stmt)
else
ures = 0L;
/* Again?! Yes */
switch (var->type)
{
case ECPGt_unsigned_short:
......@@ -872,7 +870,6 @@ ECPGexecute(struct statement * stmt)
else
dres = 0.0;
/* Again?! Yes */
switch (var->type)
{
case ECPGt_float:
......
......@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2
MINOR_VERSION=6
PATCHLEVEL=5
PATCHLEVEL=6
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
......
......@@ -35,7 +35,6 @@ static ScanKeyword ScanKeywords[] = {
{"go", SQL_GO},
{"goto", SQL_GOTO},
{"identified", SQL_IDENTIFIED},
{"immediate", SQL_IMMEDIATE},
{"indicator", SQL_INDICATOR},
{"int", SQL_INT},
{"long", SQL_LONG},
......
......@@ -7,7 +7,7 @@
*
*
* 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[] = {
{"commit", COMMIT},
{"committed", COMMITTED},
{"constraint", CONSTRAINT},
{"constraints", CONSTRAINTS},
{"copy", COPY},
{"create", CREATE},
{"createdb", CREATEDB},
......@@ -80,6 +81,8 @@ static ScanKeyword ScanKeywords[] = {
{"decimal", DECIMAL},
{"declare", DECLARE},
{"default", DEFAULT},
{"deferrable", DEFERRABLE},
{"deferred", DEFERRED},
{"delete", DELETE},
{"delimiters", DELIMITERS},
{"desc", DESC},
......@@ -113,10 +116,12 @@ static ScanKeyword ScanKeywords[] = {
{"handler", HANDLER},
{"having", HAVING},
{"hour", HOUR_P},
{"immediate", IMMEDIATE},
{"in", IN},
{"increment", INCREMENT},
{"index", INDEX},
{"inherits", INHERITS},
{"initially", INITIALLY},
{"inner", INNER_P},
{"insensitive", INSENSITIVE},
{"insert", INSERT},
......@@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = {
{"outer", OUTER_P},
{"partial", PARTIAL},
{"password", PASSWORD},
{"pendant", PENDANT},
{"position", POSITION},
{"precision", PRECISION},
{"primary", PRIMARY},
......@@ -191,6 +197,7 @@ static ScanKeyword ScanKeywords[] = {
{"relative", RELATIVE},
{"rename", RENAME},
{"reset", RESET},
{"restrict", RESTRICT},
{"returns", RETURNS},
{"revoke", REVOKE},
{"right", RIGHT},
......
......@@ -60,7 +60,6 @@ static char *old;
* <xc> extended C-style comments - tgl 1997-07-12
* <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27
* <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
*
* The "extended comment" syntax closely resembles allowable operator syntax.
......@@ -75,7 +74,6 @@ static char *old;
%x xd
%x xdc
%x xh
%x xm
%x xq
/* Binary number
......@@ -128,7 +126,6 @@ xcinside [^*]*
xcstar [^/]
digit [0-9]
number [-+.0-9Ee]
letter [\200-\377_A-Za-z]
letter_or_digit [\200-\377_A-Za-z0-9]
......@@ -140,13 +137,15 @@ self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
op_and_self [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
operator {op_and_self}+
xmstop -
integer [\-]?{digit}+
decimal [\-]?(({digit}*\.{digit}+)|({digit}+\.{digit}*))
real [\-]?((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+))
/* we do not allow unary minus in numbers.
* instead we pass it verbatim to parser. there it gets
* coerced via doNegate() -- Leon aug 20 1999
*/
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}
......@@ -291,18 +290,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
memcpy(literal+llen, yytext, yyleng+1);
llen += yyleng;
}
<xm>{space}* { /* ignore */ }
<xm>{xmstop} {
BEGIN(SQL);
return yytext[0];
}
<SQL>{typecast} { return TYPECAST; }
<SQL>{self}/{space}*-[\.0-9] {
BEGIN(xm);
return yytext[0];
}
<SQL>{self} { /*
* We may find a ';' inside a structure
* definition in a TYPE or VAR statement.
......@@ -312,10 +300,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
BEGIN C;
return yytext[0];
}
<SQL>{operator}/-[\.0-9] {
yylval.str = mm_strdup((char*)yytext);
return Op;
}
<SQL>{operator} {
if (strcmp((char*)yytext,"!=") == 0)
yylval.str = mm_strdup("<>"); /* compatability */
......@@ -327,106 +311,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
yylval.ival = atoi((char*)&yytext[1]);
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} {
char* endptr;
......
This diff is collapsed.
......@@ -35,8 +35,8 @@ exec sql end declare section;
exec sql connect to pm;
strcpy(msg, "create");
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 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));
strcpy(msg, "commit");
exec sql at main commit;
......@@ -46,25 +46,25 @@ exec sql end declare section;
exec sql set connection to main;
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;
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;
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;
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;
printf("Inserted %d tuples via execute immediate\n", sqlca.sqlerrd[2]);
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 at pm execute I using :increment;
......@@ -77,19 +77,19 @@ exec sql end declare section;
exec sql at pm set autocommit to off;
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++)
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++)
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");
exec sql drop table test;
exec sql at pm drop table test;
exec sql drop table "Test";
exec sql at pm drop table "Test";
strcpy(msg, "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