-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLite.h
58 lines (50 loc) · 1.43 KB
/
SQLite.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
52
53
54
55
56
#pragma once
#include <iostream>
#include <stdio.h>
#include <time.h>
#include <Windows.h>
#ifdef USE_SQLCIPHER
#include "sqlite_headers\SQLCipher\sqlite3.h"
#endif
#ifdef USE_SQLITE
#include "sqlite_headers\SQLite\sqlite3.h"
#endif
using namespace std;
#define RETRYLOOPCOUNT 1000
#ifdef USE_SQLCIPHER
#pragma comment(lib, "sqlite_libs\\SQLCipher\\sqlite3.lib")
#endif
#ifdef USE_SQLITE
#pragma comment(lib, "sqlite_libs\\SQLite\\sqlite3.lib")
#endif
class SQLite
{
long lRC;
long lTransactionCount;
sqlite3 *sqlHandle;
sqlite3 *sqlMemoryHandle;
sqlite3_stmt *sqlStmt;
sqlite3_stmt *sqlTableOneRecordStmt;
char szPassword[128];
char szMasterQuery[128];
char szPragmaQuery[128];
char szSalesReceiptQuery[2048];
char szInvoiceQuery[2048];
public:
SQLite(void);
~SQLite(void);
bool Open(char* szPath);
bool Close(bool memory);
bool SetEncryptionKey(char *szKey);
bool ApplyStanardQuery(char *szStandardQuery); /* As Like Pragma query or master query */
bool BeginTransaction();
bool CommitTransaction();
bool OpenMemory(char* szPath, char* szLongQuery, char* szShortQuery, char *szTableName, char *szKey);
bool CloseOneRecord();
bool OpenOneRecord(char* szTableName, char* szShortQuery, long rowID);
bool GetColumnText(LONG lCol, char* sText, LONG lMaxTextLen);
long ExecuteNonQuery(char *szQuery);
long ExecuteNonQueryFromMemory(char *szQuery);
long CountSQLValue(char *szQuery);
void PrintError(char *functionName, sqlite3*);
};