Fix regression test failures in diagnostic-test.
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Wed, 8 Mar 2017 03:54:16 +0000 (12:54 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Wed, 8 Mar 2017 05:55:36 +0000 (14:55 +0900)
statement.c
test/expected/diagnostic.out
test/expected/diagnostic_1.out
test/expected/diagnostic_2.out

index 991cfcf7e5e31b0cb755320b9d6d8bd612f9bab9..69fd7671e61c0912a004044733fefece8ddecf72 100644 (file)
@@ -170,7 +170,7 @@ static const struct
 };
 
 static QResultClass *libpq_bind_and_exec(StatementClass *stmt);
-static void SC_set_errorinfo(StatementClass *self, QResultClass *res);
+static void SC_set_errorinfo(StatementClass *self, QResultClass *res, int errkind);
 static void SC_set_error_if_not_set(StatementClass *self, int errornumber, const char *errmsg, const char *func);
 
 
@@ -1610,7 +1610,7 @@ inolog("%s statement=%p res=%x ommitted=0\n", func, self, res);
            (self->currTuple)++;    /* all is well */
        else
        {
-           SC_set_errorinfo(self, res);
+           SC_set_errorinfo(self, res, 1);
            return SQL_ERROR;
        }
    }
@@ -2011,7 +2011,7 @@ SC_execute(StatementClass *self)
        else if (was_nonfatal)
            SC_set_errornumber(self, STMT_INFO_ONLY);
        else
-           SC_set_errorinfo(self, res);
+           SC_set_errorinfo(self, res, 0);
        /* set cursor before the first tuple in the list */
        self->currTuple = -1;
        SC_set_current_col(self, -1);
@@ -2948,7 +2948,7 @@ SC_set_error_if_not_set(StatementClass *self, int errornumber, const char *errms
 }
 
 static void
-SC_set_errorinfo(StatementClass *self, QResultClass *res)
+SC_set_errorinfo(StatementClass *self, QResultClass *res, int errkind)
 {
    ConnectionClass *conn = SC_get_conn(self);
 
@@ -2970,7 +2970,15 @@ SC_set_errorinfo(StatementClass *self, QResultClass *res)
            SC_set_error_if_not_set(self, STMT_INTERNAL_ERROR, "Internal error fetching next row", __FUNCTION__);
            break;
        default:
-           SC_set_error_if_not_set(self, STMT_EXEC_ERROR, "Error fetching next row", __FUNCTION__);
+           switch (errkind)
+           {
+               case 1:
+                   SC_set_error_if_not_set(self, STMT_EXEC_ERROR, "Error while fetching the next result", __FUNCTION__);
+                   break;
+               default:
+                   SC_set_error_if_not_set(self, STMT_EXEC_ERROR, "Error while executing the query", __FUNCTION__);
+                   break;
+           }
            break;
    }
 }
index 052306fd2f43b2185ae6e508f1431fa8a8520b68..2b947c181594b364753d4dc6f134dfe6fa4f30ac 100755 (executable)
@@ -17,8 +17,9 @@ SQLExecDirect
 42601=xxxxxxx
 42601
 killing connection...
-No error information
+57P01=FATAL: terminating connection due to administrator command;
+The connection has been lost
 SQLGetDiagRec on connection says:
-No error information
+57P01=FATAL: terminating connection due to administrator command
 SQLGetDiagRec called again:
-No error information
+57P01=FATAL: terminating connection due to administrator command
index 3dc70402ce16f769d5d6f00a5c3ced5154c766e0..3d611060b49adc8fdeafceee856c80525ff5b863 100755 (executable)
@@ -18,8 +18,8 @@ SQLExecDirect
 42601
 killing connection...
 57P01=FATAL: terminating connection due to administrator command;
-Error while executing the query
+The connection has been lost
 SQLGetDiagRec on connection says:
-57P01=FATAL: terminating connection due to administrator command
+No error information
 SQLGetDiagRec called again:
-57P01=FATAL: terminating connection due to administrator command
+No error information
index 244576ad7dae576742ff789507db2f2f7df5b501..052306fd2f43b2185ae6e508f1431fa8a8520b68 100755 (executable)
@@ -17,8 +17,7 @@ SQLExecDirect
 42601=xxxxxxx
 42601
 killing connection...
-57P01=FATAL: terminating connection due to administrator command;
-Error while executing the query
+No error information
 SQLGetDiagRec on connection says:
 No error information
 SQLGetDiagRec called again: