Fix a regression test failure in catalogfunctions-test. SQLTablePrivileges test case...
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 29 Jul 2016 07:05:20 +0000 (16:05 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 29 Jul 2016 07:21:16 +0000 (16:21 +0900)
test/src/catalogfunctions-test.c
test/src/common.c
test/src/common.h

index 6c677a3dcbe7baacad959ee9bd5dcbd4e77b972d..18d51be6bd12ebe33b950a4b28fd6359c9476c28 100644 (file)
@@ -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);
 
index 568d76683ff6ad0a30568a80e86d7ee86b72f9db..318bed63486ef5a0b8c2d62d370054d5155eeef9 100644 (file)
@@ -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);
 }
index 8803b0d18f23665bf471dc34ef133bac4d9dc651..278d0529ce373f55f706529bce52a68005136035 100644 (file)
@@ -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);