2024-05-18 23:53:26 +08:00
|
|
|
#ifndef SQLBASE_H
|
|
|
|
|
#define SQLBASE_H
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "sqlStruct.h"
|
|
|
|
|
class sqlBase
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual bool backup(std::string path) { return true; };
|
|
|
|
|
|
2024-08-07 09:16:35 +00:00
|
|
|
//第二个参数只需要输入数据名,类型默认为文本
|
|
|
|
|
virtual std::vector<std::string> getTableList(){ return std::vector<std::string>(); };
|
2024-05-18 23:53:26 +08:00
|
|
|
virtual bool createTable(std::string, std::vector<std::string>) { return true; };
|
|
|
|
|
virtual bool deleteTable(std::string tableName) { return true; };
|
|
|
|
|
|
|
|
|
|
virtual bool addColumn(std::string &tableName, std::string &columnName, std::string columnType) { return true; };
|
|
|
|
|
virtual bool deleteColumn(std::string tableName, std::string columnName) { return true; };
|
|
|
|
|
virtual std::vector<std::string> getColumn(std::string tableName) { return std::vector<std::string>(); };
|
|
|
|
|
|
|
|
|
|
virtual sqlErr Insert(
|
|
|
|
|
std::string tableName,
|
|
|
|
|
std::string SN,
|
|
|
|
|
std::vector<sqlData>dataVec)
|
2024-08-07 09:16:35 +00:00
|
|
|
{ return sqlErr(); };
|
2024-05-18 23:53:26 +08:00
|
|
|
|
|
|
|
|
virtual bool Delete(std::string, std::string, std::string) { return true; };
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 第二个参数留空则为获取全部
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tableName"></param>
|
|
|
|
|
/// <param name="selectStr"></param>
|
|
|
|
|
/// <param name="Where"></param>
|
|
|
|
|
/// <param name="equal"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
virtual sqlErr Select(
|
|
|
|
|
std::string tableName,
|
|
|
|
|
std::vector<std::string>selectStr,
|
|
|
|
|
std::string Where = "",
|
|
|
|
|
std::string equal = "",
|
|
|
|
|
sqlTableDatas& output = sqlTableDatas())
|
2024-08-07 09:16:35 +00:00
|
|
|
{ return sqlErr(); };
|
2024-05-18 23:53:26 +08:00
|
|
|
|
|
|
|
|
virtual bool Update(
|
|
|
|
|
std::string tableName,
|
|
|
|
|
std::vector<sqlData> selectStr,
|
|
|
|
|
std::string Where = "",
|
|
|
|
|
std::string equal = "")
|
|
|
|
|
{ return true; };
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
#pragma once
|