Skip to content

feat(c/driver-manager): polyfill numeric options for 1.0 drivers - #4774

Open
emecii wants to merge 2 commits into
apache:mainfrom
emecii:feat/4115-numeric-option-fallback
Open

emecii wants to merge 2 commits into
apache:mainfrom
emecii:feat/4115-numeric-option-fallback

Conversation

@emecii

@emecii emecii commented Sep 10, 2026

Copy link
Copy Markdown

Summary

  • track the version actually accepted during driver negotiation
  • for drivers negotiated down to ADBC 1.0, implement integer and double setters through the legacy string setter
  • preserve native ADBC 1.1 setters and keep byte setters unsupported
  • use locale-independent, round-trippable numeric formatting across database, connection, and statement options

AI assistance

OpenAI Codex was used to help implement and test this change.

Closes #4115

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is scoped, consistent across packaged copies, and comprehensively tests the negotiated-version behavior.

Pull request overview

Adds numeric option polyfills for ADBC 1.0 drivers negotiated by the driver manager.

Changes:

  • Tracks the negotiated driver version.
  • Converts integer and double options to locale-independent strings for legacy drivers.
  • Tests formatting, queued options, native setters, errors, and unsupported bytes.
File summaries
File Description
c/driver_manager/adbc_driver_manager_api.cc Implements C driver-manager polyfills.
go/adbc/drivermgr/adbc_driver_manager_api.cc Mirrors the polyfills for Go packaging.
c/driver_manager/adbc_version_100_compatibility_test.cc Adds ADBC 1.0 compatibility coverage.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +411 to +413
// Bridge numeric options only for drivers negotiated down to ADBC 1.0.0.
// Bytes deliberately remain unsupported: embedded NUL bytes have no lossless
// representation in the string-only API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Bridge numeric options only for drivers negotiated down to ADBC 1.0.0.
// Bytes deliberately remain unsupported: embedded NUL bytes have no lossless
// representation in the string-only API.

Let's clean up AI comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 2022a37 from both the C implementation and Go/CGo mirror.

AI-generated reply (OpenAI Codex).

class ScopedCommaLocale {
public:
ScopedCommaLocale() : previous_(std::locale()) {
std::locale::global(std::locale(previous_, new CommaDecimal));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we gonna leak a CommaDecimal instance?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::locale owns the facet: std::numpunct defaults to refs = 0, so the last locale referencing it deletes it (C++ lifetime rules). Restoring previous_ releases the comma locale. A destructor-counting probe confirmed cleanup, including exception unwinding and a retained locale copy; no ownership change is needed.

AI-generated reply (OpenAI Codex).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

c/driver_manager: polyfill SetOptionInt etc. by stringifying

3 participants