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

Method SetStmtAttr

cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.cc:553–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553void ODBCStatement::SetStmtAttr(SQLINTEGER statement_attribute, SQLPOINTER value,
554 SQLINTEGER buffer_size, bool is_unicode) {
555 size_t attribute_to_write = 0;
556 bool successfully_written = false;
557
558 switch (statement_attribute) {
559 case SQL_ATTR_APP_PARAM_DESC: {
560 ODBCDescriptor* desc = static_cast<ODBCDescriptor*>(value);
561 if (desc && current_apd_ != desc) {
562 if (current_apd_ != built_in_apd_.get()) {
563 current_apd_->DetachFromStatement(this, true);
564 }
565 current_apd_ = desc;
566 if (current_apd_ != built_in_apd_.get()) {
567 desc->RegisterToStatement(this, true);
568 }
569 }
570 return;
571 }
572 case SQL_ATTR_APP_ROW_DESC: {
573 ODBCDescriptor* desc = static_cast<ODBCDescriptor*>(value);
574 if (desc && current_ard_ != desc) {
575 if (current_ard_ != built_in_ard_.get()) {
576 current_ard_->DetachFromStatement(this, false);
577 }
578 current_ard_ = desc;
579 if (current_ard_ != built_in_ard_.get()) {
580 desc->RegisterToStatement(this, false);
581 }
582 }
583 return;
584 }
585 case SQL_ATTR_IMP_PARAM_DESC:
586 throw DriverException("Cannot assign implementation descriptor.", "HY017");
587 case SQL_ATTR_IMP_ROW_DESC:
588 throw DriverException("Cannot assign implementation descriptor.", "HY017");
589 // Attributes that are descriptor fields
590 case SQL_ATTR_PARAM_BIND_OFFSET_PTR:
591 current_apd_->SetHeaderField(SQL_DESC_BIND_OFFSET_PTR, value, buffer_size);
592 return;
593 case SQL_ATTR_PARAM_BIND_TYPE:
594 current_apd_->SetHeaderField(SQL_DESC_BIND_TYPE, value, buffer_size);
595 return;
596 case SQL_ATTR_PARAM_OPERATION_PTR:
597 current_apd_->SetHeaderField(SQL_DESC_ARRAY_STATUS_PTR, value, buffer_size);
598 return;
599 case SQL_ATTR_PARAM_STATUS_PTR:
600 ipd_->SetHeaderField(SQL_DESC_ARRAY_STATUS_PTR, value, buffer_size);
601 return;
602 case SQL_ATTR_PARAMS_PROCESSED_PTR:
603 ipd_->SetHeaderField(SQL_DESC_ROWS_PROCESSED_PTR, value, buffer_size);
604 return;
605 case SQL_ATTR_PARAMSET_SIZE:
606 current_apd_->SetHeaderField(SQL_DESC_ARRAY_SIZE, value, buffer_size);
607 return;
608 case SQL_ATTR_ROW_ARRAY_SIZE:
609 current_ard_->SetHeaderField(SQL_DESC_ARRAY_SIZE, value, buffer_size);
610 return;

Callers 2

SQLSetStmtAttrFunction · 0.80
SetConnectAttrMethod · 0.80

Calls 10

DriverExceptionClass · 0.85
SetAttributeFunction · 0.85
to_stringFunction · 0.85
DetachFromStatementMethod · 0.80
RegisterToStatementMethod · 0.80
SetHeaderFieldMethod · 0.80
AddWarningMethod · 0.80
getMethod · 0.45
SetAttributeMethod · 0.45

Tested by

no test coverage detected