RSmith - I said "often", not "entirely". :)

Discussion about how to better use SQLite for an already working implementation 
or for a proposed implementation is a great and proper use of the list.  Coming 
onto the list and asking how to store a simple branch-and-leaf tree structure 
in SQL is not.  Complaining about bugs in the "datetime" implementation when 
you clearly haven't read the data types help page to understand that it's being 
stored as text is also not a proper use of the list.  The SQLite docs are 
really quite good, some of the best I've seen on open source projects.

Yours was what I read as the shoot-down, not Simon's, FWIW.  Most people aren't 
designing their own ORMs/sql wrappers, they're using existing ones, often with 
limitations.  One could argue that they "should" write their own, but then that 
same argument could be used against the existence of all of managed code or 
reusable libraries, so that's a bit of a red herring.  Saying to comment the 
code isn't as helpful either.  You can comment things as much as you want, but 
if you have a 500 character complicated subquery, on which you want to then do 
a couple different things, writing "/* same thing as above*/" doesn't really 
help with either code maintainability or query optimization.  Being able to 
refactor duplicate code into a common function is kind of the cornerstone of 
programming languages.

CTEs aren't part of a variable-based system, they're a very simple 
#include-type syntax, that simultaneously gives a great hint to the QO that 
that statement should be executed as a separate subquery.  For whatever reason, 
it may actually be very complicated to implement this sort of thing into 
SQLite, but bringing in all sorts of things that should be unrelated is, well, 
irrelevant to the question at hand.

SQLite seems to be slowly moving in the direction of there being a bunch of 
compile-type options for advanced features (FTS, etc.)  CTE could be one of 
those, if it turns out to be a monster to implement.  I just have no idea about 
the underlying complexity of the VM to know whether that's really necessary or 
not.  I would assume it would be fairly simple, and also provide a great 
workaround mechanism for users experiencing difficulty getting the QO to do 
what they want under other circumstances.  However, that may be wrong on both 
counts. :)

-David
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to