22 #ifndef __ODBCXX_SETUP_H
23 #define __ODBCXX_SETUP_H
25 #if defined(__WIN32__) && !defined(WIN32)
30 # include <odbc++/config.h>
31 # define ODBCXX_OPERATOR_NEW new
32 # define ODBCXX_OPERATOR_DELETE delete
33 # define ODBCXX_OPERATOR_NEW_DEBUG(debFile, debLine) new
34 # define ODBCXX_OPERATOR_DELETE_DEBUG(debFile, debLine) delete
36 #if defined(_DEBUG) && defined(IN_ODBCXX)
37 void*
operator new(
size_t n,
const char* debFile,
int debLine);
38 void operator delete(
void* p,
const char* debFile,
int debLine);
39 # define ODBCXX_OPERATOR_NEW new(__FILE__, __LINE__)
40 # define ODBCXX_OPERATOR_DELETE delete
41 # define ODBCXX_OPERATOR_NEW_DEBUG(debFile, debLine) new(debFile, debLine)
42 # define ODBCXX_OPERATOR_DELETE_DEBUG(debFile, debLine) delete
44 # define OPERATOR_NEW new
45 # define OPERATOR_DELETE delete
46 # define ODBCXX_OPERATOR_NEW_DEBUG(debFile, debLine) new
47 # define ODBCXX_OPERATOR_DELETE_DEBUG(debFile, debLine) delete
51 # include <odbc++/config-win32.h>
52 #endif // defined(__WIN32__) && !defined(WIN32)
54 #define ODBCXX_DELETE_POINTER(x, debfile, debline)\
56 { ODBCXX_OPERATOR_DELETE_DEBUG(debfile, debline) x;\
59 #define ODBCXX_DELETE_ARRPOINTER(x, debfile, debline)\
61 { ODBCXX_OPERATOR_DELETE_DEBUG(debfile, debline)[] x;\
66 #if defined(IN_ODBCXX) && defined(ODBCXX_ENABLE_THREADS)
67 # if !defined(_REENTRANT)
70 # if !defined(_THREAD_SAFE)
71 # define _THREAD_SAFE 1
76 #if defined(ODBCXX_UNICODE)
77 # if !defined(UNICODE)
87 #if defined(ODBCXX_UNICODE)
88 # define ODBCXX_SSTREAM std::wstringstream
90 # if defined(ODBCXX_HAVE_SSTREAM)
91 # define ODBCXX_SSTREAM std::stringstream
93 # define ODBCXX_SSTREAM std::strstream
98 #if defined(ODBCXX_ODBCVER)
99 # define ODBCVER ODBCXX_ODBCVER
108 #if defined(IN_ODBCXX)
109 # if !defined(ODBCXX_DEBUG)
110 # if !defined(NDEBUG)
118 #if defined(__GNUC__) && __GNUC__>=3
119 # define ODBCXX_HAVE_ISO_CXXLIB
123 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)
124 # if defined(ODBCXX_DLL)
125 # if defined(IN_ODBCXX)
126 # define ODBCXX_EXPORT __declspec(dllexport)
128 # define ODBCXX_EXPORT __declspec(dllimport)
133 #if !defined(ODBCXX_EXPORT)
134 # define ODBCXX_EXPORT
137 #if defined(_MSC_VER) || defined(__MINGW32__)
138 # define ODBCXX_DUMMY_RETURN(x) return (x)
140 # define ODBCXX_DUMMY_RETURN(x) ((void)0)
146 #if defined(ODBCXX_QT)
148 # define ODBCXX_STRING QString
149 # define ODBCXX_STRING_C(s) QString::fromLocal8Bit(s)
150 # define ODBCXX_STRING_CL(s,l) QString::fromLocal8Bit(s,l)
151 # define ODBCXX_STRING_LEN(s) s.length()
152 # define ODBCXX_STRING_DATA(s) s.local8Bit().data()
153 # define ODBCXX_STRING_CSTR(s) s.local8Bit().data()
155 # define ODBCXX_STREAM QIODevice
157 # define ODBCXX_BYTES QByteArray
158 # define ODBCXX_BYTES_SIZE(b) b.size()
159 # define ODBCXX_BYTES_DATA(b) b.data()
160 # define ODBCXX_BYTES_C(buf,len) QByteArray().duplicate(buf,len)
164 # if defined(ODBCXX_UNICODE)
166 # define ODBCXX_STRING std::wstring
167 # define ODBCXX_STRING_C(s) std::wstring(s)
168 # define ODBCXX_STRING_CL(s,l) std::wstring(s,l)
169 # define ODBCXX_STRING_LEN(s) s.length()
170 # define ODBCXX_STRING_DATA(s) s.data()
171 # define ODBCXX_STRING_CSTR(s) s.c_str()
173 # define ODBCXX_STREAM std::wistream
174 # define ODBCXX_STREAMBUF std::wstreambuf
176 # define ODBCXX_BYTES odbc::Bytes
177 # define ODBCXX_BYTES_SIZE(b) b.getSize()
178 # define ODBCXX_BYTES_DATA(b) b.getData()
179 # define ODBCXX_BYTES_C(buf,len) odbc::Bytes((wchar_t*)buf,(size_t)len)
183 # define ODBCXX_STRING std::string
184 # define ODBCXX_STRING_C(s) std::string(s)
185 # define ODBCXX_STRING_CL(s,l) std::string(s,l)
186 # define ODBCXX_STRING_LEN(s) s.length()
187 # define ODBCXX_STRING_DATA(s) s.data()
188 # define ODBCXX_STRING_CSTR(s) s.c_str()
190 # define ODBCXX_STREAM std::istream
191 # define ODBCXX_STREAMBUF std::streambuf
193 # define ODBCXX_BYTES odbc::Bytes
194 # define ODBCXX_BYTES_SIZE(b) b.getSize()
195 # define ODBCXX_BYTES_DATA(b) b.getData()
196 # define ODBCXX_BYTES_C(buf,len) odbc::Bytes((signed char*)buf,(size_t)len)
198 # endif // ODBCXX_UNICODE
202 #if defined(ODBCXX_UNICODE)
203 # define ODBCXX_CHAR_TYPE wchar_t
204 # define ODBCXX_SIGNED_CHAR_TYPE wchar_t
205 # define ODBCXX_SQLCHAR SQLWCHAR
206 # define ODBCXX_STRING_CONST(s) L ## s
207 # define ODBCXX_COUT std::wcout
208 # define ODBCXX_CERR std::wcerr
209 # define ODBCXX_STRTOL wcstol
211 # define ODBCXX_CHAR_TYPE char
212 # define ODBCXX_SIGNED_CHAR_TYPE signed char
213 # define ODBCXX_SQLCHAR SQLCHAR
214 # define ODBCXX_STRING_CONST(s) s
215 # define ODBCXX_COUT std::cout
216 # define ODBCXX_CERR std::cerr
217 # define ODBCXX_STRTOL strtol
220 #endif // __ODBCXX_SETUP_H