paraworld.MQL.query

Description

执行传入的MQL语句,并将结果返回

MQL语法类似于简化了的T-SQL。

不区分大小字

不支持多表联合查询,不支持聚合函数,不支持Top语句;

支持where、order by 、group by语句;

支持的操作符:>, <, =, <>, >=, <=, is null, is not null, like ;

支持的通配符:_(匹配任意单个字符), %(匹配任意多个字符);

MQL特有关键字
PageSize: 用在where语句中,以分页的形式返回数据,该值指定每页的最大数据量,必须与PageIndex一起使用才起作用,否则忽略,若指定了PageIndex,却没有提供PageSize,则默认的每页最大数据量为10
PageIndex:用在where语句中,以分页的形式返回数据,该值指定返回的页码,若指定了PageIndex,则必须指定Order by。
示例:select * from users where PageIndex = 0 and PageSize = 20 order by createDate desc //每页最多20条数据,返回第一页的数据

Parameters

Required Name Type Description
required query string 规范的MQL语句
optional appKey string 应用程序Key
sessionKey string 用户凭证

Return XML

(1)若是select语句,则返回类似于下面的XML格式:
<msg xmlns="">
        <users>
                <param index="1">
                        <uid type="string">f5f3de7a-05b2-42a0-bd78-415a939020c2</uid>
                        <uname type="string">clayman</uname>
                        <createDate type="string">2008-5-5 7:44:11</createDate>
                </param>
                <param index="2">
                        <uid type="string">6ea770c6-92b2-4b2b-86da-6f574641ec11</uid>
                        <uname type="string">andy</uname>
                        <createDate type="string">2008-5-5 7:36:12</createDate>
                </param>
                <param index="3">
                        <uid type="string">8ec11316-bc2e-491d-8f18-667501687e69</uid>
                        <uname type="string">ParaEngine</uname>
                        <createDate type="string">2008-5-5 7:36:05</createDate>
                </param>
        </users>
        <query type="string">
                select uid,uname,createdate from users where pageindex = 0 and pagesize = 3 and createdate > '2008-1-1' order by createdate desc
        </query>
</msg>
(2)若是update、delete、insert语句,则返回类似于下面的XML:
<msg>
        <isSuccess>true</isSuccess>
        <query type="string">
                update users set email = 'aaa@gmail.com' where uid = 'f5f3de7a-05b2-42a0-bd78-415a939020c2'
        </query>
</msg>
(3)若发生异常,则返回类似于下面的XML:
<msg>
        <errorCode>494</errorCode>
        <query type="string">
                select uid,uname,createdate from users where pageindex = 0 and pagesize = 3 and createdate > '2008-1-1'
        </query>
</msg>

Tables

users
fields
Name Type Description
uid GUID 用户的唯一标识符
uname string 用户名
createDate datetime 注册时间
lastActivityDate datetime 最后活跃时间
email string 用户的电子邮箱地址
isOnline boolean 当前是否在线
支持的MQL语句
select语句 支持
update语句 不支持
delete语句 不支持
insert语句 不支持

friends
fields

Name Type Description
uid1 GUID 用户ID
uid2 GUID 好友的用户ID
支持的MQL语句
select语句 支持
update语句 不支持
delete语句 不支持
insert语句 不支持

Error Codes

当发生异常时,返回数据中会有一个“errorCode”节点,该节点记录了错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问 494:语法错误
Topic revision: r8 - 2008-06-13 - CaoYF
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback