Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a453419

Browse files
committed
From: Michael Meskes <meskes@topsystem.de> + Tue May 19 11:49:34 CEST 1998 + + - Tested (and fixed) 'set connection' + - Fixed string notation in C + - Set version to 2.3.2
1 parent 07140ee commit a453419

File tree

6 files changed

+45
-29
lines changed

6 files changed

+45
-29
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,8 @@ Mon May 18 10:33:58 CEST 1998
228228
- Set version to 2.3.1
229229
- Set library version to 2.2
230230

231+
Tue May 19 11:49:34 CEST 1998
232+
233+
- Tested (and fixed) 'set connection'
234+
- Fixed string notation in C
235+
- Set version to 2.3.2

src/interfaces/ecpg/TODO

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ section of the structure variable for ecpg to be able to understand it.
55

66
Variable type bool has to be checked. I never used it so far.
77

8-
ecpg cannot use pointer variables except [unsigned] char *
9-
10-
There is no exec sql type statement which is the SQL version of a typedef.
11-
12-
There is no exec sql prepare statement.
13-
14-
There is no SQLSTATE
8+
Missing statements:
9+
- exec sql type
10+
- exec sql define
11+
- exec sql prepare
12+
- exec sql allocate
13+
- exqc sql free
14+
- SQLSTATE

src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,10 @@ bool
804804
ECPGsetconn(int lineno, const char *connection_name)
805805
{
806806
struct connection *con = all_connections;
807+
808+
ECPGlog("ECPGsetconn: setting actual connection to %s\n", connection_name);
807809

808-
for (; con && strcmp(connection_name, con->name) == 0; con=con->next);
810+
for (; con && strcmp(connection_name, con->name) != 0; con=con->next);
809811
if (con)
810812
{
811813
actual_connection = con;
@@ -883,7 +885,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
883885
}
884886
else
885887
{
886-
for (con = all_connections; con && strcmp(con->name, connection_name);con = con->next);
888+
for (con = all_connections; con && strcmp(con->name, connection_name) != 0;con = con->next);
887889
if (con == NULL)
888890
{
889891
ECPGlog("disconnect: not connected to connection %s\n", connection_name);

src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
55
MINOR_VERSION=3
6-
PATCHLEVEL=1
6+
PATCHLEVEL=2
77

88
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
99
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,11 @@ sql [sS][qQ][lL]
180180

181181
<xc>{xcstar} { /* ignore */ }
182182
{xcstart} {
183-
fprintf(stderr,"ys = %d %d\n", YYSTATE, before_comment);
184183
before_comment = YYSTATE;
185184
BEGIN(xc);
186-
fprintf(stderr,"ys = %d %d\n", YYSTATE,
187-
before_comment);
188185
}
189186

190-
<xc>{xcstop} { fprintf(stderr,"ys = %d %d\n", YYSTATE, before_comment);BEGIN(before_comment); }
187+
<xc>{xcstop} { BEGIN(before_comment); }
191188

192189
<xc>{xcinside} { /* ignore */ }
193190

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,8 @@ output_statement(char * stmt, int mode)
673673
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen open_opts
674674
%type <str> indicator ECPGExecute c_expr variable_list dotext
675675
%type <str> storage_clause opt_initializer vartext c_anything blockstart
676-
%type <str> blockend variable_list variable var_anything sql_anything
677-
%type <str> opt_pointer ecpg_ident cvariable ECPGDisconnect dis_name
676+
%type <str> blockend variable_list variable var_anything do_anything
677+
%type <str> opt_pointer cvariable ECPGDisconnect dis_name
678678
%type <str> stmt symbol opt_symbol ECPGRelease execstring server_name
679679
%type <str> connection_object opt_server opt_port
680680
%type <str> user_name opt_user char_variable ora_user ident
@@ -762,7 +762,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
762762
| ECPGOpen { output_statement($1, 0); }
763763
| ECPGRelease { /* output already done */ }
764764
| ECPGSetConnection {
765-
fprintf(yyout, "ECPGsetcon(__LINE__, %s);", $1);
765+
fprintf(yyout, "ECPGsetconn(__LINE__, %s);", $1);
766766
whenever_action(0);
767767
free($1);
768768
}
@@ -4014,6 +4014,13 @@ connection_target: database_name opt_server opt_port
40144014
{
40154015
$$ = $1;
40164016
}
4017+
| Sconst
4018+
{
4019+
$$ = strdup($1);
4020+
$$[0] = '\"';
4021+
$$[strlen($$) - 1] = '\"';
4022+
free($1);
4023+
}
40174024

40184025
db_prefix: ident cvariable
40194026
{
@@ -4075,9 +4082,12 @@ ora_user: user_name
40754082
$$ = make3_str($1, make1_str(","), $3);
40764083
}
40774084

4078-
user_name: UserId { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
4085+
user_name: UserId { if ($1[0] == '\"')
4086+
$$ = $1;
4087+
else
4088+
$$ = make3_str(make1_str("\""), $1, make1_str("\""));
4089+
}
40794090
| char_variable { $$ = $1; }
4080-
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
40814091
| SCONST { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
40824092

40834093
char_variable: cvariable
@@ -4137,7 +4147,8 @@ connection_object: connection_target { $$ = $1; }
41374147
*/
41384148
ECPGExecute : EXECUTE SQL_IMMEDIATE execstring { $$ = $3; };
41394149

4140-
execstring: cvariable | CSTRING;
4150+
execstring: cvariable |
4151+
CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); };
41414152

41424153
/*
41434154
* open is an open cursor, at the moment this has to be removed
@@ -4534,7 +4545,7 @@ into_list : coutputvariable | into_list ',' coutputvariable;
45344545
ecpgstart: SQL_START { reset_variables();}
45354546

45364547
dotext: /* empty */ { $$ = make1_str(""); }
4537-
| dotext sql_anything { $$ = make2_str($1, $2); }
4548+
| dotext do_anything { $$ = make2_str($1, $2); }
45384549

45394550
vartext: var_anything { $$ = $1; }
45404551
| vartext var_anything { $$ = make2_str($1, $2); }
@@ -4559,16 +4570,15 @@ indicator: /* empty */ { $$ = NULL; }
45594570
| SQL_INDICATOR name { check_indicator((find_variable($2))->type); $$ = $2; }
45604571

45614572
ident: IDENT { $$ = make1_str($1); }
4562-
4563-
ecpg_ident: ident { $$ = $1; }
4564-
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
4573+
| CSTRING { $$ = $1; }
45654574
/*
45664575
* C stuff
45674576
*/
45684577

4569-
symbol: ecpg_ident { $$ = $1; }
4578+
symbol: IDENT { $$ = make1_str($1); }
45704579

4571-
c_anything: ecpg_ident { $$ = $1; }
4580+
c_anything: IDENT { $$ = make1_str($1); }
4581+
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
45724582
| Iconst { $$ = $1; }
45734583
| FCONST { $$ = make_name(); }
45744584
| '*' { $$ = make1_str("*"); }
@@ -4597,12 +4607,14 @@ c_anything: ecpg_ident { $$ = $1; }
45974607
| '=' { $$ = make1_str("="); }
45984608
| ',' { $$ = make1_str(","); }
45994609

4600-
sql_anything: ecpg_ident { $$ = $1; }
4601-
| Iconst { $$ = $1; }
4610+
do_anything: IDENT { $$ = make1_str($1); }
4611+
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\""));}
4612+
| Iconst { $$ = $1; }
46024613
| FCONST { $$ = make_name(); }
46034614
| ',' { $$ = make1_str(","); }
46044615

4605-
var_anything: ecpg_ident { $$ = $1; }
4616+
var_anything: IDENT { $$ = make1_str($1); }
4617+
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
46064618
| Iconst { $$ = $1; }
46074619
| FCONST { $$ = make_name(); }
46084620
/*FIXME: | ',' { $$ = make1_str(","); }*/

0 commit comments

Comments
 (0)