mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
ecpg now accepts array elements as arguments.
This commit is contained in:
parent
450d7e276e
commit
d258fb91cf
@ -1436,6 +1436,11 @@ Tue May 20 11:47:00 CEST 2003
|
||||
Thu May 22 09:33:54 CEST 2003
|
||||
|
||||
- ecpg now recognizes named struct/union usage.
|
||||
|
||||
Fri May 23 11:46:15 CEST 2003
|
||||
|
||||
- Synced parser and keyword table.
|
||||
- ecpg now accepts array elements as input variables.
|
||||
- Set ecpg version to 2.12.0.
|
||||
- Set ecpg library to 3.4.2.
|
||||
- Set pgtypes library to 1.0.0
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.57 2003/05/16 04:59:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.58 2003/05/23 15:19:34 meskes Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,6 +41,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"analyze", ANALYZE},
|
||||
{"and", AND},
|
||||
{"any", ANY},
|
||||
{"array", ARRAY},
|
||||
{"as", AS},
|
||||
{"asc", ASC},
|
||||
{"assertion", ASSERTION},
|
||||
@ -126,6 +127,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"extract", EXTRACT},
|
||||
{"false", FALSE_P},
|
||||
{"fetch", FETCH},
|
||||
{"first", FIRST_P},
|
||||
{"float", FLOAT_P},
|
||||
{"for", FOR},
|
||||
{"force", FORCE},
|
||||
@ -141,6 +143,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"group", GROUP_P},
|
||||
{"handler", HANDLER},
|
||||
{"having", HAVING},
|
||||
{"hold", HOLD},
|
||||
{"hour", HOUR_P},
|
||||
{"ilike", ILIKE},
|
||||
{"immediate", IMMEDIATE},
|
||||
@ -170,6 +173,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"key", KEY},
|
||||
{"lancompiler", LANCOMPILER},
|
||||
{"language", LANGUAGE},
|
||||
{"last", LAST_P},
|
||||
{"leading", LEADING},
|
||||
{"left", LEFT},
|
||||
{"level", LEVEL},
|
||||
@ -241,6 +245,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"rename", RENAME},
|
||||
{"replace", REPLACE},
|
||||
{"reset", RESET},
|
||||
{"restart", RESTART},
|
||||
{"restrict", RESTRICT},
|
||||
{"returns", RETURNS},
|
||||
{"revoke", REVOKE},
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -233,21 +233,81 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
|
||||
break;
|
||||
case ECPGt_struct:
|
||||
case ECPGt_union:
|
||||
ECPGdump_a_struct(o, name, ind_name, type->size, type->u.element, (ind_type->type == ECPGt_NO_INDICATOR) ? ind_type : ind_type->u.element, NULL, prefix, ind_prefix);
|
||||
/* If var_array_element is not equal * NULL, we have to use the * <var_array_element>th entry and not * the whole array */ if (var_array_element == NULL)
|
||||
ECPGdump_a_struct(o, name, ind_name, type->size,
|
||||
type->u.element,
|
||||
(ind_type->type == ECPGt_NO_INDICATOR) ? ind_type : ind_type->u.element,
|
||||
NULL, prefix, ind_prefix);
|
||||
else
|
||||
{
|
||||
char *array_element = (char *)mm_alloc(strlen(name) + strlen(var_array_element) + sizeof("[]\0")), *ind_array_element;
|
||||
|
||||
sprintf(array_element, "%s[%s]", name, var_array_element);
|
||||
|
||||
if (ind_type->type != ECPGt_NO_INDICATOR)
|
||||
{
|
||||
ind_array_element = (char *)mm_alloc(strlen(ind_name) + strlen(ind_array_element) + sizeof("+\0"));
|
||||
sprintf(ind_array_element, "%s[%s]", ind_name, ind_array_element);
|
||||
|
||||
ECPGdump_a_struct(o, array_element, ind_array_element, make_str("1"),
|
||||
type->u.element, ind_type->u.element,
|
||||
NULL, prefix, ind_prefix);
|
||||
free(ind_array_element);
|
||||
}
|
||||
else
|
||||
ECPGdump_a_struct(o, array_element, ind_name, make_str("1"),
|
||||
type->u.element, ind_type,
|
||||
NULL, prefix, ind_prefix);
|
||||
|
||||
free (array_element);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!IS_SIMPLE_TYPE(type->u.element->type))
|
||||
yyerror("Internal error: unknown datatype, please inform pgsql-bugs@postgresql.org");
|
||||
|
||||
ECPGdump_a_simple(o, name, type->u.element->type,
|
||||
/* If var_array_element is not equal
|
||||
* NULL, we have to use the
|
||||
* <var_array_element>th entry and not
|
||||
* the whole array */
|
||||
if (var_array_element == NULL)
|
||||
ECPGdump_a_simple(o, name,
|
||||
type->u.element->type,
|
||||
type->u.element->size, type->size, NULL, prefix);
|
||||
else
|
||||
{
|
||||
char *array_element = (char *)mm_alloc(strlen(name) + strlen(var_array_element) + sizeof("+\0"));
|
||||
|
||||
sprintf(array_element, "%s+%s", name, var_array_element);
|
||||
ECPGdump_a_simple(o, array_element,
|
||||
type->u.element->type,
|
||||
type->u.element->size, make_str("1"), NULL, prefix);
|
||||
free(array_element);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (ind_type != NULL)
|
||||
{
|
||||
if (ind_type->type == ECPGt_NO_INDICATOR)
|
||||
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
|
||||
else
|
||||
ECPGdump_a_simple(o, ind_name, ind_type->u.element->type,
|
||||
ind_type->u.element->size, ind_type->size, NULL, prefix);
|
||||
{
|
||||
if (ind_array_element == NULL)
|
||||
ECPGdump_a_simple(o, ind_name, ind_type->u.element->type,
|
||||
ind_type->u.element->size, ind_type->size, NULL, prefix);
|
||||
else
|
||||
{
|
||||
char *array_element = (char *)mm_alloc(strlen(ind_name) + strlen(ind_array_element) + sizeof("+\0"));
|
||||
|
||||
sprintf(array_element, "%s+%s", ind_name, ind_array_element);
|
||||
ECPGdump_a_simple(o, array_element,
|
||||
ind_type->u.element->type,
|
||||
ind_type->u.element->size,
|
||||
make_str("1"), NULL, prefix);
|
||||
free(array_element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user