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

Function SQLColAttribute

cpp/src/arrow/flight/sql/odbc/odbc_api.cc:1338–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1336}
1337
1338SQLRETURN SQLColAttribute(SQLHSTMT stmt, SQLUSMALLINT record_number,
1339 SQLUSMALLINT field_identifier,
1340 SQLPOINTER character_attribute_ptr, SQLSMALLINT buffer_length,
1341 SQLSMALLINT* output_length, SQLLEN* numeric_attribute_ptr) {
1342 ARROW_LOG(DEBUG) << "SQLColAttributeW called with stmt: " << stmt
1343 << ", record_number: " << record_number
1344 << ", field_identifier: " << field_identifier
1345 << ", character_attribute_ptr: " << character_attribute_ptr
1346 << ", buffer_length: " << buffer_length
1347 << ", output_length: " << static_cast<const void*>(output_length)
1348 << ", numeric_attribute_ptr: "
1349 << static_cast<const void*>(numeric_attribute_ptr);
1350
1351 using ODBC::ODBCDescriptor;
1352 using ODBC::ODBCStatement;
1353 return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() {
1354 ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt);
1355 ODBCDescriptor* ird = statement->GetIRD();
1356 SQLINTEGER output_length_int;
1357 switch (field_identifier) {
1358 // Numeric attributes
1359 // internal is SQLLEN, no conversion is needed
1360 case SQL_DESC_DISPLAY_SIZE:
1361 case SQL_DESC_OCTET_LENGTH: {
1362 ird->GetField(record_number, field_identifier, numeric_attribute_ptr,
1363 buffer_length, &output_length_int);
1364 break;
1365 }
1366 // internal is SQLULEN, conversion is needed.
1367 case SQL_COLUMN_LENGTH: // ODBC 2.0
1368 case SQL_DESC_LENGTH: {
1369 SQLULEN temp;
1370 ird->GetField(record_number, field_identifier, &temp, buffer_length,
1371 &output_length_int);
1372 if (numeric_attribute_ptr) {
1373 *numeric_attribute_ptr = static_cast<SQLLEN>(temp);
1374 }
1375 break;
1376 }
1377 // internal is SQLINTEGER, conversion is needed.
1378 case SQL_DESC_AUTO_UNIQUE_VALUE:
1379 case SQL_DESC_CASE_SENSITIVE:
1380 case SQL_DESC_NUM_PREC_RADIX: {
1381 SQLINTEGER temp;
1382 ird->GetField(record_number, field_identifier, &temp, buffer_length,
1383 &output_length_int);
1384 if (numeric_attribute_ptr) {
1385 *numeric_attribute_ptr = static_cast<SQLLEN>(temp);
1386 }
1387 break;
1388 }
1389 // internal is SQLSMALLINT, conversion is needed.
1390 case SQL_DESC_CONCISE_TYPE:
1391 case SQL_DESC_COUNT:
1392 case SQL_DESC_FIXED_PREC_SCALE:
1393 case SQL_DESC_TYPE:
1394 case SQL_DESC_NULLABLE:
1395 case SQL_COLUMN_PRECISION: // ODBC 2.0

Callers 5

CheckSQLColAttributeFunction · 0.50
CheckSQLColAttributesFunction · 0.50
GetSQLColAttributeStringFunction · 0.50
TYPED_TESTFunction · 0.50

Calls 3

DriverExceptionClass · 0.85
GetIRDMethod · 0.80
GetFieldMethod · 0.45

Tested by 5

CheckSQLColAttributeFunction · 0.40
CheckSQLColAttributesFunction · 0.40
GetSQLColAttributeStringFunction · 0.40
TYPED_TESTFunction · 0.40