Skip to content

Commit 776d530

Browse files
author
Michael Meskes
committed
Create a real prototype function for describe.
1 parent a0fed29 commit 776d530

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
return NULL;
449449
}
450+
451+
bool
452+
ECPGdescribe(int line, bool input, const char *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 @@ void ECPGraise(int line, int code, const char *str);
7272
bool ECPGget_desc_header(int, char *, int *);
7373
bool ECPGget_desc(int, char *, int,...);
7474

75+
bool ECPGdescribe(int, bool, const char *, ...);
76+
7577
/* dynamic result allocation */
7678
void ECPGfree_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
int i,
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/30 08:39:01 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.227 2003/05/30 13:22:02 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -438,18 +438,17 @@ create_questionmarks(char *name, bool array)
438438
%type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
439439
%type <str> struct_union_type s_struct_union vt_declarations
440440
%type <str> var_declaration type_declaration single_vt_declaration
441-
%type <str> ECPGSetAutocommit on_off variable_declarations
441+
%type <str> ECPGSetAutocommit on_off variable_declarations ECPGDescribe
442442
%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_output
443443
%type <str> ECPGGetDescriptorHeader ECPGColLabel single_var_declaration
444444
%type <str> reserved_keyword unreserved_keyword ecpg_interval
445445
%type <str> col_name_keyword func_name_keyword precision opt_scale
446446
%type <str> ECPGTypeName variablelist ECPGColLabelCommon c_variable
447-
%type <str> inf_val_list inf_col_list using_descriptor ECPGDescribe
448-
%type <str> into_descriptor
447+
%type <str> inf_val_list inf_col_list using_descriptor into_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_type signed_type unsigned_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_DESCRIBE INPUT_P name using_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_DESCRIBE opt_output name using_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_DESCRIBE opt_output name into_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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy