---+!! =paraworld.MQL.query= <div style="float: right; margin: 5px; width: 250px; color: #4e5155; background-color: #f0eded; border: #ccc 1px solid; padding: 5px"> *Contents* %TOC% </div> ---++ Description 执行传入的MQL语句,并将结果返回 MQL语法类似于简化了的T-SQL。MQL必须以select、update、delete、insert into起始(目前只支持select)。 %BLUE%不区分%ENDCOLOR%大小字 %BLUE%保留关键字:%ENDCOLOR%<br/> select top from where order by desc asc group in like is not null between and or case as when then over begin end inner join union all %BLUE%支持的函数:%ENDCOLOR%<br/> cast count max min avg sum isnull nullif charindex len str substring left right <br/> 语法与T-SQL相同 %BLUE%MQL特有函数%ENDCOLOR%:<br/> Page(pageIndex, pageSize, order column):pageIndex是以1开始的页码,pageSize是每页的数据量,order column是排序字段与排序规则。Page函数只能用在最外层的select语句中;若已使用了Page函数,则不可再在where从句中指定order by语句。示例:取得当前所有在线用户,按用户创建时间倒序排序,并按每页10条数据分页,取得第一页的数据:select page(1,10,order by createDate desc), * from users where isOnline = 1 ---++ Parameters |*Required*|*Name*|*Type*|*Description*| |<font color="#4682b4">required</font>|query|%BLUE%string%ENDCOLOR%|规范的MQL语句| |<font color="#4682b4">optional</font>|appKey|%BLUE%string%ENDCOLOR%|应用程序Key| |^|sessionKey|%BLUE%string%ENDCOLOR%|用户凭证| ---++ Return XML (1)若是select语句,则返回类似于下面的XML格式: <verbatim> <msg xmlns=""> <list> <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> </list> <query type="string"> with __TEMPTABLE as(select Row_Number() over(order by [createDate] desc) [RowNumber], [uid],[uname],[createdate] from [vUsers] where [createdate] > '2008-1-1') select * from __TEMPTABLE where RowNumber between 1 and 3 </query> </msg> </verbatim> (2)若是update、delete、insert语句,则返回类似于下面的XML: <verbatim> <msg> <isSuccess>true</isSuccess> <query type="string"> update users set email = 'aaa@gmail.com' where uid = 'f5f3de7a-05b2-42a0-bd78-415a939020c2' </query> </msg> </verbatim> (3)若发生异常,则返回类似于下面的XML: <verbatim> <msg> <errorCode>494</errorCode> <query type="string"> select uid,uname,createdate from users wherer createdate > '2008-1-1' </query> </msg> </verbatim> ---++ Return JSON (1)若是select语句,则返回类似于下面的JSON格式: <verbatim> {"list":[{"RowNumber":"1","uid":"82d516c3-48b7-4619-a2ca-ee3b1d3e1966","uname":"abc","createdate":"2008-12-6 9:08:22"}, {"RowNumber":"2","uid":"eb96d97b-98ce-43b0-abd1-74661bc222ae","uname":"grass","createdate":"2008-12-3 3:16:22"}, {"RowNumber":"3","uid":"ffa65436-9828-4324-a443-10771658d53a","uname":"qwerttt","createdate":"2008-12-3 3:12:08"}], "query":"with __TEMPTABLE as(select Row_Number() over(order by [createDate] desc) [RowNumber], [uid],[uname],[createdate] from [vUsers] where [createdate] > '2008-1-1') select * from __TEMPTABLE where RowNumber between 1 and 3"} </verbatim> ---++ Tables [[Paraworld.MQL.Users][users]] <br/> __fields__ |*Name*|*Type*|*Description*| |<font color="#4682b4">uid</font>|GUID|用户的唯一标识符| |<font color="#4682b4">nid</font>|string|用户的数字ID| |<font color="#4682b4">uname</font>|string|用户名| |<font color="#4682b4">nickName</font>|string|用户昵称| |<font color="#4682b4">firstName</font>|string|姓| |<font color="#4682b4">lastName</font>|string|名| |<font color="#4682b4">birthday</font>|datetime|生日| |<font color="#4682b4">gender</font>|string|性别| |<font color="#4682b4">registerArea</font>|string|注册所在地| |<font color="#4682b4">photo</font>|string|用户图像URL| |<font color="#4682b4">createDate</font>|datetime|注册时间| |<font color="#4682b4">email</font>|string|用户的电子邮箱地址| |<font color="#4682b4">isApproved</font>|boolean|是否已激活| |<font color="#4682b4">isLocked</font>|boolean|是否被锁定| |<font color="#4682b4">isOnline</font>|boolean|当前是否在线| __支持的MQL语句__ |select语句|支持| |update语句|不支持| |delete语句|不支持| |insert语句|不支持| [[Paraworld.MQL.Friends][friends]] <br/> __fields__ |*Name*|*Type*|*Description*| |<font color="#4682b4">id</font>|int|主键| |<font color="#4682b4">uid1</font>|GUID|用户ID| |<font color="#4682b4">uid2</font>|GUID|好友的用户ID| |<font color="#4682b4">addDate</font>|datetime|添加好友的时间| __支持的MQL语句__ |select语句|支持| |update语句|不支持| |delete语句|不支持| |insert语句|不支持| [[Paraworld.MQL.WorldUser][WorldUser]] <br/> __fields__ |*Name*|*Type*|*Description*| |<font color="#4682b4">worldID</font>|int|世界ID| |<font color="#4682b4">uid</font>|GUID|用户ID| |<font color="#4682b4">addDate</font>|datetime|创建此数据的时间,即用户加入世界的时间| __支持的MQL语句__ |select语句|支持| |update语句|不支持| |delete语句|不支持| |insert语句|不支持| ---++ Error Codes 当发生异常时,返回数据中会有一个“errorCode”节点,该节点记录了错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问 494:语法错误
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r12
<
r11
<
r10
<
r9
<
r8
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r12 - 2009-01-16
-
CaoYF
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback