I would like that in the same reply along the data itself I could request, with a suitable extra url-argument to have information about element name of each record, the field names to expect from the reply and their data type so that if I ask for the following URL (notice the las two arguments):
CODE
http://query.yahooapis.com/v1/public/yql?q=desc%20flickr.photos.search&format=json&callback=cbfunc&diagnostics=false&fieldinfo=true
I get something like:
CODE
cbfunc({
"query":{
"count":"10",
"created":"2009-07-02T08:05:15Z",
"lang":"en-US",
"updated":"2009-07-02T08:05:15Z",
"uri":"http://query.yahooapis.com/v1/yql?q=select+*+from+flickr.photos.search+where+text+%3D+%22YDN%22",
"fieldinfo":{
"recordName":"photo",
"fields":[
"key":[{
"name":"farm",
"type":"xs:string"
},
{
"name":"id",
"type":"xs:string"
},
{
"name":"isfamily",
"type":"xs:boolean"
},
......
]
},
"results":{
"photo":[{
"farm":"3",
"id":"3679272771",
"isfamily":"0",
"isfriend":"0",
"ispublic":"1",
"owner":"28401989@N04",
"secret":"6ace55fce0",
"server":"2643",
"title":"ConvergeSC Speakers"
},
....
so that instead of assuming the data structure from how it comes, I can actually know for sure and even (and this is the most important) know when the data is other than string, an information I have no way of guessing out. Numbers sort differently than strings containing numeric characters, but there is no way to tell one from the other from the received data. There is also no way to tell a boolean apart from a string containing a single digit 0 or 1. It is also good to get this information in the same reply message as the data itself, to avoid twice the latency time, instead of going to a DESC command first or more than that for complex queries. Also, what the actual fields ended up being, in case any failed.