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

Function CheckSQLColAttribute

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

Source from the content-addressed store, hash-verified

131#endif // __linux__
132
133void CheckSQLColAttribute(SQLHSTMT stmt, SQLUSMALLINT idx,
134 const std::string& expected_column_name,
135 SQLLEN expected_data_type, SQLLEN expected_concise_type,
136 SQLLEN expected_display_size, SQLLEN expected_prec_scale,
137 SQLLEN expected_length,
138 const std::string& expected_literal_prefix,
139 const std::string& expected_literal_suffix,
140 SQLLEN expected_column_size, SQLLEN expected_column_scale,
141 SQLLEN expected_column_nullability,
142 SQLLEN expected_num_prec_radix, SQLLEN expected_octet_length,
143 SQLLEN expected_searchable, SQLLEN expected_unsigned_column) {
144 std::vector<SQLWCHAR> name(kOdbcBufferSize);
145 SQLSMALLINT name_len = 0;
146 std::vector<SQLWCHAR> base_column_name(kOdbcBufferSize);
147 SQLSMALLINT column_name_len = 0;
148 std::vector<SQLWCHAR> label(kOdbcBufferSize);
149 SQLSMALLINT label_len = 0;
150 std::vector<SQLWCHAR> prefix(kOdbcBufferSize);
151 SQLSMALLINT prefix_len = 0;
152 std::vector<SQLWCHAR> suffix(kOdbcBufferSize);
153 SQLSMALLINT suffix_len = 0;
154 SQLLEN data_type = 0;
155 SQLLEN concise_type = 0;
156 SQLLEN display_size = 0;
157 SQLLEN prec_scale = 0;
158 SQLLEN length = 0;
159 SQLLEN size = 0;
160 SQLLEN scale = 0;
161 SQLLEN nullability = 0;
162 SQLLEN num_prec_radix = 0;
163 SQLLEN octet_length = 0;
164 SQLLEN searchable = 0;
165 SQLLEN unsigned_col = 0;
166
167 EXPECT_EQ(SQL_SUCCESS, SQLColAttribute(stmt, idx, SQL_DESC_NAME, &name[0],
168 (SQLSMALLINT)name.size(), &name_len, nullptr));
169
170 EXPECT_EQ(
171 SQL_SUCCESS,
172 SQLColAttribute(stmt, idx, SQL_DESC_BASE_COLUMN_NAME, &base_column_name[0],
173 (SQLSMALLINT)base_column_name.size(), &column_name_len, nullptr));
174
175 EXPECT_EQ(SQL_SUCCESS, SQLColAttribute(stmt, idx, SQL_DESC_LABEL, &label[0],
176 (SQLSMALLINT)label.size(), &label_len, nullptr));
177
178 EXPECT_EQ(SQL_SUCCESS,
179 SQLColAttribute(stmt, idx, SQL_DESC_TYPE, 0, 0, nullptr, &data_type));
180
181 EXPECT_EQ(SQL_SUCCESS, SQLColAttribute(stmt, idx, SQL_DESC_CONCISE_TYPE, 0, 0, nullptr,
182 &concise_type));
183
184 EXPECT_EQ(SQL_SUCCESS, SQLColAttribute(stmt, idx, SQL_DESC_DISPLAY_SIZE, 0, 0, nullptr,
185 &display_size));
186
187 EXPECT_EQ(SQL_SUCCESS, SQLColAttribute(stmt, idx, SQL_DESC_FIXED_PREC_SCALE, 0, 0,
188 nullptr, &prec_scale));
189
190 EXPECT_EQ(SQL_SUCCESS,

Callers 1

TEST_FFunction · 0.85

Calls 3

SqlWcharToStringFunction · 0.85
SQLColAttributeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected