mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Fix descriptor output in ECPG.
While working on most platforms the old way sometimes created alignment problems. This should fix it. Also the regresion tests were updated to test for the reported case. Report and fix by MauMau <maumau307@gmail.com> Conflicts: src/interfaces/ecpg/preproc/type.c src/interfaces/ecpg/test/expected/sql-desc.c
This commit is contained in:
@ -324,7 +324,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
|
|||||||
fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
|
fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
|
||||||
else if (type == ECPGt_descriptor)
|
else if (type == ECPGt_descriptor)
|
||||||
/* remember that name here already contains quotes (if needed) */
|
/* remember that name here already contains quotes (if needed) */
|
||||||
fprintf(o, "\n\tECPGt_descriptor, %s, 0L, 0L, 0L, ", name);
|
fprintf(o, "\n\tECPGt_descriptor, %s, 1L, 1L, 1L, ", 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);
|
||||||
|
@ -134,7 +134,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
|
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo1",
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo1",
|
||||||
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "indesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||||
#line 35 "desc.pgc"
|
#line 35 "desc.pgc"
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
|
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo1",
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo1",
|
||||||
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "indesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||||
#line 40 "desc.pgc"
|
#line 40 "desc.pgc"
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
|
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "Foo-1",
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "Foo-1",
|
||||||
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "indesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||||
#line 45 "desc.pgc"
|
#line 45 "desc.pgc"
|
||||||
|
|
||||||
@ -222,9 +222,9 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
|
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo2",
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo2",
|
||||||
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "indesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
|
||||||
ECPGt_descriptor, "outdesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "outdesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||||
#line 52 "desc.pgc"
|
#line 52 "desc.pgc"
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c1 cursor for $1",
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c1 cursor for $1",
|
||||||
ECPGt_char_variable,(ECPGprepared_statement(NULL, "foo2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
|
ECPGt_char_variable,(ECPGprepared_statement(NULL, "foo2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||||
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "indesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||||
#line 58 "desc.pgc"
|
#line 58 "desc.pgc"
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c2 cursor for $1",
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c2 cursor for $1",
|
||||||
ECPGt_char_variable,(ECPGprepared_statement(NULL, "foo3", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
|
ECPGt_char_variable,(ECPGprepared_statement(NULL, "foo3", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||||
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "indesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||||
#line 70 "desc.pgc"
|
#line 70 "desc.pgc"
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );
|
|||||||
#line 41 "dynalloc.pgc"
|
#line 41 "dynalloc.pgc"
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a , b , c , d , e , f , g , h , i from test order by a", ECPGt_EOIT,
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a , b , c , d , e , f , g , h , i from test order by a", ECPGt_EOIT,
|
||||||
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "mydesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||||
#line 42 "dynalloc.pgc"
|
#line 42 "dynalloc.pgc"
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );
|
|||||||
#line 32 "dynalloc2.pgc"
|
#line 32 "dynalloc2.pgc"
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from test", ECPGt_EOIT,
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from test", ECPGt_EOIT,
|
||||||
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
|
ECPGt_descriptor, "mydesc", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||||
#line 33 "dynalloc2.pgc"
|
#line 33 "dynalloc2.pgc"
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch in MYCURS", ECPGt_EOIT,
|
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch in MYCURS", ECPGt_EOIT,
|
||||||
ECPGt_descriptor, "MYDESC", 0L, 0L, 0L,
|
ECPGt_descriptor, "MYDESC", 1L, 1L, 1L,
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||||
#line 64 "dyntest.pgc"
|
#line 64 "dyntest.pgc"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user