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

Function SQLNativeSql

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

Source from the content-addressed store, hash-verified

1495}
1496
1497SQLRETURN SQLNativeSql(SQLHDBC conn, SQLWCHAR* in_statement_text,
1498 SQLINTEGER in_statement_text_length, SQLWCHAR* out_statement_text,
1499 SQLINTEGER buffer_length, SQLINTEGER* out_statement_text_length) {
1500 ARROW_LOG(DEBUG) << "SQLNativeSqlW called with connection_handle: " << conn
1501 << ", in_statement_text: "
1502 << static_cast<const void*>(in_statement_text)
1503 << ", in_statement_text_length: " << in_statement_text_length
1504 << ", out_statement_text: "
1505 << static_cast<const void*>(out_statement_text)
1506 << ", buffer_length: " << buffer_length
1507 << ", out_statement_text_length: "
1508 << static_cast<const void*>(out_statement_text_length);
1509
1510 using ODBC::GetAttributeSQLWCHAR;
1511 using ODBC::ODBCConnection;
1512 using ODBC::SqlWcharToString;
1513
1514 return ODBCConnection::ExecuteWithDiagnostics(conn, SQL_ERROR, [=]() {
1515 const bool is_length_in_bytes = false;
1516
1517 ODBCConnection* connection = reinterpret_cast<ODBCConnection*>(conn);
1518 Diagnostics& diagnostics = connection->GetDiagnostics();
1519
1520 std::string in_statement_str =
1521 SqlWcharToString(in_statement_text, in_statement_text_length);
1522
1523 return GetAttributeSQLWCHAR(in_statement_str, is_length_in_bytes, out_statement_text,
1524 buffer_length, out_statement_text_length, diagnostics);
1525 });
1526}
1527
1528SQLRETURN SQLDescribeCol(SQLHSTMT stmt, SQLUSMALLINT column_number, SQLWCHAR* column_name,
1529 SQLSMALLINT buffer_length, SQLSMALLINT* name_length_ptr,

Callers 1

TYPED_TESTFunction · 0.50

Calls 2

SqlWcharToStringFunction · 0.85
GetAttributeSQLWCHARFunction · 0.85

Tested by 1

TYPED_TESTFunction · 0.40