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

Commit6fb3c3f

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent06d95d9 commit6fb3c3f

File tree

6 files changed

+99
-55
lines changed

6 files changed

+99
-55
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,14 @@ Thu Oct 7 15:12:58 CEST 1999
674674
- Set ecpg version to 2.6.6
675675
- Set library version to 3.0.4
676676

677+
Tue Oct 12 07:26:50 CEST 1999
678+
679+
- Simplified C part of parser.
680+
681+
Fri Oct 15 17:05:25 CEST 1999
682+
683+
- Synced preproc.y with gram.y.
684+
- Synced pgc.l with scan.l.
685+
- Synced keyword.c.
686+
- Finished C parser changes, so initializers are correctly parsed.
687+
- Set ecpg version to 2.6.7

‎src/interfaces/ecpg/TODO

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ support for dynamic SQL with unknown number of variables with DESCRIPTORS
1313

1414
The line numbering is not exact.
1515

16+
What happens to the output variable during read if there was an
17+
indicator-error?
18+
19+
Add a semantic check level, e.g. check if a table really exists.
20+
1621
Missing statements:
17-
- execslq ifdef
22+
- execsql ifdef
1823
- exec sql allocate
1924
- exec sql deallocate
2025
- SQLSTATE

‎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=6
6-
PATCHLEVEL=6
6+
PATCHLEVEL=7
77

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.18 1999/10/08 11:05:02 meskes Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.19 1999/10/15 19:02:08 meskes Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -61,6 +61,7 @@ static ScanKeyword ScanKeywords[] = {
6161
{"coalesce",COALESCE},
6262
{"collate",COLLATE},
6363
{"column",COLUMN},
64+
{"comment",COMMENT},
6465
{"commit",COMMIT},
6566
{"committed",COMMITTED},
6667
{"constraint",CONSTRAINT},

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/* This is a modified version of src/backend/parser/scan.l */
23
%{
34
#include<ctype.h>
@@ -90,6 +91,10 @@ xhstop{quote}
9091
xhinside[^']*
9192
xhcat{quote}{space}*\n{space}*{quote}
9293

94+
/* C version of hex number
95+
*/
96+
xch0[xX][0-9A-Fa-f]*
97+
9398
/* Extended quote
9499
* xqdouble implements SQL92 embedded quote
95100
* xqcat allows strings to cross input lines
@@ -150,10 +155,10 @@ real(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digi
150155

151156
param\${integer}
152157

153-
comment("--"|"//").*\n
158+
comment("--"|"//").*
154159
ccomment"//".*\n
155160

156-
space[ \t\n\f]
161+
space[\t\n\r\f]
157162
other.
158163

159164
/* some stuff needed for ecpg */
@@ -242,7 +247,6 @@ cppline{space}*#.*(\\{space}*\n)*\n*
242247
}
243248
<xq>{xqstop}{
244249
BEGIN(SQL);
245-
/* yylval.str = mm_strdup(scanstr(literal));*/
246250
yylval.str =mm_strdup(literal);
247251
return SCONST;
248252
}
@@ -319,13 +323,6 @@ cppline{space}*#.*(\\{space}*\n)*\n*
319323
if (*endptr !='\0' || errno == ERANGE)
320324
{
321325
errno =0;
322-
#if0
323-
yylval.dval = strtod(((char *)yytext),&endptr);
324-
if (*endptr != '\0' || errno == ERANGE)
325-
yyerror("ERROR: Bad integer input");
326-
yyerror("WARNING: Integer input is out of range; promoted to float");
327-
return FCONST;
328-
#endif
329326
yylval.str =mm_strdup((char*)yytext);
330327
return SCONST;
331328
}
@@ -414,6 +411,19 @@ cppline{space}*#.*(\\{space}*\n)*\n*
414411
<SQL>{other}{return yytext[0]; }
415412
<C>{exec}{space}*{sql}{ BEGIN SQL;return SQL_START; }
416413
<C>{ccomment}{/* ignore */ }
414+
<C>{xch}{
415+
char* endptr;
416+
417+
errno =0;
418+
yylval.ival =strtol((char *)yytext,&endptr,16);
419+
if (*endptr !='\0' || errno == ERANGE)
420+
{
421+
errno =0;
422+
yylval.str =mm_strdup((char*)yytext);
423+
return SCONST;
424+
}
425+
return ICONST;
426+
}
417427
<C>{cppline}{
418428
yylval.str =mm_strdup((char*)yytext);
419429
return(CPP_LINE);
@@ -470,7 +480,7 @@ cppline{space}*#.*(\\{space}*\n)*\n*
470480
<C>\[{return('['); }
471481
<C>\]{return(']'); }
472482
<C>\={return('='); }
473-
<C>{other}{return S_ANYTHING; }
483+
<C>{other}{return S_ANYTHING; }
474484
<C>{exec}{space}{sql}{space}{define}{BEGIN(def_ident);}
475485
<def_ident>{space}{}
476486
<def_ident>{identifier}{

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

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
724724
*/
725725
%tokenABORT_TRANS,ACCESS,AFTER,AGGREGATE,ANALYZE,
726726
BACKWARD,BEFORE,BINARY,
727-
CACHE,CLUSTER,COPY,CREATEDB,CREATEUSER,CYCLE,
727+
CACHE,CLUSTER,COMMENT,COPY,CREATEDB,CREATEUSER,CYCLE,
728728
DATABASE,DELIMITERS,DO,
729729
EACH,ENCODING,EXCLUSIVE,EXPLAIN,EXTEND,
730730
FORWARD,FUNCTION,HANDLER,
@@ -785,7 +785,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
785785
%type<str>update_target_elopt_idrelation_namedatabase_name
786786
%type<str>access_methodattr_nameclassindex_namenamefunc_name
787787
%type<str>file_nameAexprConstParamNoTypeId
788-
%type<str>in_expr_nodesa_exprb_exprTruncateStmt
788+
%type<str>in_expr_nodesa_exprb_exprTruncateStmtCommentStmt
789789
%type<str>opt_indirectionexpr_listextract_listextract_arg
790790
%type<str>position_listsubstr_listsubstr_from
791791
%type<str>trim_listin_exprsubstr_forattrattrs
@@ -839,15 +839,15 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
839839
%type<str>constraints_set_mode
840840

841841
%type<str>ECPGWheneverECPGConnectconnection_targetECPGOpenopt_using
842-
%type<str>indicatorECPGExecuteecpg_exprdotextECPGPrepare
843-
%type<str>storage_clauseopt_initializervartextc_anythingblockstart
844-
%type<str>blockendvariable_listvariablevar_anythingdo_anything
842+
%type<str>indicatorECPGExecuteecpg_exprECPGPrepare
843+
%type<str>storage_clauseopt_initializerc_anythingblockstart
844+
%type<str>blockendvariable_listvariablec_thingc_term
845845
%type<str>opt_pointercvariableECPGDisconnectdis_name
846846
%type<str>stmtsymbolopt_symbolECPGReleaseexecstringserver_name
847-
%type<str>connection_objectopt_serveropt_portc_thingopt_reference
847+
%type<str>connection_objectopt_serveropt_portc_stuffopt_reference
848848
%type<str>user_nameopt_userchar_variableora_userident
849-
%type<str>db_prefixserveropt_optionsopt_connection_name
850-
%type<str>ECPGSetConnectionc_linecpp_lines_enumECPGTypedef
849+
%type<str>db_prefixserveropt_optionsopt_connection_namec_list
850+
%type<str>ECPGSetConnectioncpp_lines_enumECPGTypedefc_args
851851
%type<str>enum_typecivariableonlyECPGCursorStmtECPGDeallocate
852852
%type<str>ECPGFreeECPGDeclareECPGVarsql_variable_declarations
853853
%type<str>sql_declarationsql_variable_listsql_variableopt_at
@@ -882,6 +882,7 @@ opt_at:SQL_AT connection_target{ connection = $2; }
882882
stmt:AddAttrStmt{ output_statement($1,0); }
883883
|AlterUserStmt{ output_statement($1,0); }
884884
|ClosePortalStmt{ output_statement($1,0); }
885+
|CommentStmt{ output_statement($1,0); }
885886
|CopyStmt{ output_statement($1,0); }
886887
|CreateStmt{ output_statement($1,0); }
887888
|CreateAsStmt{ output_statement($1,0); }
@@ -1892,7 +1893,23 @@ opt_portal_name: IN name{ $$ = cat2_str(make1_str("in"), $2); }
18921893
|/*EMPTY*/{$$ = make1_str(""); }
18931894
;
18941895

1895-
1896+
/*****************************************************************************
1897+
*
1898+
* QUERY:
1899+
* comment on [ table <relname> | column <relname>.<attribu
1900+
* is 'text'
1901+
*
1902+
*****************************************************************************/
1903+
CommentStmt:COMMENTONCOLUMNrelation_name'.'attr_nameISSconst
1904+
{
1905+
cat2_str(cat5_str(make1_str("comment on column"), $4, make1_str(","), $6, make1_str("is")), $8);
1906+
}
1907+
|COMMENTONTABLErelation_nameISSconst
1908+
{
1909+
cat4_str(make1_str("comment on table"), $4, make1_str("is"), $6);
1910+
}
1911+
;
1912+
18961913
/*****************************************************************************
18971914
*
18981915
*QUERY:
@@ -4195,6 +4212,7 @@ ColId: ident{ $$ = $1; }
41954212
|BACKWARD{$$ = make1_str("backward"); }
41964213
|BEFORE{$$ = make1_str("before"); }
41974214
|CACHE{$$ = make1_str("cache"); }
4215+
|COMMENT{$$ = make1_str("comment"); }
41984216
|COMMITTED{$$ = make1_str("committed"); }
41994217
|CONSTRAINTS{$$ = make1_str("constraints"); }
42004218
|CREATEDB{$$ = make1_str("createdb"); }
@@ -4265,6 +4283,7 @@ ColId: ident{ $$ = $1; }
42654283
|TIMEZONE_HOUR {$$ = make1_str("timezone_hour"); }
42664284
|TIMEZONE_MINUTE {$$ = make1_str("timezone_minute"); }
42674285
|TRIGGER{$$ = make1_str("trigger"); }
4286+
|TRUNCATE{$$ = make1_str("truncate"); }
42684287
|TRUSTED{$$ = make1_str("trusted"); }
42694288
|TYPE_P{$$ = make1_str("type"); }
42704289
|VALID{$$ = make1_str("valid"); }
@@ -4673,8 +4692,7 @@ type: simple_type
46734692
{
46744693
$$.type_str =$1;
46754694
$$.type_enum = ECPGt_int;
4676-
4677-
$$.type_dimension = -1;
4695+
$$.type_dimension = -1;
46784696
$$.type_index = -1;
46794697
}
46804698
|symbol
@@ -4689,7 +4707,7 @@ type: simple_type
46894707
struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
46904708
}
46914709

4692-
enum_type:s_enum'{'c_line'}'
4710+
enum_type:s_enum'{'c_list'}'
46934711
{
46944712
$$ = cat4_str($1, make1_str("{"),$3, make1_str("}"));
46954713
}
@@ -4828,7 +4846,7 @@ variable: opt_pointer symbol opt_array_bounds opt_initializer
48284846
}
48294847

48304848
opt_initializer:/* empty*/{$$ = make1_str(""); }
4831-
|'='vartext{$$ = make2_str(make1_str("="),$2); }
4849+
|'='c_term{$$ = make2_str(make1_str("="),$2); }
48324850

48334851
opt_pointer:/* empty*/{$$ = make1_str(""); }
48344852
|'*'{$$ = make1_str("*"); }
@@ -5367,7 +5385,7 @@ action : SQL_CONTINUE {
53675385
$<action>$.command = strdup($3);
53685386
$<action>$.str = cat2_str(make1_str("goto"),$3);
53695387
}
5370-
|DOname'('dotext')' {
5388+
|DOname'('c_args')' {
53715389
$<action>$.code = W_DO;
53725390
$<action>$.command = make4_str($2, make1_str("("),$4, make1_str(")"));
53735391
$<action>$.str = cat2_str(make1_str("do"), mm_strdup($<action>$.command));
@@ -5377,7 +5395,7 @@ action : SQL_CONTINUE {
53775395
$<action>$.command =NULL;
53785396
$<action>$.str = make1_str("break");
53795397
}
5380-
|SQL_CALLname'('dotext')' {
5398+
|SQL_CALLname'('c_args')' {
53815399
$<action>$.code = W_DO;
53825400
$<action>$.command = make4_str($2, make1_str("("),$4, make1_str(")"));
53835401
$<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command));
@@ -5726,11 +5744,8 @@ into_list : coutputvariable | into_list ',' coutputvariable;
57265744

57275745
ecpgstart:SQL_START { reset_variables();}
57285746

5729-
dotext:/* empty*/{$$ = make1_str(""); }
5730-
|dotextdo_anything{$$ = make2_str($1,$2); }
5731-
5732-
vartext:var_anything{$$ =$1; }
5733-
|vartextvar_anything {$$ = make2_str($1,$2); }
5747+
c_args:/* empty*/{$$ = make1_str(""); }
5748+
|c_list{$$ =$1; }
57345749

57355750
coutputvariable :cvariableindicator {
57365751
add_variable(&argsresult, find_variable($1), ($2 ==NULL) ? &no_indicator : find_variable($2));
@@ -5754,6 +5769,7 @@ indicator: /* empty */{ $$ = NULL; }
57545769

57555770
ident:IDENT{$$ =$1; }
57565771
|CSTRING{$$ = make3_str(make1_str("\""),$1, make1_str("\"")); };
5772+
57575773
/*
57585774
* C stuff
57595775
*/
@@ -5762,13 +5778,27 @@ symbol: IDENT{ $$ = $1; }
57625778

57635779
cpp_line:CPP_LINE{$$ =$1; }
57645780

5765-
c_line:c_anything {$$ =$1; }
5766-
|c_linec_anything
5767-
{
5768-
$$ = make2_str($1,$2);
5769-
}
5781+
c_stuff:c_anything {$$ =$1; }
5782+
|c_stuffc_anything
5783+
{
5784+
$$ = cat2_str($1,$2);
5785+
}
5786+
|c_stuff'('c_stuff')'
5787+
{
5788+
$$ = cat4_str($1, make1_str("("),$3, make1_str(")"));
5789+
}
5790+
5791+
c_list:c_term{$$ =$1; }
5792+
|c_term','c_list{$$ = make3_str($1, make1_str(","),$3); }
5793+
5794+
c_term:c_stuff {$$ =$1; }
5795+
|'{'c_list'}'{$$ = make3_str(make1_str("{"),$2, make1_str("}")); }
57705796

5771-
c_thing:c_anything|';' {$$ = make1_str(";"); }
5797+
c_thing:c_anything{$$ =$1; }
5798+
|'('{$$ = make1_str("("); }
5799+
|')'{$$ = make1_str(")"); }
5800+
|','{$$ = make1_str(","); }
5801+
|';'{$$ = make1_str(";"); }
57725802

57735803
c_anything:IDENT {$$ =$1; }
57745804
|CSTRING{$$ = make3_str(make1_str("\""),$1, make1_str("\"")); }
@@ -5800,22 +5830,9 @@ c_anything: IDENT { $$ = $1; }
58005830
|S_ANYTHING{$$ = make_name(); }
58015831
|'['{$$ = make1_str("["); }
58025832
|']'{$$ = make1_str("]"); }
5803-
|'('{$$ = make1_str("("); }
5804-
|')'{$$ = make1_str(")"); }
5833+
/*| '('{ $$ = make1_str("("); }
5834+
| ')'{ $$ = make1_str(")"); }*/
58055835
|'='{$$ = make1_str("="); }
5806-
|','{$$ = make1_str(","); }
5807-
5808-
do_anything:IDENT{$$ =$1; }
5809-
|CSTRING {$$ = make3_str(make1_str("\""),$1, make1_str("\""));}
5810-
|Iconst {$$ =$1; }
5811-
|Fconst{$$ =$1; }
5812-
|','{$$ = make1_str(","); }
5813-
5814-
var_anything:IDENT {$$ =$1; }
5815-
|CSTRING {$$ = make3_str(make1_str("\""),$1, make1_str("\"")); }
5816-
|Iconst{$$ =$1; }
5817-
|Fconst{$$ =$1; }
5818-
|'{'c_line'}'{$$ = make3_str(make1_str("{"),$2, make1_str("}")); }
58195836

58205837
blockstart :'{' {
58215838
braces_open++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp