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

Reply via email to