-
Notifications
You must be signed in to change notification settings - Fork 12
/
OdbcJdbc.h
152 lines (120 loc) · 3.46 KB
/
OdbcJdbc.h
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
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
* The Original Code was created by James A. Starkey for IBPhoenix.
*
* Copyright (c) 1999, 2000, 2001 James A. Starkey
* All Rights Reserved.
*/
#ifndef __ODBCJDBC_H
#define __ODBCJDBC_H
#ifdef _WINDOWS
#include <windows.h>
#if _MSC_VER >= 1400 // VC80 and later
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#else
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif // _MSC_VER >= 1400
#define snprintf _snprintf
#define swprintf _snwprintf
#else
#define OutputDebugString(string) fputs (string, stdout)
#endif
#ifdef DEBUG
#define LOG_MSG(msg) OutputDebugString( msg )
#ifdef LOGGING
#ifdef _WINDOWS
#define LOG_FILE "c:\\odbcjdbc.log"
#else
#define LOG_FILE "/tmp/odbcjdbc.log"
#endif
#define LOG_PRINT(msg) \
{ \
if ( !logFile ) \
{ \
logFile = fopen( LOG_FILE, "a+" ); \
if ( logFile ) \
{ \
fprintf( logFile, "*\n*\n*\n* New Session\n*\n*\n*\n" );\
fflush( logFile ); \
} \
} \
\
if ( !logFile ) \
OutputDebugString( "log file create failed\n" ); \
else \
{ \
fprintf msg; \
fflush( logFile ); \
} \
}
#else // LOGGING
#define LOG_PRINT(msg)
#endif
#else // DEBUG
#define LOG_MSG(msg)
#define LOG_PRINT(msg)
#endif
#include <sql.h>
#include <sqlext.h>
#include <sqlucode.h>
#include "SetupAttributes.h"
#include "IscDbc/JavaType.h"
#ifndef _WINDOWS
#if (SIZEOF_LONG == 4)
#define SDWORD long int
#define UDWORD unsigned long int
#else
#define SDWORD int
#define UDWORD unsigned int
#endif
#endif
#ifndef SQL_BOOLEAN
#define SQL_BOOLEAN 16
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef _ASSERT
#define _ASSERT(what)
#endif
#undef ASSERT
#define ASSERT(b) _ASSERT (b)
#define MAX(a,b) ((a > b) ? a : b)
#define MIN(a,b) ((a < b) ? a : b)
#define ABS(n) (((n) >= 0) ? (n) : -(n))
#define MASK(n) (1 << (n))
#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z')
#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z')
#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
#define UPPER(c) ((ISLOWER (c)) ? (c) - 'a' + 'A' : (c))
#define ROUNDUP(n,b) (((n) + (b) - 1) & ~((b) - 1))
#define SQL_FBGETSTMT_PLAN 11999
#define SQL_FBGETSTMT_TYPE 11998
#define SQL_FBGETSTMT_INFO 11997
// ext env attribute
#define SQL_ATTR_HANDLE_DBC_SHARE 4000
#define DRIVER_LOCKED_LEVEL_NONE 0
#define DRIVER_LOCKED_LEVEL_ENV 1
#define DRIVER_LOCKED_LEVEL_CONNECT 2
#ifndef DRIVER_LOCKED_LEVEL
#define DRIVER_LOCKED_LEVEL DRIVER_LOCKED_LEVEL_CONNECT
#endif
#define FB_COMPILER_MESSAGE_STR(x) #x
#define FB_COMPILER_MESSAGE_STR2(x) FB_COMPILER_MESSAGE_STR(x)
#define FB_COMPILER_MESSAGE(desc) message(__FILE__ "(" \
FB_COMPILER_MESSAGE_STR2(__LINE__) "):" desc)
#endif