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

Function CheckSQLColAttributes

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

Source from the content-addressed store, hash-verified

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

Callers 1

TEST_FFunction · 0.85

Calls 3

SqlWcharToStringFunction · 0.85
SQLColAttributeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected