MCPcopy Create free account
hub / github.com/apache/arrow / TEST_F

Function TEST_F

cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:319–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319TEST_F(ConnectionRemoteTest, TestSQLConnectInputUidPwd) {
320 // Connect string
321 std::string connect_str = GetConnectionString();
322
323 // Retrieve valid uid and pwd, assumes TEST_CONNECT_STR contains uid and pwd
324 Connection::ConnPropertyMap properties;
325 ODBC::ODBCConnection::GetPropertiesFromConnString(connect_str, properties);
326 std::string uid_key("uid");
327 std::string pwd_key("pwd");
328 std::string uid = properties[uid_key];
329 std::string pwd = properties[pwd_key];
330
331 // Write connection string content without uid and pwd into a DSN,
332 // must succeed before continuing
333 properties.erase(uid_key);
334 properties.erase(pwd_key);
335 ASSERT_TRUE(WriteDSN(properties));
336
337 std::string dsn(kTestDsn);
338 ASSERT_OK_AND_ASSIGN(std::wstring wdsn, arrow::util::UTF8ToWideString(dsn));
339 ASSERT_OK_AND_ASSIGN(std::wstring wuid, arrow::util::UTF8ToWideString(uid));
340 ASSERT_OK_AND_ASSIGN(std::wstring wpwd, arrow::util::UTF8ToWideString(pwd));
341 std::vector<SQLWCHAR> dsn0(wdsn.begin(), wdsn.end());
342 std::vector<SQLWCHAR> uid0(wuid.begin(), wuid.end());
343 std::vector<SQLWCHAR> pwd0(wpwd.begin(), wpwd.end());
344
345 // Connecting to ODBC server.
346 ASSERT_EQ(SQL_SUCCESS,
347 SQLConnect(this->conn, dsn0.data(), static_cast<SQLSMALLINT>(dsn0.size()),
348 uid0.data(), static_cast<SQLSMALLINT>(uid0.size()), pwd0.data(),
349 static_cast<SQLSMALLINT>(pwd0.size())))
350 << GetOdbcErrorMessage(SQL_HANDLE_DBC, this->conn);
351
352 // Remove DSN
353 ASSERT_TRUE(UnregisterDsn(wdsn));
354
355 // Disconnect from ODBC
356 ASSERT_EQ(SQL_SUCCESS, SQLDisconnect(this->conn))
357 << GetOdbcErrorMessage(SQL_HANDLE_DBC, this->conn);
358}
359
360TEST_F(ConnectionRemoteTest, TestSQLConnectInvalidUid) {
361 // Connect string

Callers

nothing calls this directly

Calls 13

WriteDSNFunction · 0.85
GetOdbcErrorMessageFunction · 0.85
UnregisterDsnFunction · 0.85
VerifyOdbcErrorStateFunction · 0.85
SqlWcharToStringFunction · 0.85
SQLConnectFunction · 0.50
SQLDisconnectFunction · 0.50
SQLDriverConnectFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected