On 2017/04/19 6:58 PM, James K. Lowden wrote:
On Sun, 16 Apr 2017 12:01:01 +0200
Darko Volaric <li...@darko.org> wrote:
There are good reasons to have stored procedures other than reducing
connection latency - developers like to encapsulate logic that is
associated entirely with the database in the database, use them to do
extended checking, to populate denormalized or derived data, or to
provide a level of abstraction, for instance.
Exactly so. A stored procedure can serve the same purpose as a
function in C: to assign a name to a particular body of code.
But the same effect can be had in SQLite without stored procedures per
se. In a few projects I've used the build repository to accomplish
much the same thing.//....
Indeed so, and I've had good success using a similar principle by simply
storing those SQL "files" as simple TEXT column in a table named
"StoredProcs" in any DB with a trivial step in the program to execute it
when needed - thus truly having "Stored Procedures" by virtue of placement.
However, I believe the main motivation of the requests do not intend the
placement of the procedures so much as the character thereof - They do
not care whether it is stored in a Trigger, File or Table, I believe the
real request is for a system of assignable variables ( LET @Name =
'John'; ) which could also be used as parameters in a query, or maybe
assignable datasets ( #TmpResult = Query('...'); ) - perhaps even
traversable datasets ( for each @Row in Query('...') do { ...
DoSomethingWith( @Row.Name ); ... } ) and next will be flow control ( IF
(thisIsTrue) BEGIN doThat(); END ).
Once we start on this road, ALL those will become wanted - all of which
are great, but probably outside the spirit of SQ"Lite".
(Note: I'm not advocating against. I myself am on the fence - using
SQLite so much and never in a size-sensitive anything, so it would be a
boon to have proper procedural execution within, but a "general target
audience" I don't make.)
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users