On Sun, Jun 20, 2010 at 5:23 PM, Igor Tandetnik <itandet...@mvps.org> wrote:
> In what way did the statement I gave you, exactly as written, fail to satisfy > your requirements? Igor, When I put in EXACTLY what you gave me: SELECT FolderId, ImageId, instertedon FROM V_FAVORITES_SELECTED WHERE case when instertedon > julianday(@time) then findImage(@path, FolderId, ImageId) else 0 end; I am getting the EXACT same result, it calls findImage on for EVERY row in the result set. The goal is to have the findImage() short-circuit the where clause so that once it returns 1 one time, it stops. Aka lots of 0's can be returned, but only one 1. Let me try pseudo coding it differently: Return the first row from [ SELECT FolderId, ImageId, instertedon FROM V_FAVORITES_SELECTED WHERE instertedon > julianday(@time) ] where extension function findImage(@path, FolderId, ImageId) returns 1 If I where to code this in C/C++, I would do something like this: prepare "SELECT FolderId, ImageId, instertedon FROM V_FAVORITES_SELECTED WHERE instertedon > julianday(@time)" do(step) { if( findImage(@rootPath, FolderId, ImageId) == 1) break; } The goal is to call findImage() just enough to find a result, then stop. Sam _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users