mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03: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
|
Thu May 22 09:33:54 CEST 2003
|
||||||
|
|
||||||
- ecpg now recognizes named struct/union usage.
|
- 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 version to 2.12.0.
|
||||||
- Set ecpg library to 3.4.2.
|
- Set ecpg library to 3.4.2.
|
||||||
- Set pgtypes library to 1.0.0
|
- Set pgtypes library to 1.0.0
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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},
|
{"analyze", ANALYZE},
|
||||||
{"and", AND},
|
{"and", AND},
|
||||||
{"any", ANY},
|
{"any", ANY},
|
||||||
|
{"array", ARRAY},
|
||||||
{"as", AS},
|
{"as", AS},
|
||||||
{"asc", ASC},
|
{"asc", ASC},
|
||||||
{"assertion", ASSERTION},
|
{"assertion", ASSERTION},
|
||||||
@ -126,6 +127,7 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
{"extract", EXTRACT},
|
{"extract", EXTRACT},
|
||||||
{"false", FALSE_P},
|
{"false", FALSE_P},
|
||||||
{"fetch", FETCH},
|
{"fetch", FETCH},
|
||||||
|
{"first", FIRST_P},
|
||||||
{"float", FLOAT_P},
|
{"float", FLOAT_P},
|
||||||
{"for", FOR},
|
{"for", FOR},
|
||||||
{"force", FORCE},
|
{"force", FORCE},
|
||||||
@ -141,6 +143,7 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
{"group", GROUP_P},
|
{"group", GROUP_P},
|
||||||
{"handler", HANDLER},
|
{"handler", HANDLER},
|
||||||
{"having", HAVING},
|
{"having", HAVING},
|
||||||
|
{"hold", HOLD},
|
||||||
{"hour", HOUR_P},
|
{"hour", HOUR_P},
|
||||||
{"ilike", ILIKE},
|
{"ilike", ILIKE},
|
||||||
{"immediate", IMMEDIATE},
|
{"immediate", IMMEDIATE},
|
||||||
@ -170,6 +173,7 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
{"key", KEY},
|
{"key", KEY},
|
||||||
{"lancompiler", LANCOMPILER},
|
{"lancompiler", LANCOMPILER},
|
||||||
{"language", LANGUAGE},
|
{"language", LANGUAGE},
|
||||||
|
{"last", LAST_P},
|
||||||
{"leading", LEADING},
|
{"leading", LEADING},
|
||||||
{"left", LEFT},
|
{"left", LEFT},
|
||||||
{"level", LEVEL},
|
{"level", LEVEL},
|
||||||
@ -241,6 +245,7 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
{"rename", RENAME},
|
{"rename", RENAME},
|
||||||
{"replace", REPLACE},
|
{"replace", REPLACE},
|
||||||
{"reset", RESET},
|
{"reset", RESET},
|
||||||
|
{"restart", RESTART},
|
||||||
{"restrict", RESTRICT},
|
{"restrict", RESTRICT},
|
||||||
{"returns", RETURNS},
|
{"returns", RETURNS},
|
||||||
{"revoke", REVOKE},
|
{"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;
|
break;
|
||||||
case ECPGt_struct:
|
case ECPGt_struct:
|
||||||
case ECPGt_union:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!IS_SIMPLE_TYPE(type->u.element->type))
|
if (!IS_SIMPLE_TYPE(type->u.element->type))
|
||||||
yyerror("Internal error: unknown datatype, please inform pgsql-bugs@postgresql.org");
|
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);
|
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 != NULL)
|
||||||
{
|
{
|
||||||
if (ind_type->type == ECPGt_NO_INDICATOR)
|
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);
|
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
|
||||||
else
|
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;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user