Comments (1)
- Table reference: A table reference is a means of hoisting a C++ class ("mapped" as a table) into sqlite_orm's type system, and facilitates legible notation of explicit "column pointers", using the over-loadable pointer-to-member
operator->*()
. - Uniformity: With CTEs you end up using a lot of explicit column pointers. The pointer-to-member
operator->*()
provides a very legible notation compared tocolumn<>()
.
But then we would have 3 different notations of explicitly referring to a column:column<X>(&X::x)
for "mapped" classes,alias_column<A>(&X::id)
for aliased tables,x_cte->*&X::id
for CTEs.
Being able to use the same notation using the pointer-to-memberoperator->*()
for all is what I called "Uniform column pointer expressions".
You see the benefits of this notation in the description of PR #1247.
I would argue that explicit column pointer notation should be used before all others and should even be the canonical way. Writing SQL expressions requires less thinking and follows the same concept of "referencing columns"/"referring to columns" in all cases:
- You define a "moniker" for a result set, i.e. either table, aliased result set, or CTE.
- Then work with the columns of a result set using this defined moniker.
Short history for your edification:
Table references, the new way of defining tables aliases and uniform column pointer expressions arrived after the CTE feature, they were just merged before (see PR #1247 and #1144). I recognized the pattern of forming column pointers that refer to a column mapped into a CTE, using the strange but very convenient pointer-to-member operator->*()
. Extending the same syntactic sugar notation to aliased tables and result sets, the original column pointers felt like 2nd-class citizens. That's when "table references" came into existence.
from sqlite_orm.
Related Issues (20)
- sqlite-orm fails to compile under uwp HOT 5
- C:\src\sqlite_orm\tests\schema\virtual_table.cpp(6): exception: no such module: FTS5: SQL logic error HOT 2
- I need to store a vector of vector<std::string> as a field in a persistent class, how can I do this? HOT 8
- add column sync_schema will recreate table HOT 12
- compile error with gcc 5.3.1 HOT 6
- Windows linker error SQLite3 HOT 3
- Warning on CMake >= 3.27 because of support for CMake >= 2.8.12
- Cannot Build my project HOT 2
- `SQLITE_DQS` Compile Option HOT 7
- Failed to compile origin/dev branch using GCC 8.3 HOT 2
- Do not understand select statement generation HOT 3
- Support for returning objects inside columns HOT 6
- Corrupted Databases HOT 10
- why is this WITH not recursive? HOT 2
- FTS5 Options: Unindexed columns, prefix indexes, tokenizers & content HOT 25
- sync_schema_simulate when used with triggers HOT 11
- How to chain/assign conditions? HOT 4
- How to pre-expand when using the in-memory database mode? HOT 2
- Throwing std::system_error on sync_schema() ("SQL logic error") — syntax error? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlite_orm.