Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
ejsqlmanager.h 969 Bytes
Copy Edit Web IDE Raw Blame History
unix_chen authored 2018-03-26 07:59 . init
#ifndef EJSQLMANAGER_H
#define EJSQLMANAGER_H
#include <QMap>
#include <QSqlDatabase>
#include <QSqlTableModel>
class EJSqlManager
{
public:
~EJSqlManager();
bool open(const QString &path, const QString &passwd);
bool query(const QString &sql, const QString &path = "");
bool existTable(const QString &table = "", const QString &path = "");
bool createTable(const QStringList &column, const QString &table = "", const QString &path = "");
void setDefaultDB(const QString &path){m_defaultDB = path;}
void setDefaultTB(const QString &table){m_defaultTB = table;}
QSqlTableModel *getTableModel(const QString &table = "", const QString &path = "");
static EJSqlManager* getInstance(){return m_instance;}
private:
EJSqlManager(){}
private:
QMap<QString, QSqlDatabase> m_dbconn;
QString m_defaultDB;
QString m_defaultTB;
static EJSqlManager *m_instance;
};
#endif // EJSQLMANAGER_H

Comment ( 0 )

Sign in for post a comment