On Sunday, 11 January 2015 at 10:06:53 UTC, Paolo Invernizzi
wrote:
On Saturday, 10 January 2015 at 20:53:47 UTC, DaveG wrote:
On Saturday, 10 January 2015 at 18:31:18 UTC, Paolo Invernizzi
wrote:
I would like to see, someday, something in D that:
- can check at compile time the syntax of SQL;
- can check at compile time the SQL query statement against
the current DB schema;
- can read the output of a DB schema dump at CT, and parse it
into what is needed for the previous points (more
complicated);
One final note. You may have noticed I didn't mention the
schema syncing problem (keeping database and code in sync).
There was a time I would have said that was essential and
while it would be nice in a perfect world, I'm comfortable
keeping them in sync manually (or semi-manual with scripts). I
can generate a bunch of classes from an existing database
fairly easily and when I change a table I can manually update
a class. If I was writing SQL directly I would have to update
my query, this is really no different. Doing validation in
unit tests is perfectly acceptable to me.
I think basically we have the same feeling over the ORM topic.
Doing validation in unit tests is for sure acceptable, but my
point is that I would like CT validation of plain SQL query
over the current DB schema.... without having to use an ORM. ;-)
---
Paolo
I agree. That's one thing Couldfusion did well that I haven't
really seen since. You could write blocks of SQL complete with
validation and syntax highlighting (depending on the editor).
Because the SQL parser was built in you could then take
resultsets returned from the database and perform additional
queries on them locally.
The problem a SQL parser doesn't solve is writing dynamic queries
which require piecing together a bunch of partial statements.
This is where an abstraction layer can really be useful.
-Dave