Skip to content

Get test suite building on Linux#165

Open
justing-bq wants to merge 1 commit intoapache-odbcfrom
test_build_linux
Open

Get test suite building on Linux#165
justing-bq wants to merge 1 commit intoapache-odbcfrom
test_build_linux

Conversation

@justing-bq
Copy link
Copy Markdown

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@justing-bq justing-bq force-pushed the test_build_linux branch 2 times, most recently from fc15dae to 4350de9 Compare March 26, 2026 19:16
@justing-bq justing-bq marked this pull request as ready for review March 27, 2026 20:02
Comment on lines +632 to +633
expected_date_time_sub, // expected_date_time_sub
0, // expected_octet_char_length
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency and if this won't break the build, could we pass 0 directly for expected_date_time_sub here and remove expected_date_time_sub = 0?

I see value 0 is accepted for expected_octet_char_length, although expected_octet_char_length is type SQLINTEGER and expected_date_time_sub is SQLSMALLINT; their types are different.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

SQLWCHAR input_str[] = L"SELECT * FROM mytable WHERE id == 1";
SQLINTEGER input_char_len = static_cast<SQLINTEGER>(wcslen(input_str));
ASSIGN_SQLWCHAR_ARR(input_str, L"SELECT * FROM mytable WHERE id == 1");
SQLINTEGER input_char_len = std::wcslen((const wchar_t*)input_str);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use c++ style casting (I think it's const_cast<>?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// Create expected return string based on buf size
SQLWCHAR expected_string_buf[small_buf_size_in_char];
wcsncpy(expected_string_buf, input_str, 10);
wcsncpy((wchar_t*)expected_string_buf, (wchar_t*)input_str, 10);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use C++ style casing for (wchar_t*)? Same comment for other places

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now using const_cast<wchar_t*>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justing-bq Could you push the changes for this?

Comment on lines +202 to +211

SQLSMALLINT expected_unsigned_attr = 0;
SQLSMALLINT expected_auto_unique_value = 0;
SQLSMALLINT expected_min_scale = 0;
SQLSMALLINT expected_max_scale = 0;
SQLSMALLINT expected_sql_datetime_sub = 0;
SQLSMALLINT expected_num_prec_radix = 0;
SQLSMALLINT expected_interval_prec = 0;
CheckSQLGetTypeInfo(stmt,
std::wstring(L"bit"), // expected_type_name
SQL_BIT, // expected_data_type
1, // expected_column_size
std::nullopt, // expected_literal_prefix
std::nullopt, // expected_literal_suffix
std::nullopt, // expected_create_params
SQL_NULLABLE, // expected_nullable
SQL_FALSE, // expected_case_sensitive
SQL_SEARCHABLE, // expected_searchable
NULL, // expected_unsigned_attr
SQL_FALSE, // expected_fixed_prec_scale
NULL, // expected_auto_unique_value
std::wstring(L"bit"), // expected_local_type_name
NULL, // expected_min_scale
NULL, // expected_max_scale
SQL_BIT, // expected_sql_data_type
NULL, // expected_sql_datetime_sub
NULL, // expected_num_prec_radix
NULL); // expected_interval_prec
std::wstring(L"bit"), // expected_type_name
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment as columns_test.cc, Let's pass 0 directly to CheckSQLGetTypeInfo. I think passing 0 instead of NULL here will work because NULL is not defined as 0 on Linux

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

GetInfoSQLWCHAR(conn, SQL_COLUMN_ALIAS, value);

EXPECT_STREQ(static_cast<const SQLWCHAR*>(L"Y"), value);
std::wstring result = ConvertToWString(value, std::wcslen((const wchar_t*)value));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here for using C++ style casting

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@justing-bq justing-bq force-pushed the test_build_linux branch 3 times, most recently from 8abdbf8 to da7fb82 Compare March 27, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants