Debian Codegraph @

examples/cxx/wce_tpcb/TpcbExample.h

raw
1 /*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2007, 2013 Oracle and/or its affiliates. All rights reserved.
5 *
6 * $Id$
7 */
8
9 #ifndef _TPCBEXAMPLE_H_INCLUDE__
10 #define _TPCBEXAMPLE_H_INCLUDE__
11
12 #include <windows.h>
13 #include "db.h"
14
15 #define ACCOUNTS 1000
16 #define BRANCHES 10
17 #define TELLERS 100
18 #define HISTORY 10000
19 #define TRANSACTIONS 1000
20 #define TESTDIR "TESTDIR"
21
22 typedef enum { ACCOUNT, BRANCH, TELLER } FTYPE;
23
24 extern "C" {
25 void tpcb_errcallback(const DB_ENV *, const char *, const char *);
26 }
27
28 class TpcbExample
29 {
30 public:
31 int createEnv(int);
32 void closeEnv();
33 int populate();
34 int run(int);
35 int txn(DB *, DB *, DB *, DB *, int, int, int);
36 int populateHistory(DB *, int, u_int32_t, u_int32_t, u_int32_t);
37 int populateTable(DB *, u_int32_t, u_int32_t, int, const char *);
38
39 TpcbExample();
40
41 char *getHomeDir(char *, int);
42 wchar_t *getHomeDirW(wchar_t *, int);
43 void setHomeDir(char *);
44 void setHomeDirW(wchar_t *);
45
46 #define ERR_STRING_MAX 1024
47 char msgString[ERR_STRING_MAX];
48 int accounts;
49 int branches;
50 int history;
51 int tellers;
52
53 // options configured through the advanced dialog.
54 int fast_mode;
55 int verbose;
56 int cachesize;
57 int rand_seed;
58 private:
59 DB_ENV *dbenv;
60 char homeDirName[MAX_PATH];
61 wchar_t wHomeDirName[MAX_PATH];
62
63 u_int32_t randomId(FTYPE, u_int32_t, u_int32_t, u_int32_t);
64 u_int32_t randomInt(u_int32_t, u_int32_t);
65 // no need for copy and assignment
66 TpcbExample(const TpcbExample &);
67 void operator = (const TpcbExample &);
68 };
69
70 #endif