Question

Let me preface this by saying that my code seems to work for all users I've tested with but one.

I'm using the following multiquery to get a user's albums and cover image data:

{
   "album_query": " SELECT aid, object_id, name, modified, size, link, cover_pid FROM album WHERE owner = me() ORDER BY modified DESC",
   "cover_query": " SELECT pid, src_small, src_small_width, src_small_height FROM photo WHERE pid IN (SELECT cover_pid FROM #album_query)"
}

The query works as expected. The aid's that it returns are 100002647632588_33813 and 100002647632588_19303. Note that this is the only instance I've seen where an aid has a '_' in it.

My guess is that this is where the problem is, but moving on.

Later I run the following FQL query to get the latest 9 photos in a given album:

SELECT pid, object_id, src, src_width, src_height, src_big, src_big_width, src_big_height, modified FROM photo WHERE aid = 100002647632588_19303 ORDER BY modified DESC LIMIT 0, 9

I get the following response:

{ error_code: "601", error_msg: "Parser error: unexpected '_19303' at position 138.", ...}

This looks like a bug on facebook's end since I'm using an id that they provided, but I'm hoping a few more sets of eyes will sort me out.

Thank you for any and all help.

Was it helpful?

Solution

You need to either put "" round the aid - "100002647632588_19303" or use %22 to escape it correctly so it reads as a string and not a number -

like this -

SELECT pid, object_id, src, src_width, src_height, src_big, src_big_width, src_big_height, modified FROM photo WHERE aid = "100002647632588_19303" ORDER BY modified DESC LIMIT 0, 9

or

SELECT pid, object_id, src, src_width, src_height, src_big, src_big_width, src_big_height, modified FROM photo WHERE aid = %22100002647632588_19303%22 ORDER BY modified DESC LIMIT 0, 9
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top