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

33 lines
663 B
C++

#pragma once
#include <QtCore>
#include <QSqlDatabase>
#include "db_config.h"
class lp_db_con_pri {
Q_DISABLE_COPY(lp_db_con_pri)
public:
lp_db_con_pri(const LP_DB_CONFIG_NODE& db_cfg);
~lp_db_con_pri();
QSqlDatabase& database();
qint64 creation_time() const { return creation_time_; }
void refresh();
void set_use_state(bool is_use) { is_inusing_ = is_use; }
bool is_inusing() const { return is_inusing_; }
int ref_cnt() const { return ref_cnt_; }
void inc_ref_cnt() { ++ref_cnt_; }
void dec_ref_cnt() { --ref_cnt_; }
private:
int ref_cnt_{ 0 };
bool is_inusing_{ false };
QString db_id_;
qint64 creation_time_{ 0 };
QSqlDatabase db_;
};