YQL
This last example is a cracker. We have saved the best for last for this chapter. It's a mashup involving the local SQLite database and the SQL database provided by Yahoo! known as YQL. YQL, for those of you who aren't aware, allows you to issue web search queries against the Yahoo! search engine as though it were a SQL database.
YQL is issued from Titanium using the Ti.Yahoo.yql
command. The structure of the command is simple. The first parameter is the query and the second is the callback code to run when the command completes. See the following example call that gets the weather forecast for Sunnyvale, California:
Ti.Yahoo.yql('select * from weather.forecast where woeid=2502265', function(e) {do_something_with_it(e);});
Note
Notice the structure of the Ti.Yahoo.yql
command. YQL is executed against the Yahoo! web services in much the same way as the HTTP requests which we saw earlier in this chapter. So, in keeping with the HTTP requests, the second parameter is a callback to execute when...