Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd471f80

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent9abf246 commitd471f80

File tree

8 files changed

+65
-35
lines changed

8 files changed

+65
-35
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,5 +535,14 @@ Sat Mar 20 19:57:42 CET 1999
535535

536536
- Synced preproc.y with gram.y.
537537
- Fixed handling of ';' character.
538+
539+
Sun Mar 21 13:05:50 CET 1999
540+
541+
- Synced preproc.y with gram.y.
542+
543+
Mon Mar 22 19:22:38 CET 1999
544+
545+
- Fixed incorrect password entry in parser.
546+
- Made no_auto_trans available for each connection seperately.
538547
- Set library version to 3.0.0
539548
- Set ecpg version to 2.6.0

‎src/interfaces/ecpg/TODO

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
The complete structure definition has to be listed inside the declare
22
section of the structure variable for ecpg to be able to understand it.
33

4-
Variable type bool has to be tested. I never used it so far.
5-
64
The error message for "no data" in an exec sql insert select from statement
75
has to be 100.
86

@@ -13,6 +11,9 @@ it would be nice to be able to use :var[:index] as cvariable
1311

1412
support for dynamic SQL with unknown number of variables with DESCRIPTORS
1513

14+
The line numbering is not exact.
15+
1616
Missing statements:
1717
- exec sql allocate
18+
- exec sql deallocate
1819
- SQLSTATE

‎src/interfaces/ecpg/include/ecpglib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern"C"
88
voidECPGdebug(int,FILE*);
99
boolECPGstatus(int,constchar*);
1010
boolECPGsetconn(int,constchar*);
11-
boolECPGconnect(int,constchar*,constchar*,constchar*,constchar*);
11+
boolECPGconnect(int,constchar*,constchar*,constchar*,constchar*,int);
1212
boolECPGdo(int,constchar*,char*,...);
1313
boolECPGtrans(int,constchar*,constchar*);
1414
boolECPGdisconnect(int,constchar*);

‎src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include<sqlca.h>
2727

2828
/* variables visible to the programs */
29-
intno_auto_trans;
30-
3129
staticstructsqlcasqlca_init=
3230
{
3331
{'S','Q','L','C','A',' ',' ',' '},
@@ -56,7 +54,8 @@ static struct connection
5654
{
5755
char*name;
5856
PGconn*connection;
59-
intcommitted;
57+
boolcommitted;
58+
intno_auto_trans;
6059
structconnection*next;
6160
}*all_connections=NULL,*actual_connection=NULL;
6261

@@ -633,7 +632,7 @@ ECPGexecute(struct statement * stmt)
633632

634633
/* Now the request is built. */
635634

636-
if (stmt->connection->committed&& !no_auto_trans)
635+
if (stmt->connection->committed&& !stmt->connection->no_auto_trans)
637636
{
638637
if ((results=PQexec(stmt->connection->connection,"begin transaction"))==NULL)
639638
{
@@ -1144,7 +1143,7 @@ ECPGsetconn(int lineno, const char *connection_name)
11441143
}
11451144

11461145
bool
1147-
ECPGconnect(intlineno,constchar*dbname,constchar*user,constchar*passwd,constchar*connection_name)
1146+
ECPGconnect(intlineno,constchar*dbname,constchar*user,constchar*passwd,constchar*connection_name,intno_auto_trans)
11481147
{
11491148
structconnection*this= (structconnection*)ecpg_alloc(sizeof(structconnection),lineno);
11501149

@@ -1182,6 +1181,7 @@ ECPGconnect(int lineno, const char *dbname, const char *user, const char *passwd
11821181
}
11831182

11841183
this->committed= true;
1184+
this->no_auto_trans=no_auto_trans;
11851185

11861186
return true;
11871187
}

‎src/interfaces/ecpg/preproc/extern.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ extern struct arguments *argsresult;
2323

2424
/* functions */
2525

26+
externvoidoutput_line_number(void);
2627
externvoidlex_init(void);
2728
externchar*input_filename;
2829
externintyyparse(void);

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ real[\-]?(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|(
149149
param\${integer}
150150

151151
comment("--"|"//").*\n
152+
ccomment"//".*\n
152153

153154
space[ \t\n\f]
154155
other.
155156

156157
/* some stuff needed for ecpg*/
157-
ccomment"//".*\n
158158
exec [eE][xX][eE][cC]
159159
define[dD][eE][fF][iI][nN][eE]
160160
include [iI][nN][cC][lL][uU][dD][eE]
@@ -659,6 +659,7 @@ cppline{space}*#.*(\\{space}*\n)*\n*
659659
input_filename =mm_strdup(inc_file);
660660
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE ));
661661
yylineno =0;
662+
output_line_number();
662663

663664
BEGIN C;
664665
}
@@ -682,9 +683,9 @@ cppline{space}*#.*(\\{space}*\n)*\n*
682683

683684
yy_buffer = yy_buffer->next;
684685
free(yb);
686+
output_line_number();
685687
}
686688
}
687-
688689
%%
689690
void
690691
lex_init(void)

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,19 @@ struct ECPGtype ecpg_query = {ECPGt_char_variable, 0L, {NULL}};
3737
*/
3838
char * input_filename =NULL;
3939

40-
staticvoid
40+
void
4141
output_line_number()
4242
{
4343
if (input_filename)
44-
fprintf(yyout,"\n#line %d\"%s\"\n", yylineno, input_filename);
44+
fprintf(yyout,"\n#line %d\"%s\"\n", yylineno +1, input_filename);
45+
}
46+
47+
staticvoid
48+
output_simple_statement(char *cmd)
49+
{
50+
fputs(cmd, yyout);
51+
output_line_number();
52+
free(cmd);
4553
}
4654

4755
/*
@@ -883,10 +891,7 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
883891
|RevokeStmt{ output_statement($1,0); }
884892
|OptimizableStmt{
885893
if (strncmp($1,"/*" ,sizeof("/*")-1) ==0)
886-
{
887-
fputs($1, yyout);
888-
free($1);
889-
}
894+
output_simple_statement($1);
890895
else
891896
output_statement($1,1);
892897
}
@@ -908,14 +913,12 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
908913
if (connection)
909914
yyerror("no at option for connect statement.\n");
910915

911-
fprintf(yyout,"no_auto_trans = %d;\n", no_auto_trans);
912-
fprintf(yyout,"ECPGconnect(__LINE__, %s);", $1);
916+
fprintf(yyout,"ECPGconnect(__LINE__, %s, %d);", $1, no_auto_trans);
913917
whenever_action(0);
914918
free($1);
915919
}
916920
|ECPGCursorStmt{
917-
fputs($1, yyout);
918-
free($1);
921+
output_simple_statement($1);
919922
}
920923
|ECPGDeallocate{
921924
if (connection)
@@ -926,8 +929,7 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
926929
free($1);
927930
}
928931
|ECPGDeclare{
929-
fputs($1, yyout);
930-
free($1);
932+
output_simple_statement($1);
931933
}
932934
|ECPGDisconnect{
933935
if (connection)
@@ -991,23 +993,19 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
991993
if (connection)
992994
yyerror("no at option for typedef statement.\n");
993995

994-
fputs($1, yyout);
995-
free($1);
996+
output_simple_statement($1);
996997
}
997998
|ECPGVar{
998999
if (connection)
9991000
yyerror("no at option for var statement.\n");
10001001

1001-
fputs($1, yyout);
1002-
free($1);
1002+
output_simple_statement($1);
10031003
}
10041004
|ECPGWhenever{
10051005
if (connection)
10061006
yyerror("no at option for whenever statement.\n");
10071007

1008-
fputs($1, yyout);
1009-
output_line_number();
1010-
free($1);
1008+
output_simple_statement($1);
10111009
}
10121010
;
10131011

@@ -3572,6 +3570,10 @@ a_expr: attr opt_indirection
35723570
}
35733571
|'-'a_expr %precUMINUS
35743572
{$$ = cat2_str(make1_str("-"),$2); }
3573+
|'%'a_expr
3574+
{$$ = cat2_str(make1_str("%"),$2); }
3575+
|a_expr'%'
3576+
{$$ = cat2_str($1, make1_str("%")); }
35753577
|a_expr'+'a_expr
35763578
{$$ = cat3_str($1, make1_str("+"),$3); }
35773579
|a_expr'-'a_expr
@@ -3663,7 +3665,6 @@ a_expr: attr opt_indirection
36633665
{
36643666
$$ = make1_str("user");
36653667
}
3666-
36673668
|EXISTS'('SubSelect')'
36683669
{
36693670
$$ = make3_str(make1_str("exists("),$3, make1_str(")"));
@@ -3879,6 +3880,10 @@ b_expr: attr opt_indirection
38793880
}
38803881
|'-'b_expr %precUMINUS
38813882
{$$ = cat2_str(make1_str("-"),$2); }
3883+
|'%'b_expr
3884+
{$$ = cat2_str(make1_str("%"),$2); }
3885+
|b_expr'%'
3886+
{$$ = cat2_str($1, make1_str("%")); }
38823887
|b_expr'+'b_expr
38833888
{$$ = cat3_str($1, make1_str("+"),$3); }
38843889
|b_expr'-'b_expr
@@ -4677,7 +4682,7 @@ ora_user: user_name
46774682
{
46784683
$$ = make2_str($1, make1_str(",NULL"));
46794684
}
4680-
|user_name'/'ColId
4685+
|user_name'/'user_name
46814686
{
46824687
$$ = make3_str($1, make1_str(","),$3);
46834688
}
@@ -5604,6 +5609,10 @@ ecpg_expr: attr opt_indirection
56045609
}
56055610
|'-'ecpg_expr %precUMINUS
56065611
{$$ = cat2_str(make1_str("-"),$2); }
5612+
|'%'ecpg_expr
5613+
{$$ = cat2_str(make1_str("%"),$2); }
5614+
|a_expr'%'
5615+
{$$ = cat2_str($1, make1_str("%")); }
56075616
|a_expr'+'ecpg_expr
56085617
{$$ = cat3_str($1, make1_str("+"),$3); }
56095618
|a_expr'-'ecpg_expr
@@ -5618,6 +5627,10 @@ ecpg_expr: attr opt_indirection
56185627
{$$ = cat3_str($1, make1_str("<"),$3); }
56195628
|a_expr'>'ecpg_expr
56205629
{$$ = cat3_str($1, make1_str(">"),$3); }
5630+
|a_expr'='NULL_P
5631+
{$$ = cat2_str($1, make1_str("= NULL")); }
5632+
|NULL_P'='a_expr
5633+
{$$ = cat2_str(make1_str("= NULL"),$3); }
56215634
|a_expr'='ecpg_expr
56225635
{$$ = cat3_str($1, make1_str("="),$3); }
56235636
/*| ':' ecpg_expr
@@ -5686,6 +5699,10 @@ ecpg_expr: attr opt_indirection
56865699
{
56875700
$$ = make1_str("current_user");
56885701
}
5702+
|USER
5703+
{
5704+
$$ = make1_str("user");
5705+
}
56895706
|EXISTS'('SubSelect')'
56905707
{
56915708
$$ = make3_str(make1_str("exists("),$3, make1_str(")"));
@@ -5758,11 +5775,11 @@ ecpg_expr: attr opt_indirection
57585775
}
57595776
|a_exprIN'('in_expr')'
57605777
{
5761-
$$ = make4_str($1, make1_str("in ("),$4, make1_str(")"));
5778+
$$ = make4_str($1, make1_str("in ("),$4, make1_str(")"));
57625779
}
57635780
|a_exprNOTIN'('not_in_expr')'
57645781
{
5765-
$$ = make4_str($1, make1_str("not in ("),$5, make1_str(")"));
5782+
$$ = make4_str($1, make1_str("not in ("),$5, make1_str(")"));
57665783
}
57675784
|a_exprOp'('SubSelect')'
57685785
{
@@ -5838,7 +5855,7 @@ ecpg_expr: attr opt_indirection
58385855
}
58395856
|a_exprOpALL'('SubSelect')'
58405857
{
5841-
$$ =make3_str($1,$2, make3_str(make1_str("all ("),$5, make1_str(")")));
5858+
$$ =cat3_str($1,$2, make3_str(make1_str("all ("),$5, make1_str(")")));
58425859
}
58435860
|a_expr'+'ALL'('SubSelect')'
58445861
{
@@ -5878,6 +5895,8 @@ ecpg_expr: attr opt_indirection
58785895
{$$ = cat3_str($1, make1_str("or"),$3); }
58795896
|NOTecpg_expr
58805897
{$$ = cat2_str(make1_str("not"),$2); }
5898+
|case_expr
5899+
{$$ =$1; }
58815900
|civariableonly
58825901
{$$ =$1; }
58835902
;

‎src/interfaces/ecpg/preproc/type.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ,
269269
char*variable= (char*)mm_alloc(strlen(name)+ ((prefix==NULL) ?0 :strlen(prefix))+4);
270270
char*offset= (char*)mm_alloc(strlen(name)+strlen("sizeof(struct varchar_)")+1);
271271

272-
/*if (varcharsize == 0 || arrsize >= 0)*/
273272
/* we have to use the pointer except for arrays with given bounds */
274273
if (arrsize>0)
275274
sprintf(variable,"(%s%s)",prefix ?prefix :"",name);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp