数据库/查询数据库

简要描述

  • 查询数据库。

请求URL

  • http://127.0.0.1:8888/api/

请求方式

  • POST

参数

参数名必选类型说明
typeint接口编号
dbNamestring数据库名称,优先级低于dbHandle
dbHandleint数据库句柄,优先级高于dbName
sqlstringsql

请求示例

 {
  "type": 10058,
  "dbName": "MicroMsg.db",
  "sql": "select * from sqlite_master where type=\"table\";"
 } 

返回示例

  {
    "data": {
      "status": 0,
      "desc": "",
      "data": []
    }
  }

常用查询

# 获取联系人,MicroMsg.db
select * from Contact where (Type&0xff=3 or Type&0xff=1) and VerifyFlag=0 and UserName NOT IN ('medianote','fmessage','floatbottle');
# 获取用户头像,MicroMsg.db
select smallHeadImgUrl from ContactHeadImgUrl where usrName="filehelper";
# 获取群聊列表,MicroMsg.db
select * from Contact where Type&0xf=2;
# 模糊搜索群聊信息,MicroMsg.db
SELECT a.UserName,a.NickName,b.smallHeadImgUrl,c.RoomData,c.Reserved2 FROM Contact a INNER JOIN ContactHeadImgUrl b ON a.UserName=b.usrName INNER JOIN ChatRoom c ON c.ChatRoomName=a.UserName WHERE a.nickName like "%某不知名的群" AND a.Type&0xf=2;)

返回参数说明

参数名类型说明
error_codeint错误代码
descriptionstring错误描述
datajson业务数据

备注