summaryrefslogtreecommitdiff
path: root/ndb/test/odbc/tpcb/timesten.h
blob: 45579f9d2774c04bfa75c62070aa10d18041c9d5 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/*
 * $Revision: 1.1 $
 * (c) Copyright 1997-2003, TimesTen, Inc.
 * All rights reserved. 
 */

#ifndef TIMESTEN_H_INCLUDED
#define TIMESTEN_H_INCLUDED

#ifdef _WIN32
#include <windows.h>
#endif

#include <sql.h>
#include <sqltypes.h>
#include <sqlext.h>
/*
 * TimesTen extension to application data types; only usable
 * when application directly linked to the TimesTen driver.
 */
#define SQL_C_ADDR      100

#ifndef SQL_C_SBIGINT
#if (ODBCVER < 0x0300)
#define SQL_C_SBIGINT   (SQL_BIGINT+SQL_SIGNED_OFFSET)
#define SQL_C_UBIGINT   (SQL_BIGINT+SQL_UNSIGNED_OFFSET)
#endif
#endif

#define SQL_C_BIGINT    SQL_C_SBIGINT

#if (ODBCVER < 0x0300)
#ifdef _WIN32
typedef __int64 SQLBIGINT;
/* On Unix platforms SQLBIGINT is defined in odbcinclude directory*/
#endif
#endif

#define BIGINT    SQLBIGINT

#ifdef _WIN32
#define UBIGINT   unsigned __int64
#else
#define UBIGINT   unsigned long long
#endif


#define SQL_WCHAR         (-8)
#define SQL_WVARCHAR      (-9)
#define SQL_WLONGVARCHAR  (-10)
#define SQL_C_WCHAR       SQL_WCHAR

/* SQLGetInfo() InfoTypes */
#define SQL_CONVERT_WCHAR         122
#define SQL_CONVERT_WLONGVARCHAR  125
#define SQL_CONVERT_WVARCHAR      126

/* TimesTen specific SQLGetInfo types */
#define TT_REPLICATION_INVALID   (SQL_INFO_DRIVER_START + 2000)

/* SQLGetInfo() return value bitmasks */
#ifndef SQL_CVT_WCHAR
/*
** These definitions differ from Microsoft in that they are not
** specified as long (e.g. 0x00200000L), hence they are protected
** by the ifndef above.
*/
#define SQL_CVT_WCHAR           0x00200000
#define SQL_CVT_WLONGVARCHAR    0x00400000
#define SQL_CVT_WVARCHAR        0x00800000
#endif

/*
** The Microsoft Driver Manager SQLBindParameter() will not pass SQL_WCHAR
** through.  Use this hack to get around it.
*/
#define SQL_WCHAR_DM_SQLBINDPARAMETER_BYPASS    -888

/* This is an extension to ODBC's isolation levels. It reflects an
 * earlier implementation of read-committed that released locks on
 * next fetch, rather than releasing locks before returning value to
 * application.  */
#define SQL_TXN_CURSOR_STABILITY            0x00001000
#define SQL_TXN_NOBLOCK_DELETE              0x00002000

/* TimesTen-specific connection option */
#define TT_PREFETCH_CLOSE                   10001
#define TT_PREFETCH_CLOSE_OFF               0
#define TT_PREFETCH_CLOSE_ON                1

/* Adding a new sql connection option */
#define TT_PREFETCH_COUNT                   10003
#define TT_PREFETCH_COUNT_MAX               128

/*
 * Platform specific data types for integers that scale
 * with pointer size
 */

#ifdef _IA64_
typedef signed   __int64 tt_ptrint;
typedef unsigned __int64 tt_uptrint;
#else
#ifdef _WIN32
typedef signed   long    tt_ptrint;
typedef unsigned long    tt_uptrint;
#else
typedef signed   long    tt_ptrint;
typedef unsigned long    tt_uptrint;
#endif
#endif

#ifdef _WIN32
typedef signed   __int64    tt_int8;
typedef unsigned __int64    tt_uint8;
#else
typedef signed   long long  tt_int8;
typedef unsigned long long  tt_uint8;
#endif

/* printf formats for pointer-sized integers */
#ifdef _IA64_                   /* 64-bit NT */
#define PTRINT_FMT    "I64d"
#define UPTRINT_FMT   "I64u"
#define xPTRINT_FMT   "I64x"
#define XPTRINT_FMT   "I64X"
#else
#ifdef _WIN32                   /* 32-bit NT */
#define PTRINT_FMT    "ld"
#define UPTRINT_FMT   "lu"
#define xPTRINT_FMT   "lx"
#define XPTRINT_FMT   "lX"
#else                           /* 32 and 64-bit UNIX */
#define PTRINT_FMT    "ld"
#define UPTRINT_FMT   "lu"
#define xPTRINT_FMT   "lx"
#define XPTRINT_FMT   "lX"
#endif
#endif

/* printf formats for 8-byte integers */
#ifndef INT8_FMT_DEFINED
#ifdef _WIN32                   /* 32 and 64-bit NT */
#define INT8_FMT      "I64d"
#define UINT8_FMT     "I64u"
#define xINT8_FMT     "I64x"
#define XINT8_FMT     "I64X"
#else                           /* 32 and 64-bit UNIX */
#define INT8_FMT      "lld"
#define UINT8_FMT     "llu"
#define xINT8_FMT     "llx"
#define XINT8_FMT     "llX"
#endif
#define INT8_FMT_DEFINED 1
#endif

/* The following types are defined in the newer odbc include files
   from Microsoft
*/
#if defined (_WIN32) && !defined (_IA64_)
#ifndef SQLROWSETSIZE
#define SQLROWSETSIZE   SQLUINTEGER
#define SQLLEN          SQLINTEGER
#define SQLROWOFFSET    SQLINTEGER
#define SQLROWCOUNT     SQLUINTEGER
#define SQLULEN         SQLUINTEGER
#define SQLSETPOSIROW   SQLUSMALLINT
#endif
#endif


#endif