mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Fixed bug that caused arrays of varchar to be output with incomplete name.
In the process expanded one test case,
This commit is contained in:
@ -81,6 +81,7 @@ int main( int argc, char * argv[] )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#line 26 "array_of_struct.pgc"
|
||||
customer custs1 [ 10 ] ;
|
||||
@ -111,54 +112,57 @@ int main( int argc, char * argv[] )
|
||||
|
||||
#line 44 "array_of_struct.pgc"
|
||||
int r ;
|
||||
/* exec sql end declare section */
|
||||
|
||||
#line 45 "array_of_struct.pgc"
|
||||
struct varchar_onlyname_45 { int len; char arr[ 50 ]; } onlyname [2] ;
|
||||
/* exec sql end declare section */
|
||||
#line 46 "array_of_struct.pgc"
|
||||
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
|
||||
#line 49 "array_of_struct.pgc"
|
||||
#line 50 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 49 "array_of_struct.pgc"
|
||||
#line 50 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 49 "array_of_struct.pgc"
|
||||
#line 50 "array_of_struct.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table customers ( c varchar ( 50 ) , p int ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 51 "array_of_struct.pgc"
|
||||
#line 52 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 51 "array_of_struct.pgc"
|
||||
#line 52 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 51 "array_of_struct.pgc"
|
||||
#line 52 "array_of_struct.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'John Doe' , '12345' ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 52 "array_of_struct.pgc"
|
||||
#line 53 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 52 "array_of_struct.pgc"
|
||||
#line 53 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 52 "array_of_struct.pgc"
|
||||
#line 53 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 52 "array_of_struct.pgc"
|
||||
#line 53 "array_of_struct.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'Jane Doe' , '67890' ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 53 "array_of_struct.pgc"
|
||||
#line 54 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 53 "array_of_struct.pgc"
|
||||
#line 54 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 53 "array_of_struct.pgc"
|
||||
#line 54 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 53 "array_of_struct.pgc"
|
||||
#line 54 "array_of_struct.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2 ", ECPGt_EOIT,
|
||||
@ -166,16 +170,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
|
||||
ECPGt_int,&(custs1->phone),(long)1,(long)10,sizeof( customer ),
|
||||
ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
|
||||
#line 55 "array_of_struct.pgc"
|
||||
#line 56 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 55 "array_of_struct.pgc"
|
||||
#line 56 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 55 "array_of_struct.pgc"
|
||||
#line 56 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 55 "array_of_struct.pgc"
|
||||
#line 56 "array_of_struct.pgc"
|
||||
|
||||
printf("custs1:\n");
|
||||
for (r = 0; r < 2; r++)
|
||||
@ -189,16 +193,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
|
||||
ECPGt_int,&(custs2->phone),(long)1,(long)10,sizeof( customer2 ),
|
||||
ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
|
||||
#line 63 "array_of_struct.pgc"
|
||||
#line 64 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 63 "array_of_struct.pgc"
|
||||
#line 64 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 63 "array_of_struct.pgc"
|
||||
#line 64 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 63 "array_of_struct.pgc"
|
||||
#line 64 "array_of_struct.pgc"
|
||||
|
||||
printf("\ncusts2:\n");
|
||||
for (r = 0; r < 2; r++)
|
||||
@ -212,16 +216,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
|
||||
ECPGt_int,&(custs3->phone),(long)1,(long)10,sizeof( struct customer3 ),
|
||||
ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
|
||||
#line 71 "array_of_struct.pgc"
|
||||
#line 72 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 71 "array_of_struct.pgc"
|
||||
#line 72 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 71 "array_of_struct.pgc"
|
||||
#line 72 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 71 "array_of_struct.pgc"
|
||||
#line 72 "array_of_struct.pgc"
|
||||
|
||||
printf("\ncusts3:\n");
|
||||
for (r = 0; r < 2; r++)
|
||||
@ -235,29 +239,49 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof(short),
|
||||
ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof(int),
|
||||
ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);
|
||||
#line 79 "array_of_struct.pgc"
|
||||
#line 80 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 79 "array_of_struct.pgc"
|
||||
#line 80 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 79 "array_of_struct.pgc"
|
||||
#line 80 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 79 "array_of_struct.pgc"
|
||||
#line 80 "array_of_struct.pgc"
|
||||
|
||||
printf("\ncusts4:\n");
|
||||
printf( "name - %s\n", custs4.name.arr );
|
||||
printf( "phone - %d\n", custs4.phone );
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "ALL");
|
||||
#line 84 "array_of_struct.pgc"
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c from customers limit 2 ", ECPGt_EOIT,
|
||||
ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_onlyname_45),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 85 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
|
||||
#line 85 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 84 "array_of_struct.pgc"
|
||||
#line 85 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 84 "array_of_struct.pgc"
|
||||
#line 85 "array_of_struct.pgc"
|
||||
|
||||
printf("\nname:\n");
|
||||
for (r = 0; r < 2; r++)
|
||||
{
|
||||
printf( "name - %s\n", onlyname[r].arr );
|
||||
}
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "ALL");
|
||||
#line 92 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 92 "array_of_struct.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 92 "array_of_struct.pgc"
|
||||
|
||||
|
||||
return( 0 );
|
||||
|
Reference in New Issue
Block a user