1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2007-2009 Oracle. 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 22typedef enum { ACCOUNT, BRANCH, TELLER } FTYPE; 23 24extern "C" { 25void tpcb_errcallback(const DB_ENV *, const char *, const char *); 26} 27 28class TpcbExample 29{ 30public: 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; 58private: 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 71