-
Notifications
You must be signed in to change notification settings - Fork 0
/
DatabaseSupport.h
52 lines (37 loc) · 1.15 KB
/
DatabaseSupport.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//---------------------------------------------------------------------------
#ifndef DatabaseSupportH
#define DatabaseSupportH
//---------------------------------------------------------------------------
#include <vector>
#include <algorithm>
#include <vcl.h>
#include "Controller.h"
using namespace std;
class CSQLite;
class CTerminal;
class CDatabaseSupport
{
public:
//初始化时注意清空之前数据库的数据
CDatabaseSupport(CController *p);
~CDatabaseSupport();
bool InitDB(AnsiString dbName);
//保存单张票的数据入库
int SaveTicket2DB(Ticket *ticket);
//取彩票数据,同时做标记,不删除,本次累计数统计用
int FetchTicket(CTerminal *terminal, AnsiString gameId, AnsiString betCode, int count);
//打印完成标记
int PrintComplete(AnsiString ticketId, AnsiString terminalId, AnsiString stub, int money);
//打印完成标记
int ReturnTicket(AnsiString ticketId);
//查找Ticket
bool FindTicket(AnsiString ticketId, Ticket &ticket);
//查询待打张数
int QueryPendingCount();
bool connected;
private:
CController *controller;
CSQLite *SQLite; //数据库的操作对象
CRITICAL_SECTION m_cs; //临界区,线程排队调用的互斥机制
};
#endif