Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
fb7b1df0
Commit
fb7b1df0
authored
Mar 02, 2008
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug that caused arrays of varchar to be output with incomplete name.
In the process expanded one test case,
parent
0f855d62
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
71 deletions
+122
-71
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.c
+2
-2
src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
+58
-34
src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
...erfaces/ecpg/test/expected/preproc-array_of_struct.stderr
+45
-35
src/interfaces/ecpg/test/expected/preproc-array_of_struct.stdout
...erfaces/ecpg/test/expected/preproc-array_of_struct.stdout
+4
-0
src/interfaces/ecpg/test/preproc/array_of_struct.pgc
src/interfaces/ecpg/test/preproc/array_of_struct.pgc
+8
-0
No files found.
src/interfaces/ecpg/ChangeLog
View file @
fb7b1df0
...
...
@@ -2322,3 +2322,8 @@ Sun, 17 Feb 2008 18:45:39 +0100
- Removed duplicate include of ecpgtype.h.
- Changed INFORMIX mode symbol definition yet again because the old
way didn't work on NetBSD.
Sun, 02 Mar 2008 11:50:48 +0100
- Fixed bug that caused arrays of varchar to be output with incomplete
name.
src/interfaces/ecpg/preproc/type.c
View file @
fb7b1df0
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.7
7 2007/12/21 14:33:20
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.7
8 2008/03/02 10:54:11
meskes Exp $ */
#include "postgres_fe.h"
...
...
@@ -259,7 +259,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
ECPGdump_a_simple
(
o
,
name
,
type
->
u
.
element
->
type
,
type
->
u
.
element
->
size
,
type
->
size
,
NULL
,
prefix
,
type
->
lineno
);
type
->
u
.
element
->
size
,
type
->
size
,
NULL
,
prefix
,
type
->
u
.
element
->
lineno
);
if
(
ind_type
!=
NULL
)
{
...
...
src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
View file @
fb7b1df0
...
...
@@ -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 5
1
"array_of_struct.pgc"
#line 5
2
"array_of_struct.pgc"
if
(
sqlca
.
sqlwarn
[
0
]
==
'W'
)
sqlprint
();
#line 5
1
"array_of_struct.pgc"
#line 5
2
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
1
"array_of_struct.pgc"
#line 5
2
"array_of_struct.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"insert into customers values ( 'John Doe' , '12345' ) "
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 5
2
"array_of_struct.pgc"
#line 5
3
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 5
2
"array_of_struct.pgc"
#line 5
3
"array_of_struct.pgc"
if
(
sqlca
.
sqlwarn
[
0
]
==
'W'
)
sqlprint
();
#line 5
2
"array_of_struct.pgc"
#line 5
3
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
2
"array_of_struct.pgc"
#line 5
3
"array_of_struct.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"insert into customers values ( 'Jane Doe' , '67890' ) "
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 5
3
"array_of_struct.pgc"
#line 5
4
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 5
3
"array_of_struct.pgc"
#line 5
4
"array_of_struct.pgc"
if
(
sqlca
.
sqlwarn
[
0
]
==
'W'
)
sqlprint
();
#line 5
3
"array_of_struct.pgc"
#line 5
4
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
3
"array_of_struct.pgc"
#line 5
4
"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 5
5
"array_of_struct.pgc"
#line 5
6
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 5
5
"array_of_struct.pgc"
#line 5
6
"array_of_struct.pgc"
if
(
sqlca
.
sqlwarn
[
0
]
==
'W'
)
sqlprint
();
#line 5
5
"array_of_struct.pgc"
#line 5
6
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
5
"array_of_struct.pgc"
#line 5
6
"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 6
3
"array_of_struct.pgc"
#line 6
4
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 6
3
"array_of_struct.pgc"
#line 6
4
"array_of_struct.pgc"
if
(
sqlca
.
sqlwarn
[
0
]
==
'W'
)
sqlprint
();
#line 6
3
"array_of_struct.pgc"
#line 6
4
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 6
3
"array_of_struct.pgc"
#line 6
4
"array_of_struct.pgc"
printf
(
"
\n
custs2:
\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 7
1
"array_of_struct.pgc"
#line 7
2
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 7
1
"array_of_struct.pgc"
#line 7
2
"array_of_struct.pgc"
if
(
sqlca
.
sqlwarn
[
0
]
==
'W'
)
sqlprint
();
#line 7
1
"array_of_struct.pgc"
#line 7
2
"array_of_struct.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 7
1
"array_of_struct.pgc"
#line 7
2
"array_of_struct.pgc"
printf
(
"
\n
custs3:
\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
(
"
\n
custs4:
\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
(
"
\n
name:
\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
);
...
...
src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
View file @
fb7b1df0
...
...
@@ -2,75 +2,85 @@
[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 ( 'J
ane Doe' , '67890
' ) with 0 parameter on connection regress1
[NO_PID]: ecpg_execute line 53: QUERY: insert into customers values ( 'J
ohn 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: Ye
s
[NO_PID]: ecpg_
execute line 64: Correctly got 2 tuples with 2 field
s
[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: Ye
s
[NO_PID]: ecpg_
execute line 72: Correctly got 2 tuples with 2 field
s
[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: Ye
s
[NO_PID]: ecpg_
execute line 80: Correctly got 1 tuples with 2 field
s
[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
src/interfaces/ecpg/test/expected/preproc-array_of_struct.stdout
View file @
fb7b1df0
...
...
@@ -19,3 +19,7 @@ phone - 67890
custs4:
name - John Doe
phone - 12345
name:
name - John Doe
name - Jane Doe
src/interfaces/ecpg/test/preproc/array_of_struct.pgc
View file @
fb7b1df0
...
...
@@ -42,6 +42,7 @@ int main( int argc, char * argv[] )
int phone;
} custs4;
int r;
varchar onlyname[2][50];
EXEC SQL end declare section;
ECPGdebug(1, stderr);
...
...
@@ -81,6 +82,13 @@ int main( int argc, char * argv[] )
printf( "name - %s\n", custs4.name.arr );
printf( "phone - %d\n", custs4.phone );
EXEC SQL select c INTO :onlyname from customers limit 2;
printf("\nname:\n");
for (r = 0; r < 2; r++)
{
printf( "name - %s\n", onlyname[r].arr );
}
EXEC SQL disconnect all;
return( 0 );
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment