On Mon, Apr 4, 2011 at 11:25 AM, Simon Slavin <slav...@bigfraud.org> wrote:
> Probably not.  Don't try to turn SQL into a procedural language.  Do the 
> SELECT that tells you whether the record exists and gives you the information 
> you need if it does, then do whatever INSERTs you need to do.

I agree with the first part.  I don't agree with the second.  SQL _is_
a programming language.  If you resort to using a procedural language
to do the things you don't know how to do in SQL then you're not
really meeting the spirit of your first recommendation.  This is why I
like the INSERT ... SELECT ... WHERE
<condition-that-would-go-in-an-if-then-else> idiom: it's declarative,
and it uses SQL as a programming language with less glue needed from
the host language.

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

Reply via email to