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

Function TEST_F

cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc:420–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420TEST_F(ColumnsMockTest, TestSQLColumnsAllColumns) {
421 // Check table pattern and column pattern returns all columns
422
423 // Attempt to get all columns
424 SQLWCHAR table_pattern[] = L"%";
425 SQLWCHAR column_pattern[] = L"%";
426
427 ASSERT_EQ(SQL_SUCCESS, SQLColumns(stmt, nullptr, SQL_NTS, nullptr, SQL_NTS,
428 table_pattern, SQL_NTS, column_pattern, SQL_NTS));
429
430 ASSERT_EQ(SQL_SUCCESS, SQLFetch(stmt));
431
432 // mock limitation: SQLite mock server returns 10 for bigint size when spec indicates
433 // should be 19
434 // DECIMAL_DIGITS should be 0 for bigint type since it is exact
435 // mock limitation: SQLite mock server returns 10 for bigint decimal digits when spec
436 // indicates should be 0
437 CheckMockSQLColumns(stmt,
438 std::wstring(L"main"), // expected_catalog
439 std::wstring(L"foreignTable"), // expected_table
440 std::wstring(L"id"), // expected_column
441 SQL_BIGINT, // expected_data_type
442 std::wstring(L"BIGINT"), // expected_type_name
443 10, // expected_column_size (mock returns 10 instead of 19)
444 8, // expected_buffer_length
445 15, // expected_decimal_digits (mock returns 15 instead of 0)
446 10, // expected_num_prec_radix
447 SQL_NULLABLE, // expected_nullable
448 SQL_BIGINT, // expected_sql_data_type
449 NULL, // expected_date_time_sub
450 8, // expected_octet_char_length
451 1, // expected_ordinal_position
452 std::wstring(L"YES")); // expected_is_nullable
453
454 // Check 2nd Column
455 ASSERT_EQ(SQL_SUCCESS, SQLFetch(stmt));
456
457 CheckMockSQLColumns(stmt,
458 std::wstring(L"main"), // expected_catalog
459 std::wstring(L"foreignTable"), // expected_table
460 std::wstring(L"foreignName"), // expected_column
461 SQL_WVARCHAR, // expected_data_type
462 std::wstring(L"WVARCHAR"), // expected_type_name
463 0, // expected_column_size (mock server limitation: returns 0 for
464 // varchar(100), the ODBC spec expects 100)
465 0, // expected_buffer_length
466 15, // expected_decimal_digits
467 0, // expected_num_prec_radix
468 SQL_NULLABLE, // expected_nullable
469 SQL_WVARCHAR, // expected_sql_data_type
470 NULL, // expected_date_time_sub
471 0, // expected_octet_char_length
472 2, // expected_ordinal_position
473 std::wstring(L"YES")); // expected_is_nullable
474
475 // Check 3rd Column
476 ASSERT_EQ(SQL_SUCCESS, SQLFetch(stmt));
477

Callers

nothing calls this directly

Calls 15

CheckMockSQLColumnsFunction · 0.85
CheckRemoteSQLColumnsFunction · 0.85
CheckSQLColAttributeFunction · 0.85
CheckSQLColAttributesFunction · 0.85
GetSQLColAttributeStringFunction · 0.85
GetSqlWCharSizeFunction · 0.85
VerifyOdbcErrorStateFunction · 0.85
GetQueryAllDataTypesMethod · 0.80
SQLColumnsFunction · 0.50
SQLFetchFunction · 0.50

Tested by

no test coverage detected