aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2019-01-30 13:58:25 +0100
committerMichael Meskes <meskes@postgresql.org>2019-01-30 14:35:52 +0100
commit7ea38f045dad6bbb7fbe807f2486df7370bc0b0f (patch)
tree4245ff47ee0353ac7cdaddeaae171e1af79c1565 /src/interfaces/ecpg/test
parente2f731cdba9b7a79cddc64325990a8f51818877b (diff)
downloadpostgresql-7ea38f045dad6bbb7fbe807f2486df7370bc0b0f.tar.gz
postgresql-7ea38f045dad6bbb7fbe807f2486df7370bc0b0f.zip
Change error handling of out of scope variables in ecpg.
The function called can result in an out of memory error that subsequently was disregarded. Instead it should set the appropriate SQL error variables and be checked by whatever whenever statement is defined.
Diffstat (limited to 'src/interfaces/ecpg/test')
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-sqlda.c4
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix.c7
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-cursor.c25
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-outofscope.c5
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.c15
5 files changed, 53 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
index ad3188d1e63..7e19319d27f 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
@@ -236,7 +236,7 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "declare");
- ECPG_informix_reset_sqlca(); /* declare mycur1 cursor for $1 */
+ /* declare mycur1 cursor for $1 */
#line 98 "sqlda.pgc"
@@ -311,7 +311,7 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "declare");
- ECPG_informix_reset_sqlca(); /* declare mycur2 cursor for $1 */
+ /* declare mycur2 cursor for $1 */
#line 135 "sqlda.pgc"
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
index 387e2e810d3..cc6504992d0 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
@@ -148,7 +148,12 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
sqlca.sqlcode = 100;
ECPGset_var( 0, &( i ), __LINE__);\
- ECPG_informix_reset_sqlca(); /* declare c cursor for select * from test where i <= $1 */
+ /* declare c cursor for select * from test where i <= $1 */
+#line 49 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );
+#line 49 "test_informix.pgc"
+
#line 49 "test_informix.pgc"
printf ("%ld\n", sqlca.sqlcode);
diff --git a/src/interfaces/ecpg/test/expected/preproc-cursor.c b/src/interfaces/ecpg/test/expected/preproc-cursor.c
index 48229017421..a4e7b12c17a 100644
--- a/src/interfaces/ecpg/test/expected/preproc-cursor.c
+++ b/src/interfaces/ecpg/test/expected/preproc-cursor.c
@@ -185,6 +185,11 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare $0 cursor for select id , t from t1 */
#line 64 "cursor.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 64 "cursor.pgc"
+
+#line 64 "cursor.pgc"
+
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
@@ -321,6 +326,11 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare $0 cursor for select id , t from t1 */
#line 105 "cursor.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 105 "cursor.pgc"
+
+#line 105 "cursor.pgc"
+
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
@@ -477,10 +487,20 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare $0 cursor for $1 */
#line 149 "cursor.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 149 "cursor.pgc"
+
+#line 149 "cursor.pgc"
+
ECPGset_var( 5, &( curname5 ), __LINE__);\
/* declare $0 cursor for $1 */
#line 150 "cursor.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 150 "cursor.pgc"
+
+#line 150 "cursor.pgc"
+
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for $1",
@@ -661,6 +681,11 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare $0 cursor for $1 */
#line 203 "cursor.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 203 "cursor.pgc"
+
+#line 203 "cursor.pgc"
+
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for $1",
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
index 1ebdc0a6ea3..3a27c53e174 100644
--- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
@@ -192,6 +192,11 @@ get_var1(MYTYPE **myvar0, MYNULLTYPE **mynullvar0)
/* declare mycur cursor for select * from a1 */
#line 28 "outofscope.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 28 "outofscope.pgc"
+
+#line 28 "outofscope.pgc"
+
if (sqlca.sqlcode != 0)
exit(1);
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.c b/src/interfaces/ecpg/test/expected/sql-binary.c
index 99244bbcef8..6d92ce344b6 100644
--- a/src/interfaces/ecpg/test/expected/sql-binary.c
+++ b/src/interfaces/ecpg/test/expected/sql-binary.c
@@ -103,6 +103,11 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare C cursor for select name , accs , byte from empl where idnum = $1 */
#line 36 "binary.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 36 "binary.pgc"
+
+#line 36 "binary.pgc"
+
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select name , accs , byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
@@ -137,6 +142,11 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare B binary cursor for select name , accs , byte from empl where idnum = $1 */
#line 44 "binary.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 44 "binary.pgc"
+
+#line 44 "binary.pgc"
+
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare B binary cursor for select name , accs , byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
@@ -174,6 +184,11 @@ if (sqlca.sqlcode < 0) exit (1);}
/* declare A binary cursor for select byte from empl where idnum = $1 */
#line 55 "binary.pgc"
+if (sqlca.sqlcode < 0) exit (1);
+#line 55 "binary.pgc"
+
+#line 55 "binary.pgc"
+
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare A binary cursor for select byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);