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

Function CheckSQLColAttributes

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

Source from the content-addressed store, hash-verified

245
246#ifndef __APPLE__
247void CheckSQLColAttributes(SQLHSTMT stmt, SQLUSMALLINT idx,
248 const std::string& expected_column_name,
249 SQLLEN expected_data_type, SQLLEN expected_display_size,
250 SQLLEN expected_prec_scale, SQLLEN expected_length,
251 SQLLEN expected_column_size, SQLLEN expected_column_scale,
252 SQLLEN expected_column_nullability, SQLLEN expected_searchable,
253 SQLLEN expected_unsigned_column) {
254 std::vector<SQLWCHAR> name(kOdbcBufferSize);
255 SQLSMALLINT name_len = 0;
256 std::vector<SQLWCHAR> label(kOdbcBufferSize);
257 SQLSMALLINT label_len = 0;
258 SQLLEN data_type = 0;
259 SQLLEN display_size = 0;
260 SQLLEN prec_scale = 0;
261 SQLLEN length = 0;
262 SQLLEN size = 0;
263 SQLLEN scale = 0;
264 SQLLEN nullability = 0;
265 SQLLEN searchable = 0;
266 SQLLEN unsigned_col = 0;
267
268 EXPECT_EQ(SQL_SUCCESS, SQLColAttributes(stmt, idx, SQL_COLUMN_NAME, &name[0],
269 (SQLSMALLINT)name.size(), &name_len, nullptr));
270
271 EXPECT_EQ(SQL_SUCCESS,
272 SQLColAttributes(stmt, idx, SQL_COLUMN_LABEL, &label[0],
273 (SQLSMALLINT)label.size(), &label_len, nullptr));
274
275 EXPECT_EQ(SQL_SUCCESS,
276 SQLColAttributes(stmt, idx, SQL_COLUMN_TYPE, 0, 0, nullptr, &data_type));
277
278 EXPECT_EQ(SQL_SUCCESS, SQLColAttributes(stmt, idx, SQL_COLUMN_DISPLAY_SIZE, 0, 0,
279 nullptr, &display_size));
280
281 EXPECT_EQ(SQL_SUCCESS,
282 SQLColAttribute(stmt, idx, SQL_COLUMN_MONEY, 0, 0, nullptr, &prec_scale));
283
284 EXPECT_EQ(SQL_SUCCESS,
285 SQLColAttributes(stmt, idx, SQL_COLUMN_LENGTH, 0, 0, nullptr, &length));
286
287 EXPECT_EQ(SQL_SUCCESS,
288 SQLColAttributes(stmt, idx, SQL_COLUMN_PRECISION, 0, 0, nullptr, &size));
289
290 EXPECT_EQ(SQL_SUCCESS,
291 SQLColAttributes(stmt, idx, SQL_COLUMN_SCALE, 0, 0, nullptr, &scale));
292
293 EXPECT_EQ(SQL_SUCCESS, SQLColAttributes(stmt, idx, SQL_COLUMN_NULLABLE, 0, 0, nullptr,
294 &nullability));
295
296 EXPECT_EQ(SQL_SUCCESS, SQLColAttributes(stmt, idx, SQL_COLUMN_SEARCHABLE, 0, 0, nullptr,
297 &searchable));
298
299 EXPECT_EQ(SQL_SUCCESS, SQLColAttributes(stmt, idx, SQL_COLUMN_UNSIGNED, 0, 0, nullptr,
300 &unsigned_col));
301
302 std::string name_str = ODBC::SqlWcharToString(name);
303 std::string label_str = ODBC::SqlWcharToString(label);
304

Callers 1

TEST_FFunction · 0.85

Calls 3

SqlWcharToStringFunction · 0.85
SQLColAttributeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected