#include"operateDB.h"
#ifndef SQLITE3_H
#define SQLITE3_H
#endif
#define SQLITE_CODE 1
int main()
{
//sqlite3* db = NULL;
//int rc = create(&db);
printf("当前 sqlite 使用的版本%s\n",sqlite3_libversion());
char c_path[MAX_PATH];
printf("注意!!!! 要将DB文件和程序置于同一目录之下 \n !!!!只针对contact 数据库查询其他库无效 \n");
printf("请输入解密之后的数据库名:\n");
scanf_s("%s",&c_path);
printf("%s\n", c_path);
//readDB("SELECT UserName,NickName from Contact where UserName like '%@chatroom'and Type=2;", c_path);
menu();
int num = 0;
while (1)
{
scanf_s("%d", &num);
switch (num)
{
//所有好友信息 wxid 账号 名称
case 1:
readDB("SELECT UserName,Alias,NickName from Contact where UserName like 'wxid%' and Type =3;", c_path);
break;
case 2:
//查看被删除
readDB("SELECT UserName,Alias,NickName from Contact where UserName like 'wxid%' and Type =259;", c_path);
break;
case 3: //公众号
readDB("SELECT UserName,NickName from Contact where UserName like 'gh_%' and VerifyFlag=8;", c_path);
break;
case 4: //所有聊天室成员账号
readDB("SELECT UserName,NickName from Contact where UserName like 'wxid%' and Type=4;", c_path);
break;
case 5:
//查询加入的聊天室
readDB("SELECT UserName,NickName from Contact where UserName like '%@chatroom'and Type=2;", c_path);
break;
default:
printf("你输入的数字不合理\n");
break;
}
menu();
}
return 0;
}
功能函数模块头文件
[C] 纯文本查看复制代码
#include<iostream>
#include<Windows.h>
#include<atlstr.h>
#include<sqlite3.h>
//菜单
void menu();
//回调函数
int callback(void* data, int argc, char** argv, char** azColName);
//读取数据库的函数
void readVXDb(const char * sql);
//utf-8 转为 unicode
char * utf2Unicode(char * utf8);
//unicode 转为 utf-8
char *unicode2Utf8( wchar_t * unicode);
//读取数据库
void readDB(const char * sql, char * path);
//所有好友信息 wxid 账号 名称
#define friendSql "SELECT UserName,Alias,NickName from Contact where UserName like 'wxid%' and Type =3;";
//查看被删除的sql
#define delFriendSql "SELECT UserName,Alias,NickName from Contact where UserName like 'wxid%' and Type =259;";
//公众号
#define publicAccountSql "SELECT UserName,Alias,NickName from Contact where UserName like 'gh_%' and VerifyFlag=8;";
//所有聊天室成员账号 不能获取到 微信账号
#define chartRoomMemberSql "SELECT UserName,NickName from Contact where UserName like 'wxid%' and Type=4;";
//查询加入的聊天室
#define chartRoomSql "SELECT UserName,NickName from Contact where UserName like '%@chatroom'and Type=2;";