On Sun, Jun 20, 2010 at 5:16 PM, Simon Slavin <slav...@bigfraud.org> wrote:
>
> On 20 Jun 2010, at 11:08pm, Sam Carleton wrote:
>
>> Simon,
>>
>> this is a direct CUT and PASTE from my code:
>>
>> #define SQL_GET_NEXT_SLIDE_SHOW_IMAGE \
>>       "SELECT FolderId, ImageId, instertedon " \
>>      "FROM V_FAVORITES_SELECTED " \
>>     "WHERE instertedon > julianday(@time) AND findLargeImage(@path,
>> FolderId, ImageId) = 1 " \
>>     "LIMIT 1"
>>
>> When I set a break point on the findLargeImage() function, it gets
>> called once for every row in the result set from [SELECT FolderId,
>> ImageId, instertedon FROM V_FAVORITES_SELECTED], the WHERE instertedon
>>>
>>   > julianday(@time) and the LIMIT 1 is NOT taken into account.  Thus,
>> the findLargeImage() is *NOT* short-circuiting the query.
>
> Hmm.  That suggests that SQLite is not implementing LIMIT 1 in a good way.  
> Perhaps someone could code up a trivial extension function with a breakpoint 
> and debug it.
>

iirc, LIMIT 1 is applied *after* the WHERE clause is satisfied. In
other words, the entire result set is returned, and then it is
LIMITed. So, the behavior is correct.

Once again, did you try Igor's suggestion? Exactly as he suggested?
Don't know if it will work or not, but this I can say -- if there is
one person in the entire SQL world you should listen to very
carefully, it is Igor. There is never any wasted words in his
suggestion, and his is almost always the correct solution. Try it,
then report back.



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



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to