Very useful comments in this thread. I recommend adding this to the SQLite FAQ, if it exists.
-- Craig H Maynard Rhode Island, USA 401-413-2376 > Date: Tue, 8 May 2018 20:56:45 -0400 > From: Richard Hipp <d...@sqlite.org> > To: SQLite mailing list <email@example.com> > Subject: Re: [sqlite] Stored Procedures > Message-ID: > <CALwJ=My8bvtY+pyvXjy9p=p_vdeuqdno3fb82wedwbde6jn...@mail.gmail.com> > Content-Type: text/plain; charset="UTF-8" > > On 5/8/18, Jens Alfke <j...@mooseyard.com> wrote: >> >> >>> On May 8, 2018, at 1:02 PM, Mike Clark <cyberherbal...@gmail.com> wrote: >>> >>> Has there been any thought of implementing some kind of stored procedure >>> feature for SQLite? >> >> That's more of a server thing. In an embedded database, a stored procedure >> is literally a function in your programming language, which runs a SQLite >> query. >> > Right. > > To amplify Jens' remark: In a traditional client/server database, > there is high latency in the round-trip message from client to server > and back again. To work around this, client/server systems provide > stored procedures in which lots of little SQL statements can be > embedded, and then all run together in a single round-trip. But with > SQLite, there is no round-trip latency. A "round-trip" to and > database is just a function call, and is very very cheap. This one > fact removes a lot of the motivation behind having stored procedures. > > The other benefit of stored procedures is that it provides a way to > code up a common operation once (correctly!) and store it in the > database, rather than having multiple clients all have to work out the > operating themselves (some of them perhaps incorrectly). The usual > way of handling that in SQLite is to store a script in a text column > someplace, then execute them as needed. SQLite began life as a TCL > extension, and so naturally TCL scripts work very well for this kind > of thing. > > -- > D. Richard Hipp > d...@sqlite.org _______________________________________________ sqlite-users mailing list firstname.lastname@example.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users