Skip to content

Commit

Permalink
Added test cases for SQLNumParams
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry Leung committed Mar 23, 2021
1 parent e2311e5 commit 25c91a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/IntegrationTests/ITODBCExecution/test_odbc_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class TestSQLPrepare : public Fixture {};

class TestSQLDescribeParam : public Fixture {};

class TestSQLNumParams : public Fixture {};

/*class TestSQLSetCursorName : public testing::Test {
public:
TestSQLSetCursorName() {
Expand Down Expand Up @@ -253,6 +255,16 @@ TEST_F(TestSQLDescribeParam, DESCRIBE_PARAM) {
LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret);
}

TEST_F(TestSQLNumParams, NUM_PARAMS) {
SQLSMALLINT num = 0;
SQLRETURN ret = SQLNumParams(nullptr, &num);
EXPECT_EQ(SQL_ERROR, ret);
ret = SQLNumParams(m_hstmt, &num);
EXPECT_EQ(SQL_SUCCESS_WITH_INFO, ret);
EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, SQLSTATE_NOT_IMPLEMENTED_ERROR));
LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret);
}

TEST_F(TestSQLFetch, INVALID_HANDLE) {
EXPECT_EQ(SQL_INVALID_HANDLE, SQLFetch(nullptr));
}
Expand Down
1 change: 1 addition & 0 deletions src/IntegrationTests/ITODBCHelper/it_odbc_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define SQLSTATE_INVALID_STRING_OR_BUFFER_LENGTH (SQLWCHAR*)L"HY090"
#define SQLSTATE_INVALID_DESCRIPTOR_FIELD_IDENTIFIER (SQLWCHAR*)L"HY091"
#define SQLSTATE_NUMERIC_VALUE_OUT_OF_RANGE (SQLWCHAR*) L"HY019"
#define SQLSTATE_NOT_IMPLEMENTED_ERROR (SQLWCHAR*)L"HYC00"
#define SQLSTATE_STRING_CONVERSION_ERROR (SQLWCHAR*)L"22018"
#define SQLSTATE_INVALID_CURSUR_STATE (SQLWCHAR*)L"07005"
#define SQLSTATE_FRACTIONAL_TRUNCATION (SQLWCHAR*)L"01S07"
Expand Down

0 comments on commit 25c91a6

Please sign in to comment.