aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/ChangeLog5
-rw-r--r--src/interfaces/ecpg/TODO14
-rw-r--r--src/interfaces/ecpg/lib/ecpglib.c6
-rw-r--r--src/interfaces/ecpg/preproc/Makefile2
-rw-r--r--src/interfaces/ecpg/preproc/pgc.l5
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y42
6 files changed, 45 insertions, 29 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index c7acdf023df..2dd35c7b48c 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -228,3 +228,8 @@ Mon May 18 10:33:58 CEST 1998
- Set version to 2.3.1
- Set library version to 2.2
+Tue May 19 11:49:34 CEST 1998
+
+ - Tested (and fixed) 'set connection'
+ - Fixed string notation in C
+ - Set version to 2.3.2
diff --git a/src/interfaces/ecpg/TODO b/src/interfaces/ecpg/TODO
index 3787f100ed5..cff7d70aeb2 100644
--- a/src/interfaces/ecpg/TODO
+++ b/src/interfaces/ecpg/TODO
@@ -5,10 +5,10 @@ section of the structure variable for ecpg to be able to understand it.
Variable type bool has to be checked. I never used it so far.
-ecpg cannot use pointer variables except [unsigned] char *
-
-There is no exec sql type statement which is the SQL version of a typedef.
-
-There is no exec sql prepare statement.
-
-There is no SQLSTATE
+Missing statements:
+ - exec sql type
+ - exec sql define
+ - exec sql prepare
+ - exec sql allocate
+ - exqc sql free
+ - SQLSTATE
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c
index 445776ec828..504a0388ccd 100644
--- a/src/interfaces/ecpg/lib/ecpglib.c
+++ b/src/interfaces/ecpg/lib/ecpglib.c
@@ -804,8 +804,10 @@ bool
ECPGsetconn(int lineno, const char *connection_name)
{
struct connection *con = all_connections;
+
+ ECPGlog("ECPGsetconn: setting actual connection to %s\n", connection_name);
- for (; con && strcmp(connection_name, con->name) == 0; con=con->next);
+ for (; con && strcmp(connection_name, con->name) != 0; con=con->next);
if (con)
{
actual_connection = con;
@@ -883,7 +885,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
}
else
{
- for (con = all_connections; con && strcmp(con->name, connection_name);con = con->next);
+ for (con = all_connections; con && strcmp(con->name, connection_name) != 0;con = con->next);
if (con == NULL)
{
ECPGlog("disconnect: not connected to connection %s\n", connection_name);
diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile
index 1410087832a..30b6d829a37 100644
--- a/src/interfaces/ecpg/preproc/Makefile
+++ b/src/interfaces/ecpg/preproc/Makefile
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2
MINOR_VERSION=3
-PATCHLEVEL=1
+PATCHLEVEL=2
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index c9f0cd459b5..6ac025c0fee 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -180,14 +180,11 @@ sql [sS][qQ][lL]
<xc>{xcstar} { /* ignore */ }
{xcstart} {
- fprintf(stderr,"ys = %d %d\n", YYSTATE, before_comment);
before_comment = YYSTATE;
BEGIN(xc);
- fprintf(stderr,"ys = %d %d\n", YYSTATE,
-before_comment);
}
-<xc>{xcstop} { fprintf(stderr,"ys = %d %d\n", YYSTATE, before_comment);BEGIN(before_comment); }
+<xc>{xcstop} { BEGIN(before_comment); }
<xc>{xcinside} { /* ignore */ }
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 5e99e7190d9..53916b23168 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -673,8 +673,8 @@ output_statement(char * stmt, int mode)
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen open_opts
%type <str> indicator ECPGExecute c_expr variable_list dotext
%type <str> storage_clause opt_initializer vartext c_anything blockstart
-%type <str> blockend variable_list variable var_anything sql_anything
-%type <str> opt_pointer ecpg_ident cvariable ECPGDisconnect dis_name
+%type <str> blockend variable_list variable var_anything do_anything
+%type <str> opt_pointer cvariable ECPGDisconnect dis_name
%type <str> stmt symbol opt_symbol ECPGRelease execstring server_name
%type <str> connection_object opt_server opt_port
%type <str> user_name opt_user char_variable ora_user ident
@@ -762,7 +762,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
| ECPGOpen { output_statement($1, 0); }
| ECPGRelease { /* output already done */ }
| ECPGSetConnection {
- fprintf(yyout, "ECPGsetcon(__LINE__, %s);", $1);
+ fprintf(yyout, "ECPGsetconn(__LINE__, %s);", $1);
whenever_action(0);
free($1);
}
@@ -4014,6 +4014,13 @@ connection_target: database_name opt_server opt_port
{
$$ = $1;
}
+ | Sconst
+ {
+ $$ = strdup($1);
+ $$[0] = '\"';
+ $$[strlen($$) - 1] = '\"';
+ free($1);
+ }
db_prefix: ident cvariable
{
@@ -4075,9 +4082,12 @@ ora_user: user_name
$$ = make3_str($1, make1_str(","), $3);
}
-user_name: UserId { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
+user_name: UserId { if ($1[0] == '\"')
+ $$ = $1;
+ else
+ $$ = make3_str(make1_str("\""), $1, make1_str("\""));
+ }
| char_variable { $$ = $1; }
- | CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
| SCONST { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
char_variable: cvariable
@@ -4137,7 +4147,8 @@ connection_object: connection_target { $$ = $1; }
*/
ECPGExecute : EXECUTE SQL_IMMEDIATE execstring { $$ = $3; };
-execstring: cvariable | CSTRING;
+execstring: cvariable |
+ CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); };
/*
* open is an open cursor, at the moment this has to be removed
@@ -4534,7 +4545,7 @@ into_list : coutputvariable | into_list ',' coutputvariable;
ecpgstart: SQL_START { reset_variables();}
dotext: /* empty */ { $$ = make1_str(""); }
- | dotext sql_anything { $$ = make2_str($1, $2); }
+ | dotext do_anything { $$ = make2_str($1, $2); }
vartext: var_anything { $$ = $1; }
| vartext var_anything { $$ = make2_str($1, $2); }
@@ -4559,16 +4570,15 @@ indicator: /* empty */ { $$ = NULL; }
| SQL_INDICATOR name { check_indicator((find_variable($2))->type); $$ = $2; }
ident: IDENT { $$ = make1_str($1); }
-
-ecpg_ident: ident { $$ = $1; }
- | CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
+ | CSTRING { $$ = $1; }
/*
* C stuff
*/
-symbol: ecpg_ident { $$ = $1; }
+symbol: IDENT { $$ = make1_str($1); }
-c_anything: ecpg_ident { $$ = $1; }
+c_anything: IDENT { $$ = make1_str($1); }
+ | CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
| Iconst { $$ = $1; }
| FCONST { $$ = make_name(); }
| '*' { $$ = make1_str("*"); }
@@ -4597,12 +4607,14 @@ c_anything: ecpg_ident { $$ = $1; }
| '=' { $$ = make1_str("="); }
| ',' { $$ = make1_str(","); }
-sql_anything: ecpg_ident { $$ = $1; }
- | Iconst { $$ = $1; }
+do_anything: IDENT { $$ = make1_str($1); }
+ | CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\""));}
+ | Iconst { $$ = $1; }
| FCONST { $$ = make_name(); }
| ',' { $$ = make1_str(","); }
-var_anything: ecpg_ident { $$ = $1; }
+var_anything: IDENT { $$ = make1_str($1); }
+ | CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
| Iconst { $$ = $1; }
| FCONST { $$ = make_name(); }
/*FIXME: | ',' { $$ = make1_str(","); }*/