00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __ODBCXX_SETUP_H
00023 #define __ODBCXX_SETUP_H
00024
00025 #if defined(__WIN32__) && !defined(WIN32)
00026 # define WIN32 1
00027 #endif
00028
00029 #if !defined(WIN32)
00030 # include <odbc++/config.h>
00031 #else
00032 # include <odbc++/config-win32.h>
00033 #endif
00034
00035
00036 #if defined(IN_ODBCXX) && defined(ODBCXX_ENABLE_THREADS)
00037 # if !defined(_REENTRANT)
00038 # define _REENTRANT 1
00039 # endif
00040 # if !defined(_THREAD_SAFE)
00041 # define _THREAD_SAFE 1
00042 # endif
00043 #endif
00044
00045
00046 #if defined(ODBCXX_UNICODE)
00047 # if !defined(UNICODE)
00048 # define UNICODE
00049 # endif
00050 #else
00051 # if defined(UNICODE)
00052 # undef UNICODE
00053 # endif
00054 #endif
00055
00056
00057 #if defined(IN_ODBCXX)
00058 # if defined(ODBCXX_UNICODE)
00059 # define ODBCXX_SSTREAM std::wstringstream
00060 # else
00061 # if defined(ODBCXX_HAVE_SSTREAM)
00062 # define ODBCXX_SSTREAM std::stringstream
00063 # else
00064 # define ODBCXX_SSTREAM std::strstream
00065 # endif
00066 # endif
00067 #endif
00068
00069
00070 #if defined(ODBCXX_ODBCVER)
00071 # define ODBCVER ODBCXX_ODBCVER
00072 #endif
00073
00074
00075 #ifdef CHAR
00076 #undef CHAR
00077 #endif
00078
00079
00080 #if defined(IN_ODBCXX)
00081 # if !defined(ODBCXX_DEBUG)
00082 # define NDEBUG
00083 # endif
00084 # include <cassert>
00085 #endif
00086
00087
00088 #if defined(__GNUC__) && __GNUC__>=3
00089 # define ODBCXX_HAVE_ISO_CXXLIB
00090 #endif
00091
00092
00093 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)
00094 # if defined(ODBCXX_DLL)
00095 # if defined(IN_ODBCXX)
00096 # define ODBCXX_EXPORT __declspec(dllexport)
00097 # else
00098 # define ODBCXX_EXPORT __declspec(dllimport)
00099 # endif
00100 # endif
00101 #endif
00102
00103 #if !defined(ODBCXX_EXPORT)
00104 # define ODBCXX_EXPORT
00105 #endif
00106
00107 #if defined(_MSC_VER) || defined(__MINGW32__)
00108 # define ODBCXX_DUMMY_RETURN(x) return (x)
00109 #else
00110 # define ODBCXX_DUMMY_RETURN(x) ((void)0)
00111 #endif
00112
00113
00114
00115
00116 #if defined(ODBCXX_QT)
00117
00118 # define ODBCXX_STRING QString
00119 # define ODBCXX_STRING_C(s) QString::fromLocal8Bit(s)
00120 # define ODBCXX_STRING_CL(s,l) QString::fromLocal8Bit(s,l)
00121 # define ODBCXX_STRING_LEN(s) s.length()
00122 # define ODBCXX_STRING_DATA(s) s.local8Bit().data()
00123 # define ODBCXX_STRING_CSTR(s) s.local8Bit().data()
00124
00125 # define ODBCXX_STREAM QIODevice
00126
00127 # define ODBCXX_BYTES QByteArray
00128 # define ODBCXX_BYTES_SIZE(b) b.size()
00129 # define ODBCXX_BYTES_DATA(b) b.data()
00130 # define ODBCXX_BYTES_C(buf,len) QByteArray().duplicate(buf,len)
00131
00132 #else
00133
00134 # if defined(ODBCXX_UNICODE)
00135
00136 # define ODBCXX_STRING std::wstring
00137 # define ODBCXX_STRING_C(s) std::wstring(s)
00138 # define ODBCXX_STRING_CL(s,l) std::wstring(s,l)
00139 # define ODBCXX_STRING_LEN(s) s.length()
00140 # define ODBCXX_STRING_DATA(s) s.data()
00141 # define ODBCXX_STRING_CSTR(s) s.c_str()
00142
00143 # define ODBCXX_STREAM std::wistream
00144 # define ODBCXX_STREAMBUF std::wstreambuf
00145
00146 # define ODBCXX_BYTES odbc::Bytes
00147 # define ODBCXX_BYTES_SIZE(b) b.getSize()
00148 # define ODBCXX_BYTES_DATA(b) b.getData()
00149 # define ODBCXX_BYTES_C(buf,len) odbc::Bytes((wchar_t*)buf,(size_t)len)
00150
00151 # else
00152
00153 # define ODBCXX_STRING std::string
00154 # define ODBCXX_STRING_C(s) std::string(s)
00155 # define ODBCXX_STRING_CL(s,l) std::string(s,l)
00156 # define ODBCXX_STRING_LEN(s) s.length()
00157 # define ODBCXX_STRING_DATA(s) s.data()
00158 # define ODBCXX_STRING_CSTR(s) s.c_str()
00159
00160 # define ODBCXX_STREAM std::istream
00161 # define ODBCXX_STREAMBUF std::streambuf
00162
00163 # define ODBCXX_BYTES odbc::Bytes
00164 # define ODBCXX_BYTES_SIZE(b) b.getSize()
00165 # define ODBCXX_BYTES_DATA(b) b.getData()
00166 # define ODBCXX_BYTES_C(buf,len) odbc::Bytes((signed char*)buf,(size_t)len)
00167
00168 # endif // ODBCXX_UNICODE
00169
00170 #endif // ODBCXX_QT
00171
00172 #if defined(ODBCXX_UNICODE)
00173 # define ODBCXX_CHAR_TYPE wchar_t
00174 # define ODBCXX_SIGNED_CHAR_TYPE wchar_t
00175 # define ODBCXX_SQLCHAR SQLWCHAR
00176 # define ODBCXX_STRING_CONST(s) L ## s
00177 # define ODBCXX_COUT std::wcout
00178 # define ODBCXX_CERR std::wcerr
00179 # define ODBCXX_STRTOL wcstol
00180 #else
00181 # define ODBCXX_CHAR_TYPE char
00182 # define ODBCXX_SIGNED_CHAR_TYPE signed char
00183 # define ODBCXX_SQLCHAR SQLCHAR
00184 # define ODBCXX_STRING_CONST(s) s
00185 # define ODBCXX_COUT std::cout
00186 # define ODBCXX_CERR std::cerr
00187 # define ODBCXX_STRTOL strtol
00188 #endif
00189
00190 #endif // __ODBCXX_SETUP_H