Commit e2d6da07 authored by Michael Meskes's avatar Michael Meskes

Improved ECPG warning as suggested by Michael Paquier and removed test case

that triggers the warning during regression tests.
parent b88377ad
......@@ -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;
}
......
......@@ -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 135 "declare.pgc"
{ ECPGdeallocate(__LINE__, 0, NULL, "stmt_3");
#line 126 "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 147 "declare.pgc"
#line 136 "declare.pgc"
{ ECPGprepare(__LINE__, "con2", 0, "stmt_4", selectString);
#line 148 "declare.pgc"
#line 137 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 148 "declare.pgc"
#line 137 "declare.pgc"
/* declare cur_4 cursor for $1 */
#line 149 "declare.pgc"
#line 138 "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 150 "declare.pgc"
#line 139 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 150 "declare.pgc"
#line 139 "declare.pgc"
/* exec sql whenever not found break ; */
#line 152 "declare.pgc"
#line 141 "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 156 "declare.pgc"
#line 145 "declare.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 156 "declare.pgc"
#line 145 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 156 "declare.pgc"
#line 145 "declare.pgc"
i++;
}
{ ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "close cur_4", ECPGt_EOIT, ECPGt_EORT);
#line 159 "declare.pgc"
#line 148 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 159 "declare.pgc"
#line 148 "declare.pgc"
{ ECPGdeallocate(__LINE__, 0, "con2", "stmt_4");
#line 160 "declare.pgc"
#line 149 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 160 "declare.pgc"
#line 149 "declare.pgc"
/* exec sql whenever not found continue ; */
#line 161 "declare.pgc"
#line 150 "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 182 "declare.pgc"
#line 157 "declare.pgc"
{ ECPGprepare(__LINE__, "con1", 0, "stmt_desc", selectString);
#line 183 "declare.pgc"
#line 158 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 183 "declare.pgc"
#line 158 "declare.pgc"
/* declare cur_desc cursor for $1 */
#line 184 "declare.pgc"
#line 159 "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 185 "declare.pgc"
#line 160 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 185 "declare.pgc"
#line 160 "declare.pgc"
/* descriptor can be used for describe statement */
ECPGallocate_desc(__LINE__, "desc_for_describe");
#line 188 "declare.pgc"
#line 163 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 188 "declare.pgc"
#line 163 "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 189 "declare.pgc"
#line 164 "declare.pgc"
{ ECPGget_desc_header(__LINE__, "desc_for_describe", &(count));
#line 191 "declare.pgc"
#line 166 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 191 "declare.pgc"
#line 166 "declare.pgc"
{ ECPGget_desc(__LINE__, "desc_for_describe", 3,ECPGd_length,
ECPGt_int,&(length),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 192 "declare.pgc"
#line 167 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 192 "declare.pgc"
#line 167 "declare.pgc"
ECPGdeallocate_desc(__LINE__, "desc_for_describe");
#line 194 "declare.pgc"
#line 169 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 194 "declare.pgc"
#line 169 "declare.pgc"
/* for fetch statement */
ECPGallocate_desc(__LINE__, "desc_for_fetch");
#line 197 "declare.pgc"
#line 172 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 197 "declare.pgc"
#line 172 "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 198 "declare.pgc"
#line 173 "declare.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 198 "declare.pgc"
#line 173 "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"
}
......
......@@ -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 125: 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 124: 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 125: using PQexec
[NO_PID]: ecpg_execute on line 124: using PQexecPrepared for "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 125: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 124: 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 131: RESULT: 1 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 124: RESULT: 20 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 131: RESULT: 10 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 124: RESULT: db on con2 offset: -1; array: no
[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_get_data on line 124: 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 131: query: fetch cur_3; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line 145: 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 156: RESULT: 10 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 145: 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 156: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: ecpg_execute on line 145: 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 156: RESULT: 2 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 145: RESULT: 20 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 156: RESULT: 20 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 145: 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 156: query: fetch cur_4; with 0 parameter(s) on connection con2
[NO_PID]: ecpg_execute on line 145: 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 175: name stmt_5
[NO_PID]: deallocate_one on line 149: name stmt_4
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: prepare_common on line 183: name stmt_desc; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: prepare_common on line 158: name stmt_desc; query: "SELECT f1,f2,f3 FROM source"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 185: 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 160: 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 185: using PQexec
[NO_PID]: ecpg_execute on line 160: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 185: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 160: 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 198: query: fetch cur_desc; with 0 parameter(s) on connection con1
[NO_PID]: ecpg_execute on line 173: query: fetch cur_desc; with 0 parameter(s) on connection con1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 198: using PQexec
[NO_PID]: ecpg_execute on line 173: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 198: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_process_output on line 173: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 198: putting result (1 tuples) into descriptor desc_for_fetch
[NO_PID]: ecpg_process_output on line 173: 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
......
......@@ -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
****testcase5 test results:****
****testcase4 test results:****
f1=1, f2=10, f3=db on con2
f1=2, f2=20, f3=db on con2
......
......@@ -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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment