You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
683 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include"User.h"
#include"MYSQLConnectionPool.h"
class MYSQLConnectionPool;
class DBConnection;
using spDBPool=std::shared_ptr<MYSQLConnectionPool>;
class UserDAO
{
private:
spDBPool mysqlPool_; //共享的mysql连接池
public:
UserDAO(spDBPool _mysqlPool); //构造函数
~UserDAO(); //析构函数
int CreateUser(User& _user); //创建用户返回userId(0表失败)
int LogIn(const std::string& _email,const std::string& _passwd); //登录返回userId(0表失败)
bool exist(int userId); //根据userId判断用户是否存在
};