diff options
author | Michael Meskes <meskes@postgresql.org> | 2019-02-16 10:55:17 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2019-02-16 11:05:54 +0100 |
commit | bd7c95f0c1a38becffceb3ea7234d57167f6d4bf (patch) | |
tree | 8ab862d314ec1e241ef0b90fc42edf3f6f5e4be8 /src/interfaces/ecpg/test/expected/sql-fetch.c | |
parent | 02a6a54ecd6632f974b1b4eebfb2373363431084 (diff) | |
download | postgresql-bd7c95f0c1a38becffceb3ea7234d57167f6d4bf.tar.gz postgresql-bd7c95f0c1a38becffceb3ea7234d57167f6d4bf.zip |
Add DECLARE STATEMENT support to ECPG.
DECLARE STATEMENT is a statement that lets users declare an identifier
pointing at a connection. This identifier will be used in other embedded
dynamic SQL statement such as PREPARE, EXECUTE, DECLARE CURSOR and so on.
When connecting to a non-default connection, the AT clause can be used in
a DECLARE STATEMENT once and is no longer needed in every dynamic SQL
statement. This makes ECPG applications easier and more efficient. Moreover,
writing code without designating connection explicitly improves portability.
Authors: Ideriha-san ("Ideriha, Takeshi" <ideriha.takeshi@jp.fujitsu.com>)
Kuroda-san ("Kuroda, Hayato" <kuroda.hayato@jp.fujitsu.com>)
Discussion: https://postgr.es/m4E72940DA2BF16479384A86D54D0988A565669DF@G01JPEXMBKW04
Diffstat (limited to 'src/interfaces/ecpg/test/expected/sql-fetch.c')
-rw-r--r-- | src/interfaces/ecpg/test/expected/sql-fetch.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.c b/src/interfaces/ecpg/test/expected/sql-fetch.c index ca7d14e97c4..a265bce9895 100644 --- a/src/interfaces/ecpg/test/expected/sql-fetch.c +++ b/src/interfaces/ecpg/test/expected/sql-fetch.c @@ -99,7 +99,7 @@ if (sqlca.sqlcode < 0) exit (1);} #line 26 "fetch.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select * from My_Table", ECPGt_EOIT, ECPGt_EORT); + { ECPGopen("C", NULL, __LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select * from My_Table", ECPGt_EOIT, ECPGt_EORT); #line 28 "fetch.pgc" if (sqlca.sqlwarn[0] == 'W') sqlprint(); @@ -113,7 +113,7 @@ if (sqlca.sqlcode < 0) exit (1);} #line 30 "fetch.pgc" for (loopcount = 0; loopcount < 100; loopcount++) { - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT, + { ECPGfetch("C", __LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT, ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char), @@ -135,7 +135,7 @@ if (sqlca.sqlcode < 0) exit (1);} /* exec sql whenever not found continue ; */ #line 36 "fetch.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT); + { ECPGfetch("C", __LINE__, 0, 1, NULL, 0, ECPGst_normal, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT); #line 37 "fetch.pgc" if (sqlca.sqlwarn[0] == 'W') sqlprint(); @@ -145,7 +145,7 @@ if (sqlca.sqlcode < 0) exit (1);} #line 37 "fetch.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 in C", + { ECPGfetch("C", __LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 in C", ECPGt_int,&(count),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(i),(long)1,(long)1,sizeof(int), @@ -162,7 +162,7 @@ if (sqlca.sqlcode < 0) exit (1);} printf("%d: %s\n", i, str); - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT); + { ECPGclose("C", __LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT); #line 42 "fetch.pgc" if (sqlca.sqlwarn[0] == 'W') sqlprint(); @@ -176,7 +176,7 @@ if (sqlca.sqlcode < 0) exit (1);} #line 44 "fetch.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare D cursor for select * from My_Table where Item1 = $1", + { ECPGopen("D", NULL, __LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare D cursor for select * from My_Table where Item1 = $1", ECPGt_const,"1",(long)1,(long)1,strlen("1"), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); #line 46 "fetch.pgc" @@ -188,7 +188,7 @@ if (sqlca.sqlcode < 0) exit (1);} #line 46 "fetch.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", ECPGt_EOIT, + { ECPGfetch("D", __LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", ECPGt_EOIT, ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char), @@ -203,7 +203,7 @@ if (sqlca.sqlcode < 0) exit (1);} printf("%d: %s\n", i, str); - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close D", ECPGt_EOIT, ECPGt_EORT); + { ECPGclose("D", __LINE__, 0, 1, NULL, 0, ECPGst_normal, "close D", ECPGt_EOIT, ECPGt_EORT); #line 51 "fetch.pgc" if (sqlca.sqlwarn[0] == 'W') sqlprint(); |