ParaWorld_Map
Microcomos Query Language (MQL)
Title |
Microcomos Query Language (MQL) |
Author(s) |
LiXizhi |
Date |
2008/5/22 |
File |
script/kids/3DMapSystemApp/API/paraworld.MQL.lua |
Description
MQL is a way to query the same
ParaWorld data you can access through the
ParaWorldAPI functions, but with a SQL-style interface.
In fact, many of the normal API calls are simple wrappers for MQL queries. All of the usual privacy checks are still applied. A typical query looks something like this:
select uid,createDate from users where PageIndex = 0 and PageSize = 5 and createDate > '2008-1-1' order by createDate desc
So, with all that said, why would you use MQL? The key advantages of using MQL over our more traditional API methods are as follows:
- Condensed XML reduces bandwidth and parsing costs. Instead of getting all of the information available about a large set of items, you can get just the fields you want for only the set of items matching a specific condition. You can request the specific set of information by adding constraints to the WHERE clause and only listing certain fields in the SELECT clause.
- More complex requests can reduce the number of requests necessary. Often the data that you are trying to get depends upon the results of a previous method call.
- Provides a single consistent, unified interface for all of your data. Instead of having to learn numerous different methods that each have their own idiosyncrasies, you can make all of your requests with one function that has a consistent return type. Additionally, if you do need to call any of the traditional methods, the return XML is very similar, so the switching cost is negligible.
It's fun! Check out the examples available at paraworld.MQL.query and then try playing around with it in the
UnitTest console - you can do some cool stuff with it!
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua");
Topic revision: r1 - 2008-02-29
- LiXizhi