From cb20e5f11fdb99340d0f2af9246bf6979a7d3e4f Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Fri, 29 Jul 2016 16:05:20 +0900 Subject: [PATCH] Fix a regression test failure in catalogfunctions-test. SQLTablePrivileges test case produces 5 * (1 + count of super users other than current user) lines. Limiting the output to the first 5 lines fixes the result anyway. --- test/src/catalogfunctions-test.c | 4 ++-- test/src/common.c | 8 +++++--- test/src/common.h | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/src/catalogfunctions-test.c b/test/src/catalogfunctions-test.c index 6c677a3..18d51be 100644 --- a/test/src/catalogfunctions-test.c +++ b/test/src/catalogfunctions-test.c @@ -77,7 +77,7 @@ main(int argc, char **argv) * to get the OID in output, and this information looks to be * enough. */ - print_result_series(hstmt, sql_column_ids, 6); + print_result_series(hstmt, sql_column_ids, 6, -1); rc = SQLFreeStmt(hstmt, SQL_CLOSE); CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt); @@ -185,7 +185,7 @@ main(int argc, char **argv) (SQLCHAR *) "testtab1", SQL_NTS); CHECK_STMT_RESULT(rc, "SQLTablePrivileges failed", hstmt); print_result_meta(hstmt); - print_result_series(hstmt, sql_tab_privileges_ids, 6); + print_result_series(hstmt, sql_tab_privileges_ids, 6, 5); rc = SQLFreeStmt(hstmt, SQL_CLOSE); CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt); diff --git a/test/src/common.c b/test/src/common.c index 568d766..318bed6 100644 --- a/test/src/common.c +++ b/test/src/common.c @@ -251,12 +251,13 @@ invalidate_buf(char *buf, size_t len) * Print result only for the selected columns. */ void -print_result_series(HSTMT hstmt, SQLSMALLINT *colids, SQLSMALLINT numcols) +print_result_series(HSTMT hstmt, SQLSMALLINT *colids, SQLSMALLINT numcols, SQLINTEGER rowcount) { SQLRETURN rc; + SQLINTEGER rowc = 0; printf("Result set:\n"); - while(1) + while (rowcount <0 || rowc < rowcount) { rc = SQLFetch(hstmt); if (rc == SQL_NO_DATA) @@ -267,6 +268,7 @@ print_result_series(HSTMT hstmt, SQLSMALLINT *colids, SQLSMALLINT numcols) int i; SQLLEN ind; + rowc++; for (i = 0; i < numcols; i++) { /* @@ -315,6 +317,6 @@ print_result(HSTMT hstmt) colids = (SQLSMALLINT *) malloc(numcols * sizeof(SQLSMALLINT)); for (i = 0; i < numcols; i++) colids[i] = i + 1; - print_result_series(hstmt, colids, numcols); + print_result_series(hstmt, colids, numcols, -1); free(colids); } diff --git a/test/src/common.h b/test/src/common.h index 8803b0d..278d052 100644 --- a/test/src/common.h +++ b/test/src/common.h @@ -39,7 +39,8 @@ extern void print_result_meta_series(HSTMT hstmt, SQLSMALLINT numcols); extern void print_result_series(HSTMT hstmt, SQLSMALLINT *colids, - SQLSMALLINT numcols); + SQLSMALLINT numcols, + SQLINTEGER rowcount); extern void print_result_meta(HSTMT hstmt); extern void print_result(HSTMT hstmt); extern const char *datatype_str(SQLSMALLINT datatype); -- 2.39.5