| 418 | } |
| 419 | |
| 420 | TEST_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 |
nothing calls this directly
no test coverage detected