Commit f0212ced authored by Michael Meskes's avatar Michael Meskes

- Synced preproc.y with gram.y.

- Synced pgc.l with scan.l.
- Synced keyword.c.
- Include the remaining patches by Christof Petig <christof.petig@wtal.de>.
parent 3baf7400
...@@ -1084,10 +1084,17 @@ Wed Jun 13 14:39:12 CEST 2001 ...@@ -1084,10 +1084,17 @@ Wed Jun 13 14:39:12 CEST 2001
- Synced preproc.y with gram.y. - Synced preproc.y with gram.y.
- Applied bug fix by John Summerfield. - Applied bug fix by John Summerfield.
- Set ecpg version to 2.9.0.
- Set library version to 3.3.0.
Son Aug 19 11:04:39 CEST 2001 Son Aug 19 11:04:39 CEST 2001
- Synced preproc.y with gram.y. - Synced preproc.y with gram.y.
- Include some patches by Christof Petig <christof.petig@wtal.de>. - Include some patches by Christof Petig <christof.petig@wtal.de>.
Wed Sep 19 15:57:49 CEST 2001
- Synced preproc.y with gram.y.
- Synced pgc.l with scan.l.
- Synced keyword.c.
- Include the remaining patches by Christof Petig <christof.petig@wtal.de>.
- Set ecpg version to 2.9.0.
- Set library version to 3.3.0.
...@@ -46,7 +46,8 @@ extern "C" ...@@ -46,7 +46,8 @@ extern "C"
ECPGt_EOIT, /* End of insert types. */ ECPGt_EOIT, /* End of insert types. */
ECPGt_EORT, /* End of result types. */ ECPGt_EORT, /* End of result types. */
ECPGt_NO_INDICATOR, /* no indicator */ ECPGt_NO_INDICATOR, /* no indicator */
ECPGt_long_long, ECPGt_unsigned_long_long ECPGt_long_long, ECPGt_unsigned_long_long,
ECPGt_descriptor /* sql descriptor, no C variable */
}; };
/* descriptor items */ /* descriptor items */
...@@ -71,7 +72,7 @@ extern "C" ...@@ -71,7 +72,7 @@ extern "C"
ECPGd_EODT /* End of descriptor types. */ ECPGd_EODT /* End of descriptor types. */
}; };
#define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_varchar2) || (type)>=ECPGt_long_long) #define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_varchar2) || ((type)>=ECPGt_long_long && (type) <= ECPGt_unsigned_long_long))
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de> * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* *
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/include/sql3types.h,v 1.4 2000/04/12 17:17:01 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/include/sql3types.h,v 1.5 2001/09/19 14:09:32 meskes Exp $
*/ */
/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */ /* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.12 2001/05/11 01:46:33 momjian Exp $ # $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.13 2001/09/19 14:09:32 meskes Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.11 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.12 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.14 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.15 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.15 2001/08/24 14:07:49 petere Exp $ */ /* dynamic SQL support routines
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.16 2001/09/19 14:09:32 meskes Exp $
*/
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -8,27 +11,15 @@ ...@@ -8,27 +11,15 @@
#include "extern.h" #include "extern.h"
#include "sql3types.h" #include "sql3types.h"
struct descriptor struct descriptor *all_descriptors = NULL;
{
char *name;
PGresult *result;
struct descriptor *next;
} *all_descriptors = NULL;
/* old internal convenience function that might go away later */
static PGresult static PGresult
* *
ECPGresultByDescriptor(int line, const char *name) ECPGresultByDescriptor(int line, const char *name)
{ {
struct descriptor *i; PGresult **resultpp = ECPGdescriptor_lvalue ( line, name );
if (resultpp) return *resultpp;
for (i = all_descriptors; i != NULL; i = i->next)
{
if (!strcmp(name, i->name))
return i->result;
}
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, name);
return NULL; return NULL;
} }
...@@ -373,3 +364,18 @@ ECPGallocate_desc(int line, const char *name) ...@@ -373,3 +364,18 @@ ECPGallocate_desc(int line, const char *name)
all_descriptors = new; all_descriptors = new;
return true; return true;
} }
PGresult **
ECPGdescriptor_lvalue(int line, const char *descriptor)
{
struct descriptor *i;
for (i = all_descriptors; i != NULL; i = i->next)
{
if (!strcmp(descriptor, i->name))
return &i->result;
}
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, (char *) descriptor);
return NULL;
}
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.9 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.10 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.22 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.23 2001/09/19 14:09:32 meskes Exp $ */
/* /*
* The aim is to get a simpler inteface to the database routines. * The aim is to get a simpler inteface to the database routines.
...@@ -817,6 +817,7 @@ ECPGexecute(struct statement * stmt) ...@@ -817,6 +817,7 @@ ECPGexecute(struct statement * stmt)
* it should go into a separate function * it should go into a separate function
*/ */
{ {
bool clear_result = TRUE;
var = stmt->outlist; var = stmt->outlist;
switch (PQresultStatus(results)) switch (PQresultStatus(results))
{ {
...@@ -840,7 +841,19 @@ ECPGexecute(struct statement * stmt) ...@@ -840,7 +841,19 @@ ECPGexecute(struct statement * stmt)
break; break;
} }
for (act_field = 0; act_field < nfields && status; act_field++) if (var != NULL && var->type==ECPGt_descriptor)
{ PGresult **resultpp = ECPGdescriptor_lvalue(stmt->lineno, (const char*)var->pointer);
if (resultpp == NULL) status = false;
else
{ if (*resultpp)
PQclear(*resultpp);
*resultpp=results;
clear_result = FALSE;
ECPGlog("ECPGexecute putting result into descriptor '%s'\n", (const char*)var->pointer);
}
var = var->next;
}
else for (act_field = 0; act_field < nfields && status; act_field++)
{ {
if (var == NULL) if (var == NULL)
{ {
...@@ -972,7 +985,7 @@ ECPGexecute(struct statement * stmt) ...@@ -972,7 +985,7 @@ ECPGexecute(struct statement * stmt)
status = false; status = false;
break; break;
} }
PQclear(results); if (clear_result) PQclear(results);
} }
/* check for asynchronous returns */ /* check for asynchronous returns */
...@@ -1032,186 +1045,12 @@ ECPGdo(int lineno, const char *connection_name, char *query,...) ...@@ -1032,186 +1045,12 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
return (status); return (status);
} }
/* dynamic SQL support routines /* old descriptor interface */
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.22 2001/08/24 14:07:49 petere Exp $
*/
PGconn *ECPG_internal_get_connection(char *name);
extern struct descriptor
{
char *name;
PGresult *result;
struct descriptor *next;
} *all_descriptors;
/* like ECPGexecute */
static bool
execute_descriptor(int lineno, const char *query
,struct connection * con, PGresult **resultptr)
{
bool status = false;
PGresult *results;
PGnotify *notify;
/* Now the request is built. */
if (con->committed && !con->autocommit)
{
if ((results = PQexec(con->connection, "begin transaction")) == NULL)
{
ECPGraise(lineno, ECPG_TRANS, NULL);
return false;
}
PQclear(results);
con->committed = false;
}
ECPGlog("execute_descriptor line %d: QUERY: %s on connection %s\n", lineno, query, con->name);
results = PQexec(con->connection, query);
if (results == NULL)
{
ECPGlog("ECPGexecute line %d: error: %s", lineno,
PQerrorMessage(con->connection));
ECPGraise(lineno, ECPG_PGSQL, PQerrorMessage(con->connection));
}
else
{
*resultptr = results;
switch (PQresultStatus(results))
{
int ntuples;
case PGRES_TUPLES_OK:
status = true;
sqlca.sqlerrd[2] = ntuples = PQntuples(results);
if (ntuples < 1)
{
ECPGlog("execute_descriptor line %d: Incorrect number of matches: %d\n",
lineno, ntuples);
ECPGraise(lineno, ECPG_NOT_FOUND, NULL);
status = false;
break;
}
break;
#if 1 /* strictly these are not needed (yet) */
case PGRES_EMPTY_QUERY:
/* do nothing */
ECPGraise(lineno, ECPG_EMPTY, NULL);
break;
case PGRES_COMMAND_OK:
status = true;
sqlca.sqlerrd[1] = PQoidValue(results);
sqlca.sqlerrd[2] = atol(PQcmdTuples(results));
ECPGlog("ECPGexecute line %d Ok: %s\n", lineno, PQcmdStatus(results));
break;
case PGRES_COPY_OUT:
ECPGlog("ECPGexecute line %d: Got PGRES_COPY_OUT ... tossing.\n", lineno);
PQendcopy(con->connection);
break;
case PGRES_COPY_IN:
ECPGlog("ECPGexecute line %d: Got PGRES_COPY_IN ... tossing.\n", lineno);
PQendcopy(con->connection);
break;
#else
case PGRES_EMPTY_QUERY:
case PGRES_COMMAND_OK:
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
break;
#endif
case PGRES_NONFATAL_ERROR:
case PGRES_FATAL_ERROR:
case PGRES_BAD_RESPONSE:
ECPGlog("ECPGexecute line %d: Error: %s",
lineno, PQerrorMessage(con->connection));
ECPGraise(lineno, ECPG_PGSQL, PQerrorMessage(con->connection));
status = false;
break;
default:
ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
lineno);
ECPGraise(lineno, ECPG_PGSQL, PQerrorMessage(con->connection));
status = false;
break;
}
}
/* check for asynchronous returns */
notify = PQnotifies(con->connection);
if (notify)
{
ECPGlog("ECPGexecute line %d: ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
lineno, notify->relname, notify->be_pid);
free(notify);
}
return status;
}
/* like ECPGdo */
static bool
do_descriptor2(int lineno, const char *connection_name,
PGresult **resultptr, const char *query)
{
struct connection *con = get_connection(connection_name);
bool status = true;
char *locale = setlocale(LC_NUMERIC, NULL);
/* Make sure we do NOT honor the locale for numeric input/output */
/* since the database wants teh standard decimal point */
setlocale(LC_NUMERIC, "C");
if (!ecpg_init(con, connection_name, lineno))
{
setlocale(LC_NUMERIC, locale);
return (false);
}
/* are we connected? */
if (con == NULL || con->connection == NULL)
{
ECPGlog("do_descriptor2: not connected to %s\n", con->name);
ECPGraise(lineno, ECPG_NOT_CONN, NULL);
setlocale(LC_NUMERIC, locale);
return false;
}
status = execute_descriptor(lineno, query, con, resultptr);
/* and reset locale value so our application is not affected */
setlocale(LC_NUMERIC, locale);
return (status);
}
bool bool
ECPGdo_descriptor(int line, const char *connection, ECPGdo_descriptor(int line, const char *connection,
const char *descriptor, const char *query) const char *descriptor, const char *query)
{ {
struct descriptor *i; return ECPGdo(line, connection, (char *)query, ECPGt_EOIT,
ECPGt_descriptor, descriptor, 0L, 0L, 0L,
for (i = all_descriptors; i != NULL; i = i->next) ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
{
if (!strcmp(descriptor, i->name))
{
bool status;
/* free previous result */
if (i->result)
PQclear(i->result);
i->result = NULL;
status = do_descriptor2(line, connection, &i->result, query);
if (!i->result)
PQmakeEmptyPGresult(NULL, 0);
return (status);
}
}
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, (char *) descriptor);
return false;
} }
...@@ -52,3 +52,14 @@ struct connection ...@@ -52,3 +52,14 @@ struct connection
struct ECPGtype_information_cache *cache_head; struct ECPGtype_information_cache *cache_head;
struct connection *next; struct connection *next;
}; };
/* structure to store descriptors */
struct descriptor
{
char *name;
PGresult *result;
struct descriptor *next;
};
PGresult **
ECPGdescriptor_lvalue(int line, const char *descriptor);
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/memory.c,v 1.4 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/memory.c,v 1.5 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/misc.c,v 1.4 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/misc.c,v 1.5 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/prepare.c,v 1.6 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/prepare.c,v 1.7 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/typename.c,v 1.18 2001/08/24 14:07:49 petere Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/typename.c,v 1.19 2001/09/19 14:09:32 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.76 2001/05/12 19:49:48 petere Exp $ # $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.77 2001/09/19 14:09:32 meskes Exp $
subdir = src/interfaces/ecpg/preproc subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../.. top_builddir = ../../../..
......
...@@ -196,3 +196,24 @@ output_get_descr(char *desc_name, char *index) ...@@ -196,3 +196,24 @@ output_get_descr(char *desc_name, char *index)
whenever_action(2 | 1); whenever_action(2 | 1);
} }
/* I consider dynamic allocation overkill since at most two descriptor
variables are possible per statement. (input and output descriptor)
And descriptors are no normal variables, so they don't belong into
the variable list.
*/
#define MAX_DESCRIPTOR_NAMELEN 128
struct variable *descriptor_variable(const char *name,int input)
{ static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
static const struct ECPGtype descriptor_type =
{ ECPGt_descriptor, 0 };
static const struct variable varspace[2] =
{{ descriptor_names[0], (struct ECPGtype*)&descriptor_type, 0, NULL },
{ descriptor_names[1], (struct ECPGtype*)&descriptor_type, 0, NULL }
};
strncpy(descriptor_names[input],name,MAX_DESCRIPTOR_NAMELEN);
descriptor_names[input][MAX_DESCRIPTOR_NAMELEN-1]=0;
return (struct variable*)&varspace[input];
}
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.48 2001/08/28 02:47:18 tgl Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.49 2001/09/19 14:09:32 meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */ /* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */ /* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* lexical token lookup for reserved words in postgres embedded SQL * lexical token lookup for reserved words in postgres embedded SQL
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.24 2001/08/19 09:21:44 meskes Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.25 2001/09/19 14:09:32 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
...@@ -48,7 +48,7 @@ extern const char *get_dtype(enum ECPGdtype); ...@@ -48,7 +48,7 @@ extern const char *get_dtype(enum ECPGdtype);
extern void lex_init(void); extern void lex_init(void);
extern char *make_str(const char *); extern char *make_str(const char *);
extern void output_line_number(void); extern void output_line_number(void);
extern void output_statement(char *, int, char *, char *); extern void output_statement(char *, int, char *);
extern void output_simple_statement(char *); extern void output_simple_statement(char *);
extern char *hashline_number(void); extern char *hashline_number(void);
extern int yyparse(void); extern int yyparse(void);
...@@ -67,6 +67,7 @@ extern void whenever_action(int); ...@@ -67,6 +67,7 @@ extern void whenever_action(int);
extern void add_descriptor(char *, char *); extern void add_descriptor(char *, char *);
extern void drop_descriptor(char *, char *); extern void drop_descriptor(char *, char *);
extern struct descriptor *lookup_descriptor(char *, char *); extern struct descriptor *lookup_descriptor(char *, char *);
extern struct variable *descriptor_variable(const char *name,int input);
extern void add_variable(struct arguments **, struct variable *, struct variable *); extern void add_variable(struct arguments **, struct variable *, struct variable *);
extern void append_variable(struct arguments **, struct variable *, struct variable *); extern void append_variable(struct arguments **, struct variable *, struct variable *);
extern void dump_variables(struct arguments *, int); extern void dump_variables(struct arguments *, int);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.43 2001/08/16 20:38:55 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.44 2001/09/19 14:09:32 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -102,6 +102,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -102,6 +102,7 @@ static ScanKeyword ScanKeywords[] = {
{"each", EACH}, {"each", EACH},
{"else", ELSE}, {"else", ELSE},
{"encoding", ENCODING}, {"encoding", ENCODING},
{"encrypted", ENCRYPTED},
{"end", END_TRANS}, {"end", END_TRANS},
{"escape", ESCAPE}, {"escape", ESCAPE},
{"except", EXCEPT}, {"except", EXCEPT},
...@@ -261,6 +262,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -261,6 +262,7 @@ static ScanKeyword ScanKeywords[] = {
{"truncate", TRUNCATE}, {"truncate", TRUNCATE},
{"trusted", TRUSTED}, {"trusted", TRUSTED},
{"type", TYPE_P}, {"type", TYPE_P},
{"unencrypted", UNENCRYPTED},
{"union", UNION}, {"union", UNION},
{"unique", UNIQUE}, {"unique", UNIQUE},
{"unknown", UNKNOWN}, {"unknown", UNKNOWN},
......
...@@ -103,16 +103,12 @@ hashline_number(void) ...@@ -103,16 +103,12 @@ hashline_number(void)
} }
void void
output_statement(char *stmt, int mode, char *descriptor, char *con) output_statement(char *stmt, int mode, char *con)
{ {
int i, int i,
j = strlen(stmt); j = strlen(stmt);
if (descriptor == NULL) fprintf(yyout, "{ ECPGdo(__LINE__, %s, \"", con ? con : "NULL");
fprintf(yyout, "{ ECPGdo(__LINE__, %s, \"", con ? con : "NULL");
else
fprintf(yyout, "{ ECPGdo_descriptor(__LINE__, %s, %s, \"",
con ? con : "NULL", descriptor);
/* do this char by char as we have to filter '\"' */ /* do this char by char as we have to filter '\"' */
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
...@@ -123,25 +119,18 @@ output_statement(char *stmt, int mode, char *descriptor, char *con) ...@@ -123,25 +119,18 @@ output_statement(char *stmt, int mode, char *descriptor, char *con)
fputs("\\\"", yyout); fputs("\\\"", yyout);
} }
if (descriptor == NULL) fputs("\", ", yyout);
{
fputs("\", ", yyout); /* dump variables to C file */
dump_variables(argsinsert, 1);
/* dump variables to C file */ fputs("ECPGt_EOIT, ", yyout);
dump_variables(argsinsert, 1); dump_variables(argsresult, 1);
fputs("ECPGt_EOIT, ", yyout); fputs("ECPGt_EORT);", yyout);
dump_variables(argsresult, 1); reset_variables();
fputs("ECPGt_EORT);", yyout);
reset_variables();
}
else
fputs("\");", yyout);
mode |= 2; mode |= 2;
whenever_action(mode); whenever_action(mode);
free(stmt); free(stmt);
if (descriptor != NULL)
free(descriptor);
if (connection != NULL) if (connection != NULL)
free(connection); free(connection);
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.80 2001/09/07 23:17:14 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.81 2001/09/19 14:09:32 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
This diff is collapsed.
...@@ -169,6 +169,9 @@ get_type(enum ECPGttype typ) ...@@ -169,6 +169,9 @@ get_type(enum ECPGttype typ)
* quoted */ * quoted */
return ("ECPGt_char_variable"); return ("ECPGt_char_variable");
break; break;
case ECPGt_descriptor:
return ("ECPGt_descriptor");
break;
default: default:
sprintf(errortext, "illegal variable type %d\n", typ); sprintf(errortext, "illegal variable type %d\n", typ);
yyerror(errortext); yyerror(errortext);
...@@ -252,6 +255,10 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *in ...@@ -252,6 +255,10 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *in
ECPGdump_a_simple(o, name, typ->typ, 1, 1, NULL, prefix); ECPGdump_a_simple(o, name, typ->typ, 1, 1, NULL, prefix);
ECPGdump_a_simple(o, ind_name, ind_typ->typ, ind_typ->size, -1, NULL, ind_prefix); ECPGdump_a_simple(o, ind_name, ind_typ->typ, ind_typ->size, -1, NULL, ind_prefix);
break; break;
case ECPGt_descriptor:
ECPGdump_a_simple(o, name, typ->typ, 0, -1, NULL, prefix);
ECPGdump_a_simple(o, ind_name, ind_typ->typ, ind_typ->size, -1, NULL, ind_prefix);
break;
default: default:
ECPGdump_a_simple(o, name, typ->typ, typ->size, -1, NULL, prefix); ECPGdump_a_simple(o, name, typ->typ, typ->size, -1, NULL, prefix);
if (ind_typ != NULL) if (ind_typ != NULL)
...@@ -273,6 +280,9 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ, ...@@ -273,6 +280,9 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ,
{ {
if (typ == ECPGt_NO_INDICATOR) if (typ == ECPGt_NO_INDICATOR)
fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, "); fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
else if (typ == ECPGt_descriptor)
/* remember that name here already contains quotes (if needed) */
fprintf(o, "\n\tECPGt_descriptor, %s, 0L, 0L, 0L, ", name);
else else
{ {
char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4); char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment