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
e2d6da07
Commit
e2d6da07
authored
Aug 17, 2021
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved ECPG warning as suggested by Michael Paquier and removed test case
that triggers the warning during regression tests.
parent
b88377ad
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
263 deletions
+118
-263
src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/ecpg.header
+2
-1
src/interfaces/ecpg/test/expected/sql-declare.c
src/interfaces/ecpg/test/expected/sql-declare.c
+58
-127
src/interfaces/ecpg/test/expected/sql-declare.stderr
src/interfaces/ecpg/test/expected/sql-declare.stderr
+51
-99
src/interfaces/ecpg/test/expected/sql-declare.stdout
src/interfaces/ecpg/test/expected/sql-declare.stdout
+1
-5
src/interfaces/ecpg/test/sql/declare.pgc
src/interfaces/ecpg/test/sql/declare.pgc
+6
-31
No files found.
src/interfaces/ecpg/preproc/ecpg.header
View file @
e2d6da07
...
...
@@ -595,7 +595,8 @@ check_declared_list(const char *name)
if (strcmp(name, ptr -> name) == 0)
{
if (connection)
mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten to %s.", connection, ptr->connection);
if (connection && strcmp(ptr->connection, connection) != 0)
mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten with %s by declare statement %s.", connection, ptr->connection, name);
connection = mm_strdup(ptr -> connection);
return true;
}
...
...
src/interfaces/ecpg/test/expected/sql-declare.c
View file @
e2d6da07
...
...
@@ -366,74 +366,42 @@ if (sqlca.sqlcode < 0) sqlprint();}
printResult
(
"testcase2"
,
2
);
/*
* testcase3. using DECLARE STATEMENT
at con1
,
* using PREPARE and
CURSOR statement at con2
* testcase3. using DECLARE STATEMENT
without using AT clause
,
* using PREPARE and
EXECUTE statement without using AT clause
*/
reset
();
/* declare \"stmt_3\" as an SQL identifier */
#line 122 "declare.pgc"
{
ECPGprepare
(
__LINE__
,
"con1"
,
0
,
"stmt_3"
,
selectString
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"stmt_3"
,
selectString
);
#line 123 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 123 "declare.pgc"
/* declare cur_3 cursor for $1 */
#line 124 "declare.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con1"
,
0
,
ECPGst_normal
,
"declare cur_3 cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
"con1"
,
"stmt_3"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 125 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 125 "declare.pgc"
/* exec sql whenever not found break ; */
#line 127 "declare.pgc"
i
=
0
;
while
(
1
)
{
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con1"
,
0
,
ECPGst_normal
,
"fetch cur_3"
,
ECPGt_EOIT
,
ECPGt_int
,
&
(
f1
[
i
]),(
long
)
1
,(
long
)
1
,
sizeof
(
int
),
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_execute
,
"stmt_3"
,
ECPGt_EOIT
,
ECPGt_int
,(
f1
),(
long
)
1
,(
long
)
ARRAY_SIZE
,
sizeof
(
int
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_int
,
&
(
f2
[
i
]),(
long
)
1
,(
long
)
1
,
sizeof
(
int
),
ECPGt_int
,
(
f2
),(
long
)
1
,(
long
)
ARRAY_SIZE
,
sizeof
(
int
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_char
,(
f3
[
i
]),(
long
)
20
,(
long
)
1
,(
20
)
*
sizeof
(
char
),
ECPGt_char
,(
f3
),(
long
)
20
,(
long
)
ARRAY_SIZE
,(
20
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 131 "declare.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
break
;
#line 131 "declare.pgc"
#line 124 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 131 "declare.pgc"
i
++
;
}
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con1"
,
0
,
ECPGst_normal
,
"close cur_3"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 134 "declare.pgc"
#line 124 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 134 "declare.pgc"
{
ECPGdeallocate
(
__LINE__
,
0
,
"con1"
,
"stmt_3"
);
#line 1
35
"declare.pgc"
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"stmt_3"
);
#line 1
26
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 135 "declare.pgc"
/* exec sql whenever not found continue ; */
#line 136 "declare.pgc"
#line 126 "declare.pgc"
printResult
(
"testcase3"
,
2
);
/*
* testcase4. using DECLARE STATEMENT without using AT clause,
* using PREPARE and CURSOR statement at con2
...
...
@@ -441,28 +409,28 @@ if (sqlca.sqlcode < 0) sqlprint();}
reset
();
/* declare \"stmt_4\" as an SQL identifier */
#line 1
47
"declare.pgc"
#line 1
36
"declare.pgc"
{
ECPGprepare
(
__LINE__
,
"con2"
,
0
,
"stmt_4"
,
selectString
);
#line 1
48
"declare.pgc"
#line 1
37
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
48
"declare.pgc"
#line 1
37
"declare.pgc"
/* declare cur_4 cursor for $1 */
#line 1
49
"declare.pgc"
#line 1
38
"declare.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con2"
,
0
,
ECPGst_normal
,
"declare cur_4 cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
"con2"
,
"stmt_4"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
50
"declare.pgc"
#line 1
39
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
50
"declare.pgc"
#line 1
39
"declare.pgc"
/* exec sql whenever not found break ; */
#line 1
52
"declare.pgc"
#line 1
41
"declare.pgc"
i
=
0
;
while
(
1
)
...
...
@@ -474,173 +442,136 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_char
,(
f3
[
i
]),(
long
)
20
,(
long
)
1
,(
20
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 1
56
"declare.pgc"
#line 1
45
"declare.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
break
;
#line 1
56
"declare.pgc"
#line 1
45
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
56
"declare.pgc"
#line 1
45
"declare.pgc"
i
++
;
}
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con2"
,
0
,
ECPGst_normal
,
"close cur_4"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
59
"declare.pgc"
#line 1
48
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
59
"declare.pgc"
#line 1
48
"declare.pgc"
{
ECPGdeallocate
(
__LINE__
,
0
,
"con2"
,
"stmt_4"
);
#line 1
60
"declare.pgc"
#line 1
49
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
60
"declare.pgc"
#line 1
49
"declare.pgc"
/* exec sql whenever not found continue ; */
#line 1
61
"declare.pgc"
#line 1
50
"declare.pgc"
printResult
(
"testcase4"
,
2
);
/*
* testcase5. using DECLARE STATEMENT without using AT clause,
* using PREPARE and EXECUTE statement without using AT clause
*/
reset
();
/* declare \"stmt_5\" as an SQL identifier */
#line 171 "declare.pgc"
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"stmt_5"
,
selectString
);
#line 172 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 172 "declare.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_execute
,
"stmt_5"
,
ECPGt_EOIT
,
ECPGt_int
,(
f1
),(
long
)
1
,(
long
)
ARRAY_SIZE
,
sizeof
(
int
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_int
,(
f2
),(
long
)
1
,(
long
)
ARRAY_SIZE
,
sizeof
(
int
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_char
,(
f3
),(
long
)
20
,(
long
)
ARRAY_SIZE
,(
20
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 173 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 173 "declare.pgc"
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"stmt_5"
);
#line 175 "declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 175 "declare.pgc"
printResult
(
"testcase5"
,
2
);
/*
* DESCRIBE statement is also supported.
*/
/* declare \"stmt_desc\" as an SQL identifier */
#line 1
82
"declare.pgc"
#line 1
57
"declare.pgc"
{
ECPGprepare
(
__LINE__
,
"con1"
,
0
,
"stmt_desc"
,
selectString
);
#line 1
83
"declare.pgc"
#line 1
58
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
83
"declare.pgc"
#line 1
58
"declare.pgc"
/* declare cur_desc cursor for $1 */
#line 1
84
"declare.pgc"
#line 1
59
"declare.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con1"
,
0
,
ECPGst_normal
,
"declare cur_desc cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
"con1"
,
"stmt_desc"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
85
"declare.pgc"
#line 1
60
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
85
"declare.pgc"
#line 1
60
"declare.pgc"
/* descriptor can be used for describe statement */
ECPGallocate_desc
(
__LINE__
,
"desc_for_describe"
);
#line 1
88
"declare.pgc"
#line 1
63
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line 1
88
"declare.pgc"
#line 1
63
"declare.pgc"
{
ECPGdescribe
(
__LINE__
,
0
,
0
,
"con1"
,
"stmt_desc"
,
ECPGt_descriptor
,
"desc_for_describe"
,
1L
,
1L
,
1L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);}
#line 1
89
"declare.pgc"
#line 1
64
"declare.pgc"
{
ECPGget_desc_header
(
__LINE__
,
"desc_for_describe"
,
&
(
count
));
#line 1
91
"declare.pgc"
#line 1
66
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
91
"declare.pgc"
#line 1
66
"declare.pgc"
{
ECPGget_desc
(
__LINE__
,
"desc_for_describe"
,
3
,
ECPGd_length
,
ECPGt_int
,
&
(
length
),(
long
)
1
,(
long
)
1
,
sizeof
(
int
),
ECPGd_EODT
);
#line 1
92
"declare.pgc"
#line 1
67
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
92
"declare.pgc"
#line 1
67
"declare.pgc"
ECPGdeallocate_desc
(
__LINE__
,
"desc_for_describe"
);
#line 1
94
"declare.pgc"
#line 1
69
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line 1
94
"declare.pgc"
#line 1
69
"declare.pgc"
/* for fetch statement */
ECPGallocate_desc
(
__LINE__
,
"desc_for_fetch"
);
#line 1
97
"declare.pgc"
#line 1
72
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line 1
97
"declare.pgc"
#line 1
72
"declare.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con1"
,
0
,
ECPGst_normal
,
"fetch cur_desc"
,
ECPGt_EOIT
,
ECPGt_descriptor
,
"desc_for_fetch"
,
1L
,
1L
,
1L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 1
98
"declare.pgc"
#line 1
73
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
98
"declare.pgc"
#line 1
73
"declare.pgc"
{
ECPGget_desc
(
__LINE__
,
"desc_for_fetch"
,
3
,
ECPGd_data
,
ECPGt_char
,(
f3
[
0
]),(
long
)
20
,(
long
)
1
,(
20
)
*
sizeof
(
char
),
ECPGd_EODT
);
#line
200
"declare.pgc"
#line
175
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
200
"declare.pgc"
#line
175
"declare.pgc"
ECPGdeallocate_desc
(
__LINE__
,
"desc_for_fetch"
);
#line
202
"declare.pgc"
#line
177
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line
202
"declare.pgc"
#line
177
"declare.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
"con1"
,
0
,
ECPGst_normal
,
"close cur_desc"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line
203
"declare.pgc"
#line
178
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
203
"declare.pgc"
#line
178
"declare.pgc"
{
ECPGdeallocate
(
__LINE__
,
0
,
"con1"
,
"stmt_desc"
);
#line
204
"declare.pgc"
#line
179
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
204
"declare.pgc"
#line
179
"declare.pgc"
printf
(
"****descriptor results****
\n
"
);
...
...
@@ -650,16 +581,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
void
commitTable
()
{
{
ECPGtrans
(
__LINE__
,
"con1"
,
"commit"
);
#line
212
"declare.pgc"
#line
187
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
212
"declare.pgc"
#line
187
"declare.pgc"
{
ECPGtrans
(
__LINE__
,
"con2"
,
"commit"
);
#line
213
"declare.pgc"
#line
188
"declare.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
213
"declare.pgc"
#line
188
"declare.pgc"
}
...
...
src/interfaces/ecpg/test/expected/sql-declare.stderr
View file @
e2d6da07
...
...
@@ -40,9 +40,9 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line
212
: action "commit"; connection "con1"
[NO_PID]: ECPGtrans on line
187
: action "commit"; connection "con1"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line
213
: action "commit"; connection "con2"
[NO_PID]: ECPGtrans on line
188
: action "commit"; connection "con2"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: prepare_common on line 74: name stmt_1; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
...
...
@@ -142,129 +142,81 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: prepare_common on line 123: name stmt_3; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 12
5: query: declare cur_3 cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line 12
4: query: SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 12
5: using PQexec
[NO_PID]: ecpg_execute on line 12
4: using PQexecPrepared for "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 12
5: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 12
4: correctly got 2 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
execute on line 131: query: fetch cur_3; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_
get_data on line 124: RESULT: 1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
execute on line 131: using PQexec
[NO_PID]: ecpg_
get_data on line 124: RESULT: 2 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
process_output on line 131: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_
get_data on line 124: RESULT: 10 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 1
31: RESULT: 1
offset: -1; array: no
[NO_PID]: ecpg_get_data on line 1
24: RESULT: 20
offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 1
31: RESULT: 10
offset: -1; array: no
[NO_PID]: ecpg_get_data on line 1
24: RESULT: db on con2
offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 1
31: RESULT: db on con1
offset: -1; array: no
[NO_PID]: ecpg_get_data on line 1
24: RESULT: db on con2
offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]:
ecpg_execute on line 131: query: fetch cur_3; with 0 parameter(s) on connection con1
[NO_PID]:
deallocate_one on line 126: name stmt_3
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]:
ecpg_execute on line 131: using PQexec
[NO_PID]:
prepare_common on line 137: name stmt_4; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
process_output on line 131: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_
execute on line 139: query: declare cur_4 cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 131: RESULT: 2 offset: -1; array: no
[NO_PID]: ecpg_
execute on line 139: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 131: RESULT: 20 offset: -1; array: no
[NO_PID]: ecpg_
process_output on line 139: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 131: RESULT: db on con1 offset: -1; array: no
[NO_PID]: ecpg_
execute on line 145: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
31: query: fetch cur_3; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line 1
45: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
execute on line 131: using PQexec
[NO_PID]: ecpg_
process_output on line 145: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
process_output on line 131: correctly got 0 tuples with 3 fields
[NO_PID]: ecpg_
get_data on line 145: RESULT: 1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 131: no data found on line 131
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 134: query: close cur_3; with 0 parameter(s) on connection con1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 134: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 134: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: deallocate_one on line 135: name stmt_3
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: prepare_common on line 148: name stmt_4; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 150: query: declare cur_4 cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 150: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 150: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 156: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 156: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 156: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 156: RESULT: 1 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 145: RESULT: 10 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 1
56: RESULT: 10
offset: -1; array: no
[NO_PID]: ecpg_get_data on line 1
45: RESULT: db on con2
offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 156: RESULT: db on con2 offset: -1; array: no
[NO_PID]: ecpg_
execute on line 145: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
56: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: ecpg_execute on line 1
45: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
execute on line 156: using PQexec
[NO_PID]: ecpg_
process_output on line 145: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
process_output on line 156: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_
get_data on line 145: RESULT: 2 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 1
56: RESULT: 2
offset: -1; array: no
[NO_PID]: ecpg_get_data on line 1
45: RESULT: 20
offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 1
56: RESULT: 20
offset: -1; array: no
[NO_PID]: ecpg_get_data on line 1
45: RESULT: db on con2
offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 156: RESULT: db on con2 offset: -1; array: no
[NO_PID]: ecpg_
execute on line 145: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
56: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: ecpg_execute on line 1
45: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
execute on line 156: using PQexec
[NO_PID]: ecpg_
process_output on line 145: correctly got 0 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 156: correctly got 0 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 156: no data found on line 156
[NO_PID]: raising sqlcode 100 on line 145: no data found on line 145
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 159: query: close cur_4; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 159: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 159: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: deallocate_one on line 160: name stmt_4
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: prepare_common on line 172: name stmt_5; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 173: query: SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 173: using PQexecPrepared for "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 173: correctly got 2 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 173: RESULT: 1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 173: RESULT: 2 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 173: RESULT: 10 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 173: RESULT: 20 offset: -1; array: no
[NO_PID]: ecpg_execute on line 148: query: close cur_4; with 0 parameter(s) on connection con2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 173: RESULT: db on con2 offset: -1; array: no
[NO_PID]: ecpg_
execute on line 148: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_
get_data on line 173: RESULT: db on con2 offset: -1; array: no
[NO_PID]: ecpg_
process_output on line 148: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: deallocate_one on line 1
75: name stmt_5
[NO_PID]: deallocate_one on line 1
49: name stmt_4
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: prepare_common on line 1
83
: name stmt_desc; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: prepare_common on line 1
58
: name stmt_desc; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
85
: query: declare cur_desc cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line 1
60
: query: declare cur_desc cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
85
: using PQexec
[NO_PID]: ecpg_execute on line 1
60
: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 1
85
: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 1
60
: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_desc_header: found 3 attributes
[NO_PID]: sqlca: code: 0, state: 00000
...
...
@@ -272,25 +224,25 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_desc: LENGTH = 20
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
98
: query: fetch cur_desc; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line 1
73
: query: fetch cur_desc; with 0 parameter(s) on connection con1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 1
98
: using PQexec
[NO_PID]: ecpg_execute on line 1
73
: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 1
98
: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_process_output on line 1
73
: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 1
98
: putting result (1 tuples) into descriptor desc_for_fetch
[NO_PID]: ecpg_process_output on line 1
73
: putting result (1 tuples) into descriptor desc_for_fetch
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_desc: reading items for tuple 3
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line
200
: RESULT: db on con1 offset: -1; array: no
[NO_PID]: ecpg_get_data on line
175
: RESULT: db on con1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line
203
: query: close cur_desc; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line
178
: query: close cur_desc; with 0 parameter(s) on connection con1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line
203
: using PQexec
[NO_PID]: ecpg_execute on line
178
: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line
203
: OK: CLOSE CURSOR
[NO_PID]: ecpg_process_output on line
178
: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: deallocate_one on line
204
: name stmt_desc
[NO_PID]: deallocate_one on line
179
: name stmt_desc
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 45: query: drop table if exists source; with 0 parameter(s) on connection con1
[NO_PID]: sqlca: code: 0, state: 00000
...
...
@@ -304,9 +256,9 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 46: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line
212
: action "commit"; connection "con1"
[NO_PID]: ECPGtrans on line
187
: action "commit"; connection "con1"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line
213
: action "commit"; connection "con2"
[NO_PID]: ECPGtrans on line
188
: action "commit"; connection "con2"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection con2 closed
[NO_PID]: sqlca: code: 0, state: 00000
...
...
src/interfaces/ecpg/test/expected/sql-declare.stdout
View file @
e2d6da07
...
...
@@ -7,14 +7,10 @@ f1=1, f2=10, f3=db on con1
f1=2, f2=20, f3=db on con1
****testcase3 test results:****
f1=1, f2=10, f3=db on con1
f1=2, f2=20, f3=db on con1
****testcase4 test results:****
f1=1, f2=10, f3=db on con2
f1=2, f2=20, f3=db on con2
****testcase
5
test results:****
****testcase
4
test results:****
f1=1, f2=10, f3=db on con2
f1=2, f2=20, f3=db on con2
...
...
src/interfaces/ecpg/test/sql/declare.pgc
View file @
e2d6da07
...
...
@@ -114,30 +114,19 @@ void execute_test(void)
printResult("testcase2", 2);
/*
* testcase3. using DECLARE STATEMENT
at con1
,
* using PREPARE and
CURSOR statement at con2
* testcase3. using DECLARE STATEMENT
without using AT clause
,
* using PREPARE and
EXECUTE statement without using AT clause
*/
reset();
EXEC SQL AT con1 DECLARE stmt_3 STATEMENT;
EXEC SQL AT con2 PREPARE stmt_3 FROM :selectString;
EXEC SQL AT con2 DECLARE cur_3 CURSOR FOR stmt_3;
EXEC SQL AT con2 OPEN cur_3;
EXEC SQL DECLARE stmt_3 STATEMENT;
EXEC SQL PREPARE stmt_3 FROM :selectString;
EXEC SQL EXECUTE stmt_3 INTO :f1, :f2, :f3;
EXEC SQL WHENEVER NOT FOUND DO BREAK;
i = 0;
while (1)
{
EXEC SQL AT con2 FETCH cur_3 INTO :f1[i], :f2[i], :f3[i];
i++;
}
EXEC SQL AT con2 CLOSE cur_3;
EXEC SQL AT con2 DEALLOCATE PREPARE stmt_3;
EXEC SQL WHENEVER NOT FOUND CONTINUE;
EXEC SQL DEALLOCATE PREPARE stmt_3;
printResult("testcase3", 2);
/*
* testcase4. using DECLARE STATEMENT without using AT clause,
* using PREPARE and CURSOR statement at con2
...
...
@@ -162,20 +151,6 @@ void execute_test(void)
printResult("testcase4", 2);
/*
* testcase5. using DECLARE STATEMENT without using AT clause,
* using PREPARE and EXECUTE statement without using AT clause
*/
reset();
EXEC SQL DECLARE stmt_5 STATEMENT;
EXEC SQL PREPARE stmt_5 FROM :selectString;
EXEC SQL EXECUTE stmt_5 INTO :f1, :f2, :f3;
EXEC SQL DEALLOCATE PREPARE stmt_5;
printResult("testcase5", 2);
/*
* DESCRIBE statement is also supported.
*/
...
...
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