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

Commit65058fc

Browse files
author
Michael Meskes
committed
Fixed some bugs.
1 parent412893b commit65058fc

File tree

3 files changed

+110
-74
lines changed

3 files changed

+110
-74
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,10 @@ Fri May 30 15:19:39 CEST 2003
14731473
Mon Jun 2 17:36:03 CEST 2003
14741474

14751475
- Fixed segfault in forward definition parsing.
1476+
1477+
Tue Jun 10 19:43:49 CEST 2003
1478+
1479+
- Fixed several small bugs.
14761480
- Set ecpg version to 2.12.0.
14771481
- Set ecpg library to 3.4.2.
14781482
- Set pgtypes library to 1.0.0

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,24 @@ static ScanKeyword ScanKeywords[] = {
2828
{"enum",SQL_ENUM},
2929
{"extern",S_EXTERN},
3030
{"float",FLOAT_P},
31+
{"hour",HOUR_P},
3132
{"int",INT_P},
3233
{"long",SQL_LONG},
34+
{"minute",MINUTE_P},
35+
{"month",MONTH_P},
3336
{"register",S_REGISTER},
37+
{"second",SECOND_P},
3438
{"short",SQL_SHORT},
3539
{"signed",SQL_SIGNED},
3640
{"static",S_STATIC},
3741
{"struct",SQL_STRUCT},
42+
{"to",TO},
3843
{"typedef",S_TYPEDEF},
3944
{"union",UNION},
4045
{"unsigned",SQL_UNSIGNED},
4146
{"varchar",VARCHAR},
4247
{"volatile",S_VOLATILE},
48+
{"year",YEAR_P},
4349
};
4450

4551
ScanKeyword*

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

Lines changed: 100 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.228 2003/06/02 15:38:02 meskes Exp $*/
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.229 2003/06/10 17:46:43 meskes Exp $*/
22

33
/* Copyright comment*/
44
%{
@@ -47,7 +47,15 @@ static struct inf_compat_val
4747
char *val;
4848
structinf_compat_val *next;
4949
} *informix_val;
50-
50+
51+
voidmm(void)
52+
{
53+
int i,j;
54+
55+
i=1;
56+
j=i+1;
57+
}
58+
5159
/*
5260
* Handle parsing errors and warnings
5361
*/
@@ -367,7 +375,7 @@ create_questionmarks(char *name, bool array)
367375
%type<str>copy_delimiterListenStmtCopyStmtcopy_file_nameopt_binary
368376
%type<str>FetchStmtfrom_inCreateOpClassStmt
369377
%type<str>ClosePortalStmtDropStmtVacuumStmtAnalyzeStmtopt_verbose
370-
%type<str>opt_fullfunc_argOptWithOidsopt_freezeopt_ecpg_into
378+
%type<str>opt_fullfunc_argOptWithOidsopt_freeze
371379
%type<str>analyze_keywordopt_name_listExplainStmtindex_params
372380
%type<str>index_elemopt_classaccess_method_clause
373381
%type<str>index_opt_uniqueIndexStmtfunc_returnConstInterval
@@ -424,7 +432,7 @@ create_questionmarks(char *name, bool array)
424432
%type<str>opt_sort_clausetransaction_access_mode
425433

426434
%type<str>ECPGWheneverECPGConnectconnection_targetECPGOpen
427-
%type<str>indicatorECPGExecuteECPGPrepareopt_ecpg_usingecpg_into
435+
%type<str>indicatorECPGExecuteECPGPrepareecpg_usingecpg_into
428436
%type<str>storage_declarationstorage_clauseopt_initializerc_anything
429437
%type<str>variable_listvariablec_thingc_termECPGKeywords_vanames
430438
%type<str>opt_pointerECPGDisconnectdis_namestorage_modifier
@@ -433,18 +441,19 @@ create_questionmarks(char *name, bool array)
433441
%type<str>user_nameopt_userchar_variableora_useridentopt_reference
434442
%type<str>var_type_declarationsquoted_ident_stringvarECPGKeywords_rest
435443
%type<str>db_prefixserveropt_optionsopt_connection_namec_list
436-
%type<str>ECPGSetConnectionECPGTypedefc_argsECPGKeywords
444+
%type<str>ECPGSetConnectionECPGTypedefc_argsECPGKeywords
437445
%type<str>enum_typecivarcivarindECPGCursorStmtECPGDeallocate
438446
%type<str>ECPGFreeECPGDeclareECPGVaropt_atenum_definition
439-
%type<str>struct_union_types_struct_unionvt_declarations
447+
%type<str>struct_union_types_struct_unionvt_declarationsexecute_rest
440448
%type<str>var_declarationtype_declarationsingle_vt_declaration
441449
%type<str>ECPGSetAutocommiton_offvariable_declarationsECPGDescribe
442450
%type<str>ECPGAllocateDescrECPGDeallocateDescrsymbolopt_output
443451
%type<str>ECPGGetDescriptorHeaderECPGColLabelsingle_var_declaration
444-
%type<str>reserved_keywordunreserved_keywordecpg_interval
452+
%type<str>reserved_keywordunreserved_keywordecpg_intervalopt_ecpg_using
445453
%type<str>col_name_keywordfunc_name_keywordprecisionopt_scale
446-
%type<str>ECPGTypeNamevariablelistECPGColLabelCommonc_variable
454+
%type<str>ECPGTypeNameusing_listECPGColLabelCommon
447455
%type<str>inf_val_listinf_col_listusing_descriptorinto_descriptor
456+
%type<str>ecpg_into_using
448457

449458
%type<struct_union>s_struct_union_symbol
450459

@@ -664,6 +673,7 @@ stmt: AlterDatabaseSetStmt{ output_statement($1, 0, connection); }
664673
structcursor *ptr;
665674
structarguments *p;
666675

676+
mm();
667677
for (ptr = cur; ptr !=NULL; ptr=ptr->next)
668678
{
669679
if (strcmp(ptr->name,$1) ==0)
@@ -1729,9 +1739,9 @@ TruncateStmt: TRUNCATE opt_table qualified_name
17291739
*
17301740
*****************************************************************************/
17311741

1732-
FetchStmt:FETCHfetch_directionfrom_innameecpg_into
1742+
FetchStmt:FETCHfetch_directionfrom_innameecpg_into_using
17331743
{$$ = cat_str(4, make_str("fetch"),$2,$3,$4); }
1734-
|FETCHnameecpg_into
1744+
|FETCHnameecpg_into_using
17351745
{$$ = cat2_str(make_str("fetch"),$2); }
17361746
|MOVEfetch_directionfrom_inname
17371747
{$$ = cat_str(4, make_str("move"),$2,$3,$4); }
@@ -2622,6 +2632,7 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
26222632
this = (structcursor *) mm_alloc(sizeof(structcursor));
26232633

26242634
/* initial definition*/
2635+
mm();
26252636
this->next = cur;
26262637
this->name =$2;
26272638
this->connection = connection;
@@ -2698,7 +2709,7 @@ into_clause: INTO OptTempTableName
26982709
FoundInto =1;
26992710
$$= cat2_str(make_str("into"),$2);
27002711
}
2701-
|ecpg_into{$$ = EMPTY; }
2712+
|ecpg_into_using{$$ = EMPTY; }
27022713
|/*EMPTY*/{$$ = EMPTY; }
27032714
;
27042715

@@ -4333,6 +4344,7 @@ opt_scale:',' NumConst{ $$ = $2; }
43334344

43344345
ecpg_interval:opt_interval{$$ =$1; }
43354346
|YEAR_PTOMINUTE_P{$$ = make_str("year to minute"); }
4347+
|YEAR_PTOSECOND_P{$$ = make_str("year to second"); }
43364348
|DAY_PTODAY_P{$$ = make_str("day to day"); }
43374349
|MONTH_PTOMONTH_P{$$ = make_str("month to month"); }
43384350
;
@@ -5116,12 +5128,19 @@ ECPGExecute : EXECUTE IMMEDIATE execstring
51165128

51175129
add_variable(&argsinsert, thisquery, &no_indicator);
51185130
}
5119-
opt_ecpg_usingopt_ecpg_into
5131+
execute_rest
51205132
{
51215133
$$ = make_str("?");
51225134
}
51235135
;
51245136

5137+
execute_rest:ecpg_usingecpg_into{$$ = EMPTY; }
5138+
|ecpg_intoecpg_using{$$ = EMPTY; }
5139+
|ecpg_using{$$ = EMPTY; }
5140+
|ecpg_into {$$ = EMPTY; }
5141+
|/* EMPTY*/{$$ = EMPTY; }
5142+
;
5143+
51255144
execstring:char_variable
51265145
{$$ =$1; }
51275146
|CSTRING
@@ -5140,7 +5159,10 @@ ECPGFree:SQL_FREE name{ $$ = $2; };
51405159
ECPGOpen:SQL_OPENnameopt_ecpg_using {$$ =$2; };
51415160

51425161
opt_ecpg_using:/*EMPTY*/{$$ = EMPTY; }
5143-
|USINGvariablelist {$$ = EMPTY; }
5162+
|ecpg_using{$$ =$1; }
5163+
;
5164+
5165+
ecpg_using:USINGusing_list {$$ = EMPTY; }
51445166
;
51455167

51465168
using_descriptor:USINGopt_sqlSQL_DESCRIPTORquoted_ident_stringvar
@@ -5159,19 +5181,15 @@ into_descriptor: INTO opt_sql SQL_DESCRIPTOR quoted_ident_stringvar
51595181

51605182
opt_sql:/*EMPTY*/|SQL_SQL;
51615183

5162-
ecpg_into:INTOinto_list{$$ = EMPTY; }
5163-
|into_descriptor{$$ =$1; }
5184+
ecpg_into_using:ecpg_into{$$ = EMPTY; }
51645185
|using_descriptor{$$ =$1; }
51655186
;
51665187

5167-
opt_ecpg_into:/*EMPTY*/{$$ = EMPTY; }
5168-
|INTOinto_list{$$ = EMPTY; }
5188+
ecpg_into:INTOinto_list{$$ = EMPTY; }
51695189
|into_descriptor{$$ =$1; }
51705190
;
5171-
5172-
c_variable:civarind|civar;
5173-
5174-
variablelist:c_variable|c_variable','variablelist;
5191+
5192+
using_list:civar|civar','using_list;
51755193

51765194
/*
51775195
* As long as the prepare statement is not supported by the backend, we will
@@ -5186,19 +5204,22 @@ ECPGPrepare: PREPARE name FROM execstring
51865204
* We accept descibe but do nothing with it so far.
51875205
*/
51885206
ECPGDescribe:SQL_DESCRIBEINPUT_Pnameusing_descriptor
5189-
{
5207+
{
51905208
mmerror(PARSE_ERROR, ET_WARNING,"using unsupported describe statement.\n");
5191-
$$ = cat_str(3, make_str("1, ECPGprepared_statement(\""),$3, make_str("\")"));
5209+
$$ = (char *) mm_alloc(sizeof("1, ECPGprepared_statement(\"\")") + strlen($3));
5210+
sprintf($$,"1, ECPGprepared_statement(\"%s\")", $3);
51925211
}
51935212
|SQL_DESCRIBEopt_outputnameusing_descriptor
51945213
{
51955214
mmerror(PARSE_ERROR, ET_WARNING,"using unsupported describe statement.\n");
5196-
$$ = cat_str(3, make_str("0, ECPGprepared_statement(\""),$3, make_str("\")"));
5215+
$$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(\"\")") + strlen($3));
5216+
sprintf($$,"0, ECPGprepared_statement(\"%s\")", $3);
51975217
}
51985218
|SQL_DESCRIBEopt_outputnameinto_descriptor
51995219
{
52005220
mmerror(PARSE_ERROR, ET_WARNING,"using unsupported describe statement.\n");
5201-
$$ = cat_str(3, make_str("0, ECPGprepared_statement(\""),$3, make_str("\")"));
5221+
$$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(\"\")") + strlen($3));
5222+
sprintf($$,"0, ECPGprepared_statement(\"%s\")", $3);
52025223
}
52035224
;
52045225

@@ -6076,55 +6097,60 @@ c_thing:c_anything{ $$ = $1; }
60766097
|';'{$$ = make_str(";"); }
60776098
;
60786099

6079-
c_anything:IDENT{$$ =$1; }
6080-
|CSTRING{$$ = make3_str(make_str("\""),$1, make_str("\"")); }
6081-
|Iconst{$$ =$1; }
6082-
|Fconst{$$ =$1; }
6083-
|Sconst{$$ =$1; }
6084-
|'*'{$$ = make_str("*"); }
6085-
|'+'{$$ = make_str("+"); }
6086-
|'-'{$$ = make_str("-"); }
6087-
|'/'{$$ = make_str("/"); }
6088-
|'%'{$$ = make_str("%"); }
6089-
|NULL_P{$$ = make_str("NULL"); }
6090-
|S_ADD{$$ = make_str("+="); }
6091-
|S_AND{$$ = make_str("&&"); }
6092-
|S_ANYTHING{$$ = make_name(); }
6093-
|S_AUTO{$$ = make_str("auto"); }
6094-
|S_CONST{$$ = make_str("const"); }
6095-
|S_DEC{$$ = make_str("--"); }
6096-
|S_DIV{$$ = make_str("/="); }
6097-
|S_DOTPOINT{$$ = make_str(".*"); }
6098-
|S_EQUAL{$$ = make_str("=="); }
6099-
|S_EXTERN{$$ = make_str("extern"); }
6100-
|S_INC{$$ = make_str("++"); }
6101-
|S_LSHIFT{$$ = make_str("<<"); }
6102-
|S_MEMBER{$$ = make_str("->"); }
6103-
|S_MEMPOINT{$$ = make_str("->*"); }
6104-
|S_MOD{$$ = make_str("%="); }
6105-
|S_MUL{$$ = make_str("*="); }
6106-
|S_NEQUAL{$$ = make_str("!="); }
6107-
|S_OR{$$ = make_str("||"); }
6108-
|S_REGISTER{$$ = make_str("register"); }
6109-
|S_RSHIFT{$$ = make_str(">>"); }
6110-
|S_STATIC{$$ = make_str("static"); }
6111-
|S_SUB{$$ = make_str("-="); }
6112-
|S_TYPEDEF{$$ = make_str("typedef"); }
6113-
|SQL_BOOL{$$ = make_str("bool"); }
6114-
|SQL_ENUM{$$ = make_str("enum"); }
6115-
|INT_P{$$ = make_str("int"); }
6116-
|SQL_LONG{$$ = make_str("long"); }
6117-
|SQL_SHORT{$$ = make_str("short"); }
6118-
|SQL_SIGNED{$$ = make_str("signed"); }
6119-
|SQL_STRUCT{$$ = make_str("struct"); }
6120-
|SQL_UNSIGNED{$$ = make_str("unsigned"); }
6121-
|CHAR_P{$$ = make_str("char"); }
6122-
|FLOAT_P{$$ = make_str("float"); }
6123-
|UNION{$$ = make_str("union"); }
6124-
|VARCHAR{$$ = make_str("varchar"); }
6125-
|'['{$$ = make_str("["); }
6126-
|']'{$$ = make_str("]"); }
6127-
|'='{$$ = make_str("="); }
6100+
c_anything:IDENT{$$ =$1; }
6101+
|CSTRING{$$ = make3_str(make_str("\""),$1, make_str("\"")); }
6102+
|Iconst{$$ =$1; }
6103+
|Fconst{$$ =$1; }
6104+
|Sconst{$$ =$1; }
6105+
|'*'{$$ = make_str("*"); }
6106+
|'+'{$$ = make_str("+"); }
6107+
|'-'{$$ = make_str("-"); }
6108+
|'/'{$$ = make_str("/"); }
6109+
|'%'{$$ = make_str("%"); }
6110+
|NULL_P{$$ = make_str("NULL"); }
6111+
|S_ADD{$$ = make_str("+="); }
6112+
|S_AND{$$ = make_str("&&"); }
6113+
|S_ANYTHING{$$ = make_name(); }
6114+
|S_AUTO{$$ = make_str("auto"); }
6115+
|S_CONST{$$ = make_str("const"); }
6116+
|S_DEC{$$ = make_str("--"); }
6117+
|S_DIV{$$ = make_str("/="); }
6118+
|S_DOTPOINT{$$ = make_str(".*"); }
6119+
|S_EQUAL{$$ = make_str("=="); }
6120+
|S_EXTERN{$$ = make_str("extern"); }
6121+
|S_INC{$$ = make_str("++"); }
6122+
|S_LSHIFT{$$ = make_str("<<"); }
6123+
|S_MEMBER{$$ = make_str("->"); }
6124+
|S_MEMPOINT{$$ = make_str("->*"); }
6125+
|S_MOD{$$ = make_str("%="); }
6126+
|S_MUL{$$ = make_str("*="); }
6127+
|S_NEQUAL{$$ = make_str("!="); }
6128+
|S_OR{$$ = make_str("||"); }
6129+
|S_REGISTER{$$ = make_str("register"); }
6130+
|S_RSHIFT{$$ = make_str(">>"); }
6131+
|S_STATIC{$$ = make_str("static"); }
6132+
|S_SUB{$$ = make_str("-="); }
6133+
|S_TYPEDEF{$$ = make_str("typedef"); }
6134+
|SQL_BOOL{$$ = make_str("bool"); }
6135+
|SQL_ENUM{$$ = make_str("enum"); }
6136+
|HOUR_P{$$ = make_str("hour"); }
6137+
|INT_P{$$ = make_str("int"); }
6138+
|SQL_LONG{$$ = make_str("long"); }
6139+
|MINUTE_P{$$ = make_str("minute"); }
6140+
|MONTH_P{$$ = make_str("month"); }
6141+
|SECOND_P{$$ = make_str("second"); }
6142+
|SQL_SHORT{$$ = make_str("short"); }
6143+
|SQL_SIGNED{$$ = make_str("signed"); }
6144+
|SQL_STRUCT{$$ = make_str("struct"); }
6145+
|SQL_UNSIGNED{$$ = make_str("unsigned"); }
6146+
|YEAR_P{$$ = make_str("year"); }
6147+
|CHAR_P{$$ = make_str("char"); }
6148+
|FLOAT_P{$$ = make_str("float"); }
6149+
|UNION{$$ = make_str("union"); }
6150+
|VARCHAR{$$ = make_str("varchar"); }
6151+
|'['{$$ = make_str("["); }
6152+
|']'{$$ = make_str("]"); }
6153+
|'='{$$ = make_str("="); }
61286154
;
61296155

61306156
%%

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp