Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builtin support for SQLite schema table #1166

Merged
merged 11 commits into from
Mar 26, 2023
Merged

Conversation

trueqbit
Copy link
Collaborator

Ability to add the table "sqlite_master" to a storage and select from it or its alias "sqlite_schema".

Additionally:

  • Ability to "get all" from an aliased table

Still open for discussion:

  1. Despite the fact that the schema table was renamed from "sqlite_master" to "sqlite_schema" in SQLite 3.33.0, the renaming process was more like keeping the previous name "sqlite_master" and appending an internal alias "sqlite_schema".
    This fact can be deduced from the following:
    If the set of columns is qualified, the following select statement will fail with the error "no such table: sqlite_schema": SELECT sqlite_schema.* from sqlite_schema.
    So I suggest keeping the previous table name "sqlite_master" and providing "sqlite_schema" as a table alias in sqlite_orm.
  2. Was get_all<Object>() intended to be shorthand for select(object<Object>())? If so, it makes sense to provide overloads for selecting from an alias table. Otherwise I don't want to fall into over-engineering.

@trueqbit trueqbit linked an issue Mar 25, 2023 that may be closed by this pull request
@trueqbit trueqbit marked this pull request as draft March 25, 2023 21:10
dev/statement_serializer.h Outdated Show resolved Hide resolved
tests/tests3.cpp Outdated Show resolved Hide resolved
@trueqbit trueqbit marked this pull request as ready for review March 26, 2023 19:19
@trueqbit trueqbit requested a review from fnc12 March 26, 2023 19:20
@trueqbit
Copy link
Collaborator Author

I packed a bunch of other code quality improvements into this PR because they popped up while I was working on it. Most notable:

  • Corrected EOL sequence in header files to LF
  • unit tests: Corrected decomposition for expressions required to be false
  • appveyor: Enabled unit testing SQLite json1 functionality

@trueqbit trueqbit merged commit ae8b1fa into fnc12:dev Mar 26, 2023
@trueqbit trueqbit deleted the schema_table branch March 26, 2023 22:08
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.

Builtin support select from sqlite_schema
2 participants