Not literally enough, in fact, as Erin ably explained. Igor Tandetnik
Sam Carleton <scarle...@miltonstreet.com> wrote: > You lost me;) I think I might be taking you too literally, here is > what I tried: > > SELECT FolderId, ImageId, instertedon > FROM V_FAVORITES_SELECTED > WHERE instertedon > julianday(@time) > THEN findImage(@rootPath, FolderId, ImageId) ELSE 0 END; > > The prepare statement didn't much like something around the THEN statement. > > Sam > > On Sun, Jun 20, 2010 at 9:33 AM, Igor Tandetnik <itandet...@mvps.org> wrote: >> Sam Carleton <scarle...@miltonstreet.com> wrote: >>> This works great. The issue is that the image returned might NOT >>> exist anymore, so I created an extension function to return 1 if it >>> exists, 0 if it doesn't, findImage( RootPath, FolderId, ImageId). >>> Then I added to the select statement like this: >>> >>> SELECT FolderId, ImageId, instertedon >>> FROM V_FAVORITES_SELECTED >>> WHERE instertedon > julianday(@time) AND findImage( @rootPath, >>> FolderId, ImageId) = 1 >>> LIMIT 1 >>> >>> The findLargeImage gets called for EVERY row. I was hoping there >>> would be some sort of short-circuit evaluation, like there is in C/C++ >>> and many other languages. Is there some way I could rewrite the query >>> to short-circuit so that findImage() >> >> Try something like this: >> >> WHERE case when instertedon > julianday(@time) >> then findImage(@rootPath, FolderId, ImageId) >> else 0 end; >> >> -- >> Igor Tandetnik >> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users