Skip to content

Add table-name accessors for result columns - #594

Merged
SRombauts merged 2 commits into
SRombauts:masterfrom
ac1982:555-feature-column-table-name
Oct 17, 2026
Merged

SRombauts merged 2 commits into
SRombauts:masterfrom
ac1982:555-feature-column-table-name

Conversation

@ac1982

@ac1982 ac1982 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #555. Add Statement::getColumnTableName() and Column::getTableName() under SQLITE_ENABLE_COLUMN_METADATA, so callers can retrieve the source table without preparing another statement. The API preserves SQLite's null and pointer-lifetime semantics.

Validation: 72 tests pass with CMake/GCC, CMake/Clang ASan+UBSan, and Meson with metadata enabled; 69 pass with metadata disabled. CMake examples and an independent consumer also pass. After rebasing onto #595, the public Meson consumer checks both table-name APIs; system/shared and bundled/shared/static configurations pass, as does bundled/static with metadata disabled. The project-settings lint findings match the baseline; Windows/macOS and Doxygen were not run.

Prepared and validated with OpenAI Codex. The changelog is in a separate final commit, as requested by the contribution workflow.

@SRombauts SRombauts self-assigned this Oct 16, 2026
@coveralls

coveralls commented Oct 16, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 99.716% (+0.002%) from 99.714% — ac1982:555-feature-column-table-name into SRombauts:master

@SRombauts

Copy link
Copy Markdown
Owner

Hello, thanks for your contribution.

It looks nice and clean, congrats!

I found a slightly related bug in the Meson build, so I created (and now merge) the PR #595 to fix Meson column metadata propagation

Now, it would be nice if you could:

  1. Rebase onto the latest master, now that Fix Meson column metadata propagation #595 is merged.
  2. Extend the new Meson consumer test (tests/consumer/column_metadata.cpp) to exercise both new APIs:
  • Statement::getColumnTableName(0)
  • Column::getTableName()
    The existing test already creates a table named test and checks the origin-column APIs. Adding assertions that both new accessors return "test" would be straightforward.
    This would verify that the new APIs work through the public Meson dependency, with metadata enabled, across the new CI configurations.

Expose the source table through the existing column metadata API so
callers need not prepare another statement or access a raw handle.

Fixes SRombauts#555
@ac1982
ac1982 force-pushed the 555-feature-column-table-name branch from c9bddfa to 94300b1 Compare October 17, 2026 04:00
@ac1982

ac1982 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto d43b758, including #595, and extended the public Meson consumer test to check that both new accessors return "test".

The library, examples, unit tests and consumer pass locally with system SQLite/shared, bundled SQLite/shared, bundled SQLite/static, and bundled SQLite/static with metadata disabled. The system SQLite lane used fallback GTest because system GTest is unavailable here. Changelog remains the final separate commit.

@SRombauts
SRombauts merged commit 940f6eb into SRombauts:master Oct 17, 2026
37 checks passed
@SRombauts

Copy link
Copy Markdown
Owner

Thanks a lot, that's a nice one I had intended to implement! (but found other problems in the way, that I fixed instead)
Cheers!

@Feneck91

Copy link
Copy Markdown

Is this feature will be integrate to 3.5.0 (in C++ 11 compatibility?)

@SRombauts

Copy link
Copy Markdown
Owner

Hey @Feneck91, why not, if this is something that you would like I can see how much work it is!

SRombauts added a commit that referenced this pull request Oct 22, 2026
Add the Statement and Column APIs from #594 to the 3.4.x
maintenance line, including metadata lifetime and reprepare tests.

Copy link
Copy Markdown
Owner

@Feneck91 I've opened #599 to backport both table-name accessors to the C++11-compatible sqlitecpp-3.4.x maintenance branch for the planned 3.5.0 release. The PR also includes the small Meson metadata fix needed for consumers. CI is running; feedback is welcome.

SRombauts added a commit that referenced this pull request Oct 23, 2026
Add the Statement and Column APIs from #594 without requiring
C++17 or newer SQLite functionality. Cover expressions, joins,
invalid indexes, and retained columns in unit and Meson tests.
SRombauts added a commit that referenced this pull request Oct 23, 2026
Backport `Statement::getColumnTableName()` and `Column::getTableName()`
from #594 to the C++11 maintenance branch (fixes #555 for the 3.x line).
Both remain guarded by `SQLITE_ENABLE_COLUMN_METADATA`.

Add unit tests and extend the Meson consumer test introduced by #600. No
#598 reprepare-cache fix, new SQLite API requirement, or
reprepare-specific regression test. CI validation is pending.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is it possible to access to sqlite3_column_table_name sqlite3 function from SQLite::Statement?

4 participants