commit b79f5cd2602747100c21ccd98f012eaf63028032 Author: Michael Paquier Date: Mon Mar 24 13:20:18 2014 +0900 Add test for SQLGetConnectOption in deprecated section diff --git a/test/expected/deprecated.out b/test/expected/deprecated.out index 7e31d76..3c35c7c 100644 --- a/test/expected/deprecated.out +++ b/test/expected/deprecated.out @@ -3,6 +3,8 @@ Check for SQLAllocEnv Check for SQLAllocConnect Check for SQLAllocStmt Check for SQLSetConnectOption +Check for SQLGetConnectOption +Access type is: read-write Check for SQLError Error check: ERROR: relation "table_not_here" does not exist; Error while executing the query diff --git a/test/src/deprecated-test.c b/test/src/deprecated-test.c index 2fa7e0c..923ac46 100644 --- a/test/src/deprecated-test.c +++ b/test/src/deprecated-test.c @@ -11,7 +11,7 @@ void print_cursor_type(SQLINTEGER cursor_type) { - printf( "Cursor type is: " ) ; + printf("Cursor type is: "); if (cursor_type == SQL_CURSOR_FORWARD_ONLY) printf("forward\n"); else if (cursor_type == SQL_CURSOR_STATIC) @@ -25,6 +25,21 @@ print_cursor_type(SQLINTEGER cursor_type) } } +void +print_access_type(SQLINTEGER access_type) +{ + printf("Access type is: "); + if (access_type == SQL_MODE_READ_ONLY) + printf("read-only\n"); + else if (access_type == SQL_MODE_READ_WRITE) + printf("read-write\n"); + else + { + printf("Incorrect type of access\n"); + exit(1); + } +} + /* Array size for SQLParamOptions test */ #define ARRAY_SIZE 10 @@ -93,6 +108,7 @@ main(int argc, char **argv) } /* + * SQLSetConnectOption -> SQLSetConnectAttr * SQLGetConnectOption -> SQLGetConnectAttr * Test connection attribute. */ @@ -101,6 +117,12 @@ main(int argc, char **argv) SQL_ATTR_ACCESS_MODE, SQL_MODE_READ_WRITE); CHECK_STMT_RESULT(rc, "SQLSetConnectOption failed", hstmt); + printf("Check for SQLGetConnectOption\n"); + rc = SQLGetConnectOption(conn2, + SQL_ATTR_ACCESS_MODE, + &valint); + CHECK_STMT_RESULT(rc, "SQLGetConnectOption failed", hstmt); + print_access_type(valint); /* * SQLError -> SQLGetDiagRec