+
#line 26 "array_of_struct.pgc"
customer custs1 [ 10 ] ;
#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,
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++)
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++)
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++)
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 );
+ { 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 85 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#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 84 "array_of_struct.pgc"
+#line 92 "array_of_struct.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 84 "array_of_struct.pgc"
+#line 92 "array_of_struct.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 84 "array_of_struct.pgc"
+#line 92 "array_of_struct.pgc"
return( 0 );
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 51: QUERY: create table customers ( c varchar ( 50 ) , p int ) with 0 parameter on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 51: using PQexec
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 51 Ok: CREATE TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 52: QUERY: insert into customers values ( 'John Doe' , '12345' ) with 0 parameter on connection regress1
+[NO_PID]: ecpg_execute line 52: QUERY: create table customers ( c varchar ( 50 ) , p int ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 52: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 52 Ok: INSERT 0 1
+[NO_PID]: ecpg_execute line 52 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 53: QUERY: insert into customers values ( 'Jane Doe' , '67890' ) with 0 parameter on connection regress1
+[NO_PID]: ecpg_execute line 53: QUERY: insert into customers values ( 'John Doe' , '12345' ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 53: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 53 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 55: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: ecpg_execute line 54: QUERY: insert into customers values ( 'Jane Doe' , '67890' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute line 54 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute line 56: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute line 56: Correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data line 56: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data line 56: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data line 56: RESULT: 12345 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 55: using PQexec
+[NO_PID]: ecpg_get_data line 56: RESULT: 67890 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 55: Correctly got 2 tuples with 2 fields
+[NO_PID]: ecpg_execute line 64: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 55: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: ecpg_execute line 64: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 55: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: ecpg_execute line 64: Correctly got 2 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 55: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 64: RESULT: John Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 55: RESULT: 67890 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 64: RESULT: Jane Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 63: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: ecpg_get_data line 64: RESULT: 12345 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 63: using PQexec
+[NO_PID]: ecpg_get_data line 64: RESULT: 67890 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 63: Correctly got 2 tuples with 2 fields
+[NO_PID]: ecpg_execute line 72: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 63: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: ecpg_execute line 72: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 63: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: ecpg_execute line 72: Correctly got 2 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 63: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 72: RESULT: John Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 63: RESULT: 67890 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 72: RESULT: Jane Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 71: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: ecpg_get_data line 72: RESULT: 12345 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 71: using PQexec
+[NO_PID]: ecpg_get_data line 72: RESULT: 67890 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 71: Correctly got 2 tuples with 2 fields
+[NO_PID]: ecpg_execute line 80: QUERY: select * from customers limit 1 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 71: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: ecpg_execute line 80: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 71: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: ecpg_execute line 80: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 71: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 80: RESULT: John Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 71: RESULT: 67890 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 80: RESULT: 12345 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 79: QUERY: select * from customers limit 1 with 0 parameter on connection regress1
+[NO_PID]: ecpg_execute line 85: QUERY: select c from customers limit 2 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 79: using PQexec
+[NO_PID]: ecpg_execute line 85: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute line 79: Correctly got 1 tuples with 2 fields
+[NO_PID]: ecpg_execute line 85: Correctly got 2 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 79: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 85: RESULT: John Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data line 79: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: ecpg_get_data line 85: RESULT: Jane Doe offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000