Impl getDbTables
This commit is contained in:
parent
d20e070596
commit
8736b82040
@ -1,6 +1,7 @@
|
||||
package com.iamteer;
|
||||
|
||||
import com.iamteer.Wcf.DbNames;
|
||||
import com.iamteer.Wcf.DbTable;
|
||||
import com.iamteer.Wcf.Functions;
|
||||
import com.iamteer.Wcf.Request;
|
||||
import com.iamteer.Wcf.Response;
|
||||
@ -102,6 +103,19 @@ public class Client {
|
||||
return Wcf.DbNames.newBuilder().build().getNamesList();
|
||||
}
|
||||
|
||||
public Map<String, String> getDbTables(String db) {
|
||||
Request req = new Request.Builder().setFuncValue(Functions.FUNC_GET_DB_TABLES_VALUE).setStr(db).build();
|
||||
Response rsp = sendCmd(req);
|
||||
Map<String, String> tables = new HashMap<>();
|
||||
if (rsp != null) {
|
||||
for (DbTable tbl : rsp.getTables().getTablesList()) {
|
||||
tables.put(tbl.getName(), tbl.getSql());
|
||||
}
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
public void waitMs(int ms) {
|
||||
try {
|
||||
Thread.sleep(ms);
|
||||
@ -126,4 +140,12 @@ public class Client {
|
||||
c.getProvince(), c.getCity(), gender);
|
||||
}
|
||||
}
|
||||
|
||||
public String bytesToHex(byte[] bytes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : bytes) {
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,23 @@ public class Main {
|
||||
final String url = "tcp://192.168.1.104:10086";
|
||||
Client client = new Client(url);
|
||||
|
||||
// 是否已登录
|
||||
logger.info("isLogin: {}", client.isLogin());
|
||||
|
||||
// 登录账号 wxid
|
||||
logger.info("wxid: {}", client.getSelfWxid());
|
||||
|
||||
// 消息类型
|
||||
logger.info("message types: {}", client.getMsgTypes());
|
||||
|
||||
// 所有联系人(包括群聊、公众号、好友……)
|
||||
client.printContacts(client.getContacts());
|
||||
|
||||
// 获取数据库
|
||||
logger.info("dbs: {}", client.getDbNames());
|
||||
|
||||
// 获取数据库下的表
|
||||
String db = "MicroMsg.db";
|
||||
logger.info("tables in {}: {}", db, client.getDbTables(db));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user