mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
- Fixed variable handling for struct members.
- Removed check for array input. An attribut might store the complete array.
This commit is contained in:
parent
4b20cc1032
commit
7138a1e5fc
@ -1201,5 +1201,11 @@ Fri Jan 11 15:43:39 CET 2002
|
||||
|
||||
- clear sqlca on : [de]allocate descriptor & get descriptor and set
|
||||
sqlca.sqlerrd[2] accordingly (Christof).
|
||||
|
||||
Sat Jan 12 22:04:02 CET 2002
|
||||
|
||||
- Fixed variable handling for struct members.
|
||||
- Removed check for array input. An attribut might store the
|
||||
complete array.
|
||||
- Set ecpg version to 2.9.0.
|
||||
- Set library version to 3.3.0.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.35 2002/01/08 14:25:04 meskes Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.36 2002/01/13 08:52:08 meskes Exp $ */
|
||||
|
||||
/*
|
||||
* The aim is to get a simpler inteface to the database routines.
|
||||
@ -486,14 +486,15 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
||||
char *newcopy = NULL;
|
||||
|
||||
/*
|
||||
* arrays are not possible
|
||||
* arrays are not possible unless the attribute is an array too
|
||||
* FIXME: we do not know if the attribute is an array here
|
||||
*/
|
||||
|
||||
if (var->arrsize > 1)
|
||||
|
||||
/* if (var->arrsize > 1 && ...)
|
||||
{
|
||||
ECPGraise(stmt->lineno, ECPG_ARRAY_INSERT, NULL);
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
* Some special treatment is needed for records since we want their
|
||||
|
@ -75,7 +75,7 @@ extern void adjust_array(enum ECPGttype, int *, int *, int, int, int);
|
||||
extern void reset_variables(void);
|
||||
extern void check_indicator(struct ECPGtype *);
|
||||
extern void remove_variables(int);
|
||||
extern struct variable *new_variable(const char *, struct ECPGtype *);
|
||||
extern struct variable *new_variable(const char *, struct ECPGtype *, int);
|
||||
extern ScanKeyword *ScanKeywordLookup(char *text);
|
||||
|
||||
/* return codes */
|
||||
|
@ -4417,7 +4417,7 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_initializer
|
||||
}
|
||||
|
||||
if (struct_level == 0)
|
||||
new_variable($2, type);
|
||||
new_variable($2, type, braces_open);
|
||||
else
|
||||
ECPGmake_struct_member($2, type, &(struct_member_list[struct_level - 1]));
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
struct variable *allvariables = NULL;
|
||||
|
||||
struct variable *
|
||||
new_variable(const char *name, struct ECPGtype * type)
|
||||
new_variable(const char *name, struct ECPGtype * type, int brace_level)
|
||||
{
|
||||
struct variable *p = (struct variable *) mm_alloc(sizeof(struct variable));
|
||||
|
||||
p->name = mm_strdup(name);
|
||||
p->type = type;
|
||||
p->brace_level = braces_open;
|
||||
p->brace_level = brace_level;
|
||||
|
||||
p->next = allvariables;
|
||||
allvariables = p;
|
||||
@ -20,7 +20,7 @@ new_variable(const char *name, struct ECPGtype * type)
|
||||
}
|
||||
|
||||
static struct variable *
|
||||
find_struct_member(char *name, char *str, struct ECPGstruct_member * members)
|
||||
find_struct_member(char *name, char *str, struct ECPGstruct_member * members, int brace_level)
|
||||
{
|
||||
char *next = strchr(++str, '.'),
|
||||
c = '\0';
|
||||
@ -41,12 +41,12 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members)
|
||||
switch (members->type->type)
|
||||
{
|
||||
case ECPGt_array:
|
||||
return (new_variable(name, ECPGmake_array_type(members->type->u.element, members->type->size)));
|
||||
return (new_variable(name, ECPGmake_array_type(members->type->u.element, members->type->size), brace_level));
|
||||
case ECPGt_struct:
|
||||
case ECPGt_union:
|
||||
return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->struct_sizeof)));
|
||||
return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->struct_sizeof), brace_level));
|
||||
default:
|
||||
return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size)));
|
||||
return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size), brace_level));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -55,10 +55,10 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members)
|
||||
if (c == '-')
|
||||
{
|
||||
next++;
|
||||
return (find_struct_member(name, next, members->type->u.element->u.members));
|
||||
return (find_struct_member(name, next, members->type->u.element->u.members, brace_level));
|
||||
}
|
||||
else
|
||||
return (find_struct_member(name, next, members->type->u.members));
|
||||
return (find_struct_member(name, next, members->type->u.members, brace_level));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ find_struct(char *name, char *next)
|
||||
*next = c;
|
||||
next++;
|
||||
|
||||
return find_struct_member(name, next, p->type->u.element->u.members);
|
||||
return find_struct_member(name, next, p->type->u.element->u.members, p->brace_level);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -107,7 +107,7 @@ find_struct(char *name, char *next)
|
||||
/* restore the name, we will need it later on */
|
||||
*next = c;
|
||||
|
||||
return find_struct_member(name, next, p->type->u.members);
|
||||
return find_struct_member(name, next, p->type->u.members, p->brace_level);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <string.h>
|
||||
|
||||
exec sql include sqlca;
|
||||
|
||||
/* just a test comment */ exec sql whenever sqlerror do PrintAndStop(msg);
|
||||
exec sql whenever sqlwarning do warn();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user