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

Method GetField

cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.cc:291–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void ODBCDescriptor::GetField(SQLSMALLINT record_number, SQLSMALLINT field_identifier,
292 SQLPOINTER value, SQLINTEGER buffer_length,
293 SQLINTEGER* output_length) {
294 // Handle header fields before validating the record number.
295 switch (field_identifier) {
296 case SQL_DESC_ALLOC_TYPE:
297 case SQL_DESC_ARRAY_SIZE:
298 case SQL_DESC_ARRAY_STATUS_PTR:
299 case SQL_DESC_BIND_OFFSET_PTR:
300 case SQL_DESC_BIND_TYPE:
301 case SQL_DESC_ROWS_PROCESSED_PTR:
302 case SQL_DESC_COUNT:
303 GetHeaderField(field_identifier, value, buffer_length, output_length);
304 return;
305 default:
306 break;
307 }
308
309 if (record_number == 0) {
310 throw DriverException("Bookmarks are unsupported.", "07009");
311 }
312
313 if (static_cast<size_t>(record_number) > records_.size()) {
314 throw DriverException("Invalid descriptor index", "07009");
315 }
316
317 // GH-47867 TODO: Restrict fields based on AppDescriptor IPD, and IRD.
318
319 bool length_in_bytes = true;
320 SQLSMALLINT zero_based_record = record_number - 1;
321 const DescriptorRecord& record = records_[zero_based_record];
322 switch (field_identifier) {
323 case SQL_DESC_BASE_COLUMN_NAME:
324 GetAttributeSQLWCHAR(record.base_column_name, length_in_bytes, value, buffer_length,
325 output_length, GetDiagnostics());
326 break;
327 case SQL_DESC_BASE_TABLE_NAME:
328 GetAttributeSQLWCHAR(record.base_table_name, length_in_bytes, value, buffer_length,
329 output_length, GetDiagnostics());
330 break;
331 case SQL_DESC_CATALOG_NAME:
332 GetAttributeSQLWCHAR(record.catalog_name, length_in_bytes, value, buffer_length,
333 output_length, GetDiagnostics());
334 break;
335 case SQL_DESC_LABEL:
336 GetAttributeSQLWCHAR(record.label, length_in_bytes, value, buffer_length,
337 output_length, GetDiagnostics());
338 break;
339 case SQL_DESC_LITERAL_PREFIX:
340 GetAttributeSQLWCHAR(record.literal_prefix, length_in_bytes, value, buffer_length,
341 output_length, GetDiagnostics());
342 break;
343 case SQL_DESC_LITERAL_SUFFIX:
344 GetAttributeSQLWCHAR(record.literal_suffix, length_in_bytes, value, buffer_length,
345 output_length, GetDiagnostics());
346 break;
347 case SQL_DESC_LOCAL_TYPE_NAME:
348 GetAttributeSQLWCHAR(record.local_type_name, length_in_bytes, value, buffer_length,

Callers 2

SQLColAttributeFunction · 0.45
SQLDescribeColFunction · 0.45

Calls 4

DriverExceptionClass · 0.85
GetAttributeSQLWCHARFunction · 0.85
GetAttributeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected