1/*
2* $Id: tpcd.h,v 1.2 2005/01/03 20:08:59 jms Exp $
3*
4* Revision History
5* ===================
6* $Log: tpcd.h,v $
7* Revision 1.2 2005/01/03 20:08:59 jms
8* change line terminations
9*
10* Revision 1.1.1.1 2004/11/24 23:31:47 jms
11* re-establish external server
12*
13* Revision 1.1.1.1 2003/04/03 18:54:21 jms
14* recreation after CVS crash
15*
16* Revision 1.1.1.1 2003/04/03 18:54:21 jms
17* initial checkin
18*
19*
20*/
21/*****************************************************************
22 * Title: tpcd.h for TPC D
23 *****************************************************************
24 */
25#define DFLT 0x0001
26#define OUTPUT 0x0002
27#define EXPLAIN 0x0004
28#define DBASE 0x0008
29#define VERBOSE 0x0010
30#define TIMING 0x0020
31#define LOG 0x0040
32#define QUERY 0x0080
33#define REFRESH 0x0100
34#define ANSI 0x0200
35#define SEED 0x0400
36#define COMMENT 0x0800
37#define INIT 0x1000
38#define TERMINATE 0x2000
39#define DFLT_NUM 0x4000
40
41/*
42 * general defines
43 */
44#define VTAG ':' /* flags a variable substitution */
45#define ofp stdout /* make the routine a filter */
46#define QDIR_TAG "DSS_QUERY" /* variable to point to queries */
47#define QDIR_DFLT "." /* and its default */
48
49/*
50 * database portability defines
51 */
52#ifdef DB2
53#define GEN_QUERY_PLAN "SET CURRENT EXPLAIN SNAPSHOT ON;"
54#define START_TRAN ""
55#define END_TRAN "COMMIT WORK;"
56#define SET_OUTPUT ""
57#define SET_ROWCOUNT "--#SET ROWS_FETCH %d\n"
58#define SET_DBASE "CONNECT TO %s ;\n"
59#endif
60
61#ifdef INFORMIX
62#define GEN_QUERY_PLAN "SET EXPLAIN ON;"
63#define START_TRAN "BEGIN WORK;"
64#define END_TRAN "COMMIT WORK;"
65#define SET_OUTPUT "OUTPUT TO "
66#define SET_ROWCOUNT "FIRST %d"
67#define SET_DBASE "database %s ;\n"
68#endif
69
70#ifdef ORACLE
71#define GEN_QUERY_PLAN ""
72#define START_TRAN ""
73#define END_TRAN ""
74#define SET_OUTPUT ""
75#define SET_ROWCOUNT "where rownum <= %d;\n"
76#define SET_DBASE ""
77#endif
78
79#ifdef SQLSERVER
80#define GEN_QUERY_PLAN "set showplan on\nset noexec on\ngo\n"
81#define START_TRAN "begin transaction\ngo\n"
82#define END_TRAN "commit transaction\ngo\n"
83#define SET_OUTPUT ""
84#define SET_ROWCOUNT "set rowcount %d\ngo\n\n"
85#define SET_DBASE "use %s\ngo\n"
86#endif
87
88#ifdef SYBASE
89#define GEN_QUERY_PLAN "set showplan on\nset noexec on\ngo\n"
90#define START_TRAN "begin transaction\ngo\n"
91#define END_TRAN "commit transaction\ngo\n"
92#define SET_OUTPUT ""
93#define SET_ROWCOUNT "set rowcount %d\ngo\n\n"
94#define SET_DBASE "use %s\ngo\n"
95#endif
96
97#ifdef TDAT
98#define GEN_QUERY_PLAN "EXPLAIN"
99#define START_TRAN "BEGIN TRANSACTION"
100#define END_TRAN "END TRANSACTION"
101#define SET_OUTPUT ".SET FORMAT OFF\n.EXPORT REPORT file="
102#define SET_ROWCOUNT ".SET RETCANCEL ON\n.SET RETLIMIT %d\n"
103#define SET_DBASE ".LOGON %s\n"
104#endif
105
106#define MAX_VARS 8 /* max number of host vars in any query */
107#define QLEN_MAX 2048 /* max length of any query */
108#define QUERIES_PER_SET 22
109
110EXTERN int flags;
111EXTERN int s_cnt;
112EXTERN char *osuff;
113EXTERN int stream;
114EXTERN char *lfile;
115EXTERN char *ifile;
116EXTERN char *tfile;
117
118#define MAX_PERMUTE 41
119#ifdef DECLARER
120int rowcnt_dflt[QUERIES_PER_SET + 1] =
121 {-1,-1,100,10,-1,-1,-1,-1,-1,-1,20,-1,-1,-1,-1,-1,-1,-1,100,-1,-1,100,-1};
122int rowcnt;
123#define SEQUENCE(stream, query) permutation[stream % MAX_PERMUTE][query - 1]
124#else
125extern int rowcnt_dflt[];
126extern int rowcnt;
127#endif
128