Commit 3a335375 authored by Michael Meskes's avatar Michael Meskes

- Synced parser and keyword file.

- More work on Informix compatibility.
parent aa874ee0
......@@ -1332,5 +1332,12 @@ Thu Feb 13 14:06:28 CET 2003
- Started working on an Informix compatibility mode. With option "-C
INFORMIX" set, ecpg now accepts "$" as alias for "exec sql" and to
denote variables inside SQL statements.
Fri Feb 14 14:14:25 CET 2003
- Synced parser and keyword file.
- More work on Informix compatibility.
- Set ecpg version to 2.12.0.
- Set library to 3.4.2.
/*
* This file contains stuff needed to be as compatible to Informix as possible.
*/
#define SQLNOTFOUND 100
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.18 2003/02/13 18:13:22 tgl Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.19 2003/02/14 13:17:13 meskes Exp $ */
#include "postgres_fe.h"
......@@ -14,7 +14,6 @@
* the last back-end operation. */
static char *ECPGerr;
void
ECPGraise(int line, int code, const char *str)
{
......
......@@ -6,6 +6,9 @@
/* Here are some methods used by the lib. */
/* Stores the backend error message for client access */
void set_backend_err(const char *err, int lineon);
/* Store and retrieve the backend error message for client access */
void set_backend_err(const char *err, int lineon);
char *ECPGerrmsg(void);
......
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.89 2002/12/04 18:14:11 momjian Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.90 2003/02/14 13:17:13 meskes Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
MAJOR_VERSION=2
MINOR_VERSION=11
MINOR_VERSION=12
PATCHLEVEL=0
override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.59 2003/02/13 13:11:52 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.60 2003/02/14 13:17:13 meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
......@@ -315,6 +315,10 @@ main(int argc, char *const argv[])
/* we need several includes */
fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These four include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
/* add some compatibility headers */
if (compat == ECPG_COMPAT_INFORMIX)
fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
/* and parse the source */
yyparse();
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.55 2002/10/21 13:09:31 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.56 2003/02/14 13:17:13 meskes Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -28,7 +28,7 @@
*/
static ScanKeyword ScanKeywords[] = {
/* name, value */
{"abort", ABORT_TRANS},
{"abort", ABORT_P},
{"absolute", ABSOLUTE},
{"access", ACCESS},
{"action", ACTION},
......@@ -49,7 +49,7 @@ static ScanKeyword ScanKeywords[] = {
{"authorization", AUTHORIZATION},
{"backward", BACKWARD},
{"before", BEFORE},
{"begin", BEGIN_TRANS},
{"begin", BEGIN_P},
{"between", BETWEEN},
{"bigint", BIGINT},
{"binary", BINARY},
......@@ -115,7 +115,7 @@ static ScanKeyword ScanKeywords[] = {
{"else", ELSE},
{"encoding", ENCODING},
{"encrypted", ENCRYPTED},
{"end", END_TRANS},
{"end", END_P},
{"escape", ESCAPE},
{"except", EXCEPT},
{"exclusive", EXCLUSIVE},
......@@ -226,6 +226,7 @@ static ScanKeyword ScanKeywords[] = {
{"position", POSITION},
{"precision", PRECISION},
{"prepare", PREPARE},
{"preserve", PRESERVE},
{"primary", PRIMARY},
{"prior", PRIOR},
{"privileges", PRIVILEGES},
......@@ -246,6 +247,7 @@ static ScanKeyword ScanKeywords[] = {
{"right", RIGHT},
{"rollback", ROLLBACK},
{"row", ROW},
{"rows", ROWS},
{"rule", RULE},
{"schema", SCHEMA},
{"scroll", SCROLL},
......
......@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.103 2003/02/13 20:37:28 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.104 2003/02/14 13:17:13 meskes Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -423,7 +423,6 @@ cppline {space}*#(.*\\{space})*.*
/* are we simulating Informix? */
if (compat == ECPG_COMPAT_INFORMIX)
{
printf ("unput $\n");
unput(':');
}
else
......@@ -560,6 +559,12 @@ cppline {space}*#(.*\\{space})*.*
if (keyword != NULL)
return keyword->value;
/* Is it a C keyword? */
keyword = ScanCKeywordLookup(yytext);
if (keyword != NULL)
return keyword->value;
/* How about a DEFINE? */
for (ptr = defines; ptr; ptr = ptr->next)
{
......@@ -697,6 +702,7 @@ cppline {space}*#(.*\\{space})*.*
<C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
<C>{informix_special}{include}{space}* { BEGIN(incl); }
<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); }
<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
......@@ -832,32 +838,45 @@ cppline {space}*#(.*\\{space})*.*
i-- )
{}
/* Remove trailing '"' if it exists */
if (yytext[i] == '"')
yytext[i] = '\0';
else
yytext[i+1] = '\0';
yytext[i+1] = '\0';
yyin = NULL;
/* also remove starting '"' */
if (yytext[0] == '"')
/* If file name is enclosed in '"' remove these and look only in '.' */
if (yytext[0] == '"' && yytext[i] == '"')
{
yytext[i] = '\0';
memmove(yytext, yytext+1, strlen(yytext));
yyin = NULL;
for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
{
if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
{
fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
continue;
}
snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
yyin = fopen( inc_file, "r" );
strncpy(inc_file, yytext, sizeof(inc_file));
yyin = fopen(inc_file, "r");
if (!yyin)
{
if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
{
strcat(inc_file, ".h");
yyin = fopen( inc_file, "r" );
yyin = fopen(inc_file, "r");
}
}
}
else
{
for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
{
if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
{
fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
continue;
}
snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
yyin = fopen(inc_file, "r");
if (!yyin)
{
if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
{
strcat(inc_file, ".h");
yyin = fopen( inc_file, "r" );
}
}
}
}
......
This diff is collapsed.
......@@ -23,14 +23,15 @@ exec sql begin declare section;
struct personal_indicator { int ind_name;
birthinfo ind_birth;
} ind_personal, *i;
float ind_married;
ind children;
ind ind_children;
char *married = NULL;
c testname="Petra";
char *query="select name, born, age, married, children from meskes where name = :var1";
exec sql end declare section;
exec sql char *married = NULL;
exec sql float ind_married;
exec sql ind children;
exec sql var ind_married is long;
exec sql declare cur cursor for
......
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