apache / apache/arrow

[FlightSQL][C++][ODBC] Add DML support to the ODBC driver

Open
#51,115 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the enhancement requested

Currently the ODBC driver explicitly only allows `SELECT` (see references [0] to [2]).

This issue spans adding a write-path to the driver for DML/DDL using `DoPut` and obtaining the returned row count.

`SQLExecute` and `SQLExecDirect` should both allow DML/DDL.

`SQLRowCount` should return the number of rows affected by an UPDATE, INSERT, or DELETE statement (as per the [ODBC spec](https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlrowcount-function?view=sql-server-ver17))

Depends on #51114.

This is the C++ analogue of https://github.com/apache/arrow-adbc/issues/4074

### Component(s)

FlightRPC

Related
- #49497
- #49498
- #51114
- #30622 (parent issue for the ODBC driver)

References:
[0]-https://github.com/apache/arrow/blob/2e448f91a97a42c452e798796f0811b64406d26f/cpp/src/arrow/flight/sql/odbc/odbc_api.cc#L1076
[1]-https://github.com/apache/arrow/blob/2e448f91a97a42c452e798796f0811b64406d26f/cpp/src/arrow/flight/sql/odbc/odbc_api.cc#L1043
[2]-https://github.com/apache/arrow/blob/2e448f91a97a42c452e798796f0811b64406d26f/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.cc#L801-L810

Contributor guide

Open the contributing guide

Research direction

Start with the referenced SQLExecute and SQLExecDirect checks in cpp/src/arrow/flight/sql/odbc/odbc_api.cc and the statement logic around lines 801-810 in odbc_impl/odbc_statement.cc. Review dependency #51114 before tracing the FlightSQL DoPut write path. Done means DML and DDL work through both execution APIs and SQLRowCount reports affected rows for INSERT, UPDATE, and DELETE.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sql
Domain
backend-api-design, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.