Fix GetDbTables

This commit is contained in:
Changhua 2022-10-16 22:08:05 +08:00
parent eb7ace08c1
commit f757c95e0d

View File

@ -73,8 +73,8 @@ typedef int(__cdecl *Sqlite3_finalize)(DWORD *);
static int cbGetTables(void *ret, int argc, char **argv, char **azColName)
{
wcf::DbTables *tbls = (wcf::DbTables *)ret;
for (int i = 0; i < argc; i++) {
wcf::DbTable *tbl = tbls->add_tables();
for (int i = 0; i < argc; i++) {
if (strcmp(azColName[i], "name") == 0) {
tbl->set_name(argv[i] ? argv[i] : "");
} else if (strcmp(azColName[i], "sql") == 0) {
@ -106,7 +106,6 @@ dbMap_t GetDbHandles()
return dbMap;
}
void GetDbNames(wcf::DbNames *names)
{
if (dbMap.empty()) {
@ -130,7 +129,7 @@ void GetDbTables(const string db, wcf::DbTables* tables)
return; // DB not found
}
const char *sql = "select * from sqlite_master where type=\"table\";";
const char *sql = "select name, sql from sqlite_master where type=\"table\";";
Sqlite3_exec p_Sqlite3_exec = (Sqlite3_exec)(g_WeChatWinDllAddr + g_WxCalls.sql.exec);
p_Sqlite3_exec(it->second, sql, (sqlite3_callback)cbGetTables, tables, 0);