[Facebooker-talk] Bug when empty result set from fql_query within batch.
Alan Larkin
alan.larkin at gmail.com
Tue Jan 20 09:22:28 EST 2009
I think I've found a bug.
Try this for a user who is a fan of 0 pages (also happens for 0 listings, 0
notes, etc.).
pages = nil
facebook_session.batch do
pages = facebook_session.fql_query("SELECT page_id FROM page_fan WHERE uid =
#{facebook_id}", 'XML')
end
p pages
You would expect an empty array but what actually happens is an "unexpected
return" error.
I guess it must be something to do with the way #batch turns the body into a
block, but I don't really understand it.
Anyway, a fix is to rewrite #fql_query like:
if type.nil?
[]
else
...
end
rather than using an explicit return. I would stick this fix into my fork and
request a pull but perhaps someone will understand better and have a nicer fix?
Alan.
P.S.
Is anyone working on a JSON parser for fql_query? I hate to waste bandwidth on
bloated XML.
--
<a href="http://wikimediafoundation.org/wiki/Donate/en"><img border="0"
alt="Wikipedia Affiliate Button"
src="http://upload.wikimedia.org/wikipedia/foundation/5/58/2008_fundraiser_micro_button-en.png"
/></a>
More information about the Facebooker-talk
mailing list