📄 sql.h
字号:
#include<qdatetime.h>#include<qtimer.h>#include<pthread.h>#include<sqlite3.h>#include<qstring.h>#include<pthread.h>#define DB_NAME "log_data_base" #define DB_connected 1#define DB_unconnected 2/* *what does this class do? it saves the log content and the source of the log,when a signal for log service comes *then it gives the log a time stamp,and pushes the log in the database *it can also serve the user by having the provide require service */class sql : public QObject{ Q_OBJECTpublic: sql(); ~sql(); int initDB();public slots: void logger(int log);//public slots: void request_db(char * tn);//这个slot连接界面的查询数据库按钮,并执行查询数据库功能,通过sig_log(int)反馈查询信息signals: void sig_log(char * time,int log); //这个信号用于向ker界面发送数据库查询的反馈信息public : void emit_sig_log(char * time,int log);public slots: int link_db();//这个slot用来连接数据库 public: void treat(int log);// int log_require();// int db_configure(int CMD);// int table_created(void * notUsed,int argc,char ** argv,char ** azColumName); public slots: int changeTBL(); int should_change_TBL();public: char table[50];//这是数据库表的名字 pthread_mutex_t table_lock; //数据库表的互斥锁 QTime timeStamp; //这个时间类用来给数据库记录加时间戳 QDate date; QTimer everyM; QDate lastDate; pthread_cond_t * read_over; int DBstate; sqlite3 * pdb;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -