File: TpcbExample.h

package info (click to toggle)
db4.6 4.6.21-16
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 59,664 kB
  • ctags: 35,453
  • sloc: ansic: 144,740; tcl: 52,840; java: 30,580; sh: 13,497; perl: 13,407; cpp: 10,633; cs: 2,660; makefile: 2,493; awk: 1,322; xml: 113; php: 22; asm: 14; sed: 9
file content (63 lines) | stat: -rw-r--r-- 1,372 bytes parent folder | download | duplicates (4)
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
57
58
59
60
61
62
63

#ifndef _TPCBEXAMPLE_H_INCLUDE__
#define	_TPCBEXAMPLE_H_INCLUDE__

#include <windows.h>
#include "db.h"

#define	ACCOUNTS	    1000
#define	BRANCHES	      10
#define	TELLERS		     100
#define	HISTORY		   10000
#define	TRANSACTIONS	1000
#define	TESTDIR		"TESTDIR"

typedef enum { ACCOUNT, BRANCH, TELLER } FTYPE;

extern "C" {
void tpcb_errcallback(const DB_ENV *, const char *, const char *);
}

class TpcbExample
{
public:
	int createEnv(int);
	void closeEnv();
	int populate();
	int run(int);
	int txn(DB *, DB *, DB *, DB *,	int, int, int);
	int populateHistory(DB *, int, u_int32_t, u_int32_t, u_int32_t);
	int populateTable(DB *, u_int32_t, u_int32_t, int, const char *);

	TpcbExample();

	char *getHomeDir(char *, int);
	wchar_t *getHomeDirW(wchar_t *, int);
	void setHomeDir(char *);
	void setHomeDirW(wchar_t *);

#define	ERR_STRING_MAX 1024
	char msgString[ERR_STRING_MAX];
	int accounts;
	int branches;
	int history;
	int tellers;

	// options configured through the advanced dialog.
	int fast_mode;
	int verbose;
	int cachesize;
	int rand_seed;
private:
	DB_ENV *dbenv;
	char homeDirName[MAX_PATH];
	wchar_t wHomeDirName[MAX_PATH];

	u_int32_t randomId(FTYPE, u_int32_t, u_int32_t, u_int32_t);
	u_int32_t randomInt(u_int32_t, u_int32_t);
	// no need for copy and assignment
	TpcbExample(const TpcbExample &);
	void operator = (const TpcbExample &);
};

#endif