[OT] Idea to get all columns from multiple tables in DB
paolo.invernizzi at gmail.com
Thu Jan 9 15:36:00 UTC 2020
On Wednesday, 8 January 2020 at 23:01:14 UTC, Steven
> In my project, I only do generation of SQL for updating or
> inserting rows. For fetching elements, I write the SQL (by hand
> or through a sql building system I wrote) and then use the
> byItem serializer to get the records.
We also are writing SQL statements by hand, but I've found that's
really nice to have a compile time check against the current db
schemas. For example, actually I can do:
string stat = public!`select recording_id from recordings where
wrongcolname < 10`;
~/dlang/dmd-2.089.0/osx/bin/dmd -i -Isrc -g -unittest -debug -c
/Users/pinver/dlang/dmd-2.089.0/osx/bin/../../src/phobos/std/exception.d(515): Error: uncaught CTFE exception object.Error("column 'wrongcolname' does not exist: 'select recording_id from recordings where wrongcolname < 10'")
src/bkn/sql/semantic.d(75): called from here: <bigsnip>
The struct representing the schema is created reading and
processing a SQL file with the schema dump, dumping it once to a
D module, but can be done also at compile time.
That's pretty nice also using an IDE, for example I've configured
VSCode to compile-on-save and I've cool red underlines under the
wrong sql statements.
The semantic pass is really basic right now, but I've plan to
More information about the Digitalmars-d