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

Commit776d530

Browse files
author
Michael Meskes
committed
Create a real prototype function for describe.
1 parenta0fed29 commit776d530

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,10 @@ Fri May 30 10:29:49 CEST 2003
14641464
- Synced parser.
14651465
- Added a dummy rule for EXEC SQL DESCRIBE that throws an error
14661466
message.
1467+
1468+
Fri May 30 15:19:39 CEST 2003
1469+
1470+
- Implemented prototype describe function.
14671471
- Some minor cleanup/bug fixing.
14681472
- Set ecpg version to 2.12.0.
14691473
- Set ecpg library to 3.4.2.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* dynamic SQL support routines
22
*
3-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.1 2003/03/16 10:42:53 meskes Exp $
3+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.2 2003/05/30 13:22:02 meskes Exp $
44
*/
55

66
#include"postgres_fe.h"
@@ -447,3 +447,10 @@ ECPGdescriptor_lvalue(int line, const char *descriptor)
447447
ECPGraise(line,ECPG_UNKNOWN_DESCRIPTOR, (char*)descriptor);
448448
returnNULL;
449449
}
450+
451+
bool
452+
ECPGdescribe(intline,boolinput,constchar*statement, ...)
453+
{
454+
ECPGlog("ECPGdescribe called on line %d for %s in %s\n",line, (input) ?"input" :"output",statement);
455+
return false;
456+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ voidECPGraise(int line, int code, const char *str);
7272
boolECPGget_desc_header(int,char*,int*);
7373
boolECPGget_desc(int,char*,int,...);
7474

75+
boolECPGdescribe(int,bool,constchar*, ...);
76+
7577
/* dynamic result allocation */
7678
voidECPGfree_auto_mem(void);
7779

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ output_simple_statement(char *cmd)
1515
inti,
1616
j=strlen(cmd);;
1717

18-
/*do this char by char as we have to filter '\"' */
18+
/*output this char by char as we have to filter '\"' */
1919
for (i=0;i<j;i++)
2020
{
2121
if (cmd[i]!='"')
@@ -111,7 +111,7 @@ output_statement(char *stmt, int mode, char *con)
111111

112112
fprintf(yyout,"{ ECPGdo(__LINE__, %s, \"",con ?con :"NULL");
113113

114-
/*do this char by char as we have to filter '\"' */
114+
/*output this char by char as we have to filter '\"' */
115115
for (i=0;i<j;i++)
116116
{
117117
if (stmt[i]!='"')

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

Lines changed: 16 additions & 15 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.226 2003/05/3008:39:01 meskes Exp $*/
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.227 2003/05/3013:22:02 meskes Exp $*/
22

33
/* Copyright comment*/
44
%{
@@ -438,18 +438,17 @@ create_questionmarks(char *name, bool array)
438438
%type<str>ECPGFreeECPGDeclareECPGVaropt_atenum_definition
439439
%type<str>struct_union_types_struct_unionvt_declarations
440440
%type<str>var_declarationtype_declarationsingle_vt_declaration
441-
%type<str>ECPGSetAutocommiton_offvariable_declarations
441+
%type<str>ECPGSetAutocommiton_offvariable_declarationsECPGDescribe
442442
%type<str>ECPGAllocateDescrECPGDeallocateDescrsymbolopt_output
443443
%type<str>ECPGGetDescriptorHeaderECPGColLabelsingle_var_declaration
444444
%type<str>reserved_keywordunreserved_keywordecpg_interval
445445
%type<str>col_name_keywordfunc_name_keywordprecisionopt_scale
446446
%type<str>ECPGTypeNamevariablelistECPGColLabelCommonc_variable
447-
%type<str>inf_val_listinf_col_listusing_descriptorECPGDescribe
448-
%type<str>into_descriptor
447+
%type<str>inf_val_listinf_col_listusing_descriptorinto_descriptor
449448

450449
%type<struct_union>s_struct_union_symbol
451450

452-
%type<descriptor>ECPGGetDescriptor
451+
%type<descriptor>ECPGGetDescriptor
453452

454453
%type<type_enum>simple_typesigned_typeunsigned_type
455454

@@ -617,10 +616,12 @@ stmt: AlterDatabaseSetStmt{ output_statement($1, 0, connection); }
617616
}
618617
|ECPGDescribe
619618
{
620-
if (connection)
621-
mmerror(PARSE_ERROR, ET_ERROR,"no at option for describe statement.\n");
622-
623-
fprintf(yyout,"{ /* ECPGdescribe(__LINE__, %s) */;", $1);
619+
fprintf(yyout,"{ ECPGdescribe(__LINE__, %s,", $1);
620+
dump_variables(argsresult,1);
621+
fputs("ECPGt_EORT);", yyout);
622+
fprintf(yyout,"}");
623+
output_line_number();
624+
624625
/* whenever_action(2);*/
625626
free($1);
626627
}
@@ -5186,18 +5187,18 @@ ECPGPrepare: PREPARE name FROM execstring
51865187
*/
51875188
ECPGDescribe:SQL_DESCRIBEINPUT_Pnameusing_descriptor
51885189
{
5189-
mmerror(PARSE_ERROR,ET_ERROR,"using unsupported describe statement.\n");
5190-
$$ = cat_str(3, make_str("input"),$3,$4);
5190+
mmerror(PARSE_ERROR,ET_WARNING,"using unsupported describe statement.\n");
5191+
$$ = cat_str(3, make_str("1, ECPGprepared_statement(\""),$3,make_str("\")"));
51915192
}
51925193
|SQL_DESCRIBEopt_outputnameusing_descriptor
51935194
{
5194-
mmerror(PARSE_ERROR,ET_ERROR,"using unsupported describe statement.\n");
5195-
$$ = cat_str(3,$2,$3,$4);
5195+
mmerror(PARSE_ERROR,ET_WARNING,"using unsupported describe statement.\n");
5196+
$$ = cat_str(3,make_str("0, ECPGprepared_statement(\""),$3,make_str("\")"));
51965197
}
51975198
|SQL_DESCRIBEopt_outputnameinto_descriptor
51985199
{
5199-
mmerror(PARSE_ERROR,ET_ERROR,"using unsupported describe statement.\n");
5200-
$$ = cat_str(3,$2,$3,$4);
5200+
mmerror(PARSE_ERROR,ET_WARNING,"using unsupported describe statement.\n");
5201+
$$ = cat_str(3,make_str("0, ECPGprepared_statement(\""),$3,make_str("\")"));
52015202
}
52025203
;
52035204

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp