📄 types_8h-source.html.svn-base
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>odbc++/types.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.13.1 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> </center><hr><h1>odbc++/types.h</h1><div class="fragment"><pre>00001 <font class="comment">/*</font>00002 <font class="comment"> This file is part of libodbc++.</font>00003 <font class="comment"></font>00004 <font class="comment"> Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net></font>00005 <font class="comment"></font>00006 <font class="comment"> This library is free software; you can redistribute it and/or</font>00007 <font class="comment"> modify it under the terms of the GNU Library General Public</font>00008 <font class="comment"> License as published by the Free Software Foundation; either</font>00009 <font class="comment"> version 2 of the License, or (at your option) any later version.</font>00010 <font class="comment"></font>00011 <font class="comment"> This library is distributed in the hope that it will be useful,</font>00012 <font class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</font>00013 <font class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>00014 <font class="comment"> Library General Public License for more details.</font>00015 <font class="comment"></font>00016 <font class="comment"> You should have received a copy of the GNU Library General Public License</font>00017 <font class="comment"> along with this library; see the file COPYING. If not, write to</font>00018 <font class="comment"> the Free Software Foundation, Inc., 59 Temple Place - Suite 330,</font>00019 <font class="comment"> Boston, MA 02111-1307, USA.</font>00020 <font class="comment">*/</font>00021 00022 <font class="preprocessor">#ifndef __ODBCXX_TYPES_H</font>00023 <font class="preprocessor"></font><font class="preprocessor">#define __ODBCXX_TYPES_H</font>00024 <font class="preprocessor"></font>00025 <font class="preprocessor">#include <odbc++/setup.h></font>00026 00027 <font class="preprocessor">#include <exception></font>00028 00029 <font class="preprocessor">#if !defined(ODBCXX_QT)</font>00030 <font class="preprocessor"></font><font class="preprocessor"># include <string></font>00031 <font class="preprocessor"># else</font>00032 <font class="preprocessor"></font><font class="preprocessor"># include <qstring.h></font>00033 <font class="preprocessor">#endif</font>00034 <font class="preprocessor"></font>00035 <font class="preprocessor">#include <ctime></font>00036 <font class="preprocessor">#if defined(ODBCXX_NO_STD_TIME_T)</font>00037 <font class="preprocessor"></font><font class="keyword">namespace </font>std {00038 using ::time_t;00039 };00040 <font class="preprocessor">#endif</font>00041 <font class="preprocessor"></font>00042 <font class="preprocessor">#if defined(ODBCXX_QT)</font>00043 <font class="preprocessor"></font><font class="keyword">class </font>QIODevice;00044 <font class="preprocessor">#endif</font>00045 <font class="preprocessor"></font>00046 <font class="preprocessor">#if defined(ODBCXX_HAVE_ISQL_H) && defined(ODBCXX_HAVE_ISQLEXT_H)</font>00047 <font class="preprocessor"></font><font class="preprocessor"># include <isql.h></font>00048 <font class="preprocessor"># include <isqlext.h></font>00049 <font class="preprocessor">#elif defined(ODBCXX_HAVE_SQL_H) && defined(ODBCXX_HAVE_SQLEXT_H)</font>00050 <font class="preprocessor"></font><font class="preprocessor"># include <sql.h></font>00051 <font class="preprocessor"># include <sqlext.h></font>00052 <font class="preprocessor">#else</font>00053 <font class="preprocessor"></font><font class="preprocessor"># error "Whoops. Can not recognize the ODBC subsystem."</font>00054 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00055 <font class="preprocessor"></font>00056 <font class="preprocessor">#if defined(ODBCXX_HAVE_SQLUCODE_H)</font>00057 <font class="preprocessor"></font><font class="preprocessor"># include <sqlucode.h></font>00058 <font class="preprocessor">#endif</font>00059 <font class="preprocessor"></font>00060 <font class="comment">// fixups for current iODBC, which kindly doesn't provide SQL_TRUE and</font>00061 <font class="comment">// SQL_FALSE macros</font>00062 00063 <font class="preprocessor">#if !defined(SQL_TRUE)</font>00064 <font class="preprocessor"></font><font class="preprocessor"># define SQL_TRUE 1</font>00065 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00066 <font class="preprocessor"></font>00067 <font class="preprocessor">#if !defined(SQL_FALSE)</font>00068 <font class="preprocessor"></font><font class="preprocessor"># define SQL_FALSE 0</font>00069 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00070 <font class="preprocessor"></font>00071 <font class="comment">// MS ODBC SDK misses this in some releases</font>00072 <font class="preprocessor">#if ODBCVER >= 0x0300 && !defined(SQL_NOT_DEFERRABLE)</font>00073 <font class="preprocessor"></font><font class="preprocessor"># define SQL_NOT_DEFERRABLE 7</font>00074 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00075 <font class="preprocessor"></font>00076 00077 <font class="comment">// Setup our ODBC3_C (odbc3 conditional) macro</font>00078 <font class="preprocessor">#if ODBCVER >= 0x0300</font>00079 <font class="preprocessor"></font>00080 <font class="preprocessor"># define ODBC3_C(odbc3_value,old_value) odbc3_value</font>00081 <font class="preprocessor"></font>00082 <font class="preprocessor">#else</font>00083 <font class="preprocessor"></font>00084 <font class="preprocessor"># define ODBC3_C(odbc3_value,old_value) old_value</font>00085 <font class="preprocessor"></font>00086 <font class="preprocessor">#endif</font>00087 <font class="preprocessor"></font>00088 00089 <font class="comment">// ODBC3_DC (odbc3 dynamic conditional)</font>00090 <font class="comment">// Every context using this macro should provide</font>00091 <font class="comment">// a this->_getDriverInfo() method returning</font>00092 <font class="comment">// a const DriverInfo*</font>00093 00094 <font class="preprocessor">#if ODBCVER >= 0x0300</font>00095 <font class="preprocessor"></font>00096 <font class="preprocessor"># define ODBC3_DC(odbc3_value,old_value) \</font>00097 <font class="preprocessor">(this->_getDriverInfo()->getMajorVersion()>=3?odbc3_value:old_value)</font>00098 <font class="preprocessor"></font>00099 <font class="preprocessor">#else</font>00100 <font class="preprocessor"></font>00101 <font class="preprocessor"># define ODBC3_DC(odbc3_value,old_value) old_value</font>00102 <font class="preprocessor"></font>00103 <font class="preprocessor">#endif</font>00104 <font class="preprocessor"></font>00105 <font class="preprocessor">#if defined(ODBCXX_HAVE_INTTYPES_H)</font>00106 <font class="preprocessor"></font><font class="preprocessor"># include <inttypes.h></font>00107 <font class="preprocessor">#endif</font>00108 <font class="preprocessor"></font>00109 <font class="preprocessor">#include <vector></font>00110 00111 00112 <font class="keyword">namespace </font>odbc {00113 00114 <font class="comment">// We want Long to be at least 64 bits</font>00115 00116 <font class="preprocessor">#if defined(WIN32)</font>00117 <font class="preprocessor"></font>00118 <font class="keyword">typedef</font> __int64 Long;00119 00120 <font class="preprocessor">#elif defined(ODBCXX_HAVE_INTTYPES_H)</font>00121 <font class="preprocessor"></font>00122 <font class="keyword">typedef</font> int64_t Long;00123 00124 <font class="preprocessor">#else</font>00125 <font class="preprocessor"></font>00126 <font class="preprocessor"># if ODBCXX_SIZEOF_INT == 8</font>00127 <font class="preprocessor"></font>00128 <font class="keyword">typedef</font> <font class="keywordtype">int</font> Long;00129 00130 <font class="preprocessor"># elif ODBCXX_SIZEOF_LONG == 8</font>00131 <font class="preprocessor"></font>00132 <font class="keyword">typedef</font> <font class="keywordtype">long</font> Long;00133 00134 <font class="preprocessor"># elif ODBCXX_SIZEOF_LONG_LONG == 8</font>00135 <font class="preprocessor"></font>00136 <font class="keyword">typedef</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> Long;00137 00138 <font class="preprocessor"># else</font>00139 <font class="preprocessor"></font>00140 <font class="preprocessor"># error "Can't find an appropriate at-least-64-bit integer"</font>00141 <font class="preprocessor"></font>00142 <font class="preprocessor"># endif</font>00143 <font class="preprocessor"></font>00144 <font class="preprocessor">#endif</font>00145 <font class="preprocessor"></font>00146 00147 <font class="comment">//constants:</font>00148 <font class="comment">//how much we try to fetch with each SQLGetData call</font>00149 <font class="keyword">const</font> <font class="keywordtype">int</font> GETDATA_CHUNK_SIZE=4*1024;00150 <font class="comment">//how much we write with each SQLPutData call</font>00151 <font class="keyword">const</font> <font class="keywordtype">int</font> PUTDATA_CHUNK_SIZE=GETDATA_CHUNK_SIZE;00152 00153 <font class="comment">//how much we read/write in string<->stream conversion</font>00154 <font class="comment">//better names for those?</font>00155 <font class="keyword">const</font> <font class="keywordtype">int</font> STRING_TO_STREAM_CHUNK_SIZE=1024;00156 <font class="keyword">const</font> <font class="keywordtype">int</font> STREAM_TO_STRING_CHUNK_SIZE=STRING_TO_STREAM_CHUNK_SIZE;00157 00158 00159 00160 00161 <a name="l00164"></a><a class="code" href="structodbc_1_1_types.html">00164</a> <font class="keyword">struct </font>Types {<a name="l00167"></a><a class="code" href="structodbc_1_1_types.html#s19">00167</a> <font class="keyword">enum</font> <a class="code" href="structodbc_1_1_types.html#s19">SQLType</a> {00169 <a class="code" href="structodbc_1_1_types.html#s19s0">BIGINT</a> = SQL_BIGINT,00171 <a class="code" href="structodbc_1_1_types.html#s19s1">BINARY</a> = SQL_BINARY,00173 <a class="code" href="structodbc_1_1_types.html#s19s2">BIT</a> = SQL_BIT,00175 <a class="code" href="structodbc_1_1_types.html#s19s3">CHAR</a> = SQL_CHAR,00177 <a class="code" href="structodbc_1_1_types.html#s19s4">DATE</a> = ODBC3_C(SQL_TYPE_DATE,SQL_DATE),00179 <a class="code" href="structodbc_1_1_types.html#s19s5">DECIMAL</a> = SQL_DECIMAL,00181 <a class="code" href="structodbc_1_1_types.html#s19s6">DOUBLE</a> = SQL_DOUBLE,00183 <a class="code" href="structodbc_1_1_types.html#s19s7">FLOAT</a> = SQL_FLOAT,00185 <a class="code" href="structodbc_1_1_types.html#s19s8">INTEGER</a> = SQL_INTEGER,00187 <a class="code" href="structodbc_1_1_types.html#s19s9">LONGVARBINARY</a> = SQL_LONGVARBINARY,00189 <a class="code" href="structodbc_1_1_types.html#s19s10">LONGVARCHAR</a> = SQL_LONGVARCHAR,00191 <a class="code" href="structodbc_1_1_types.html#s19s11">NUMERIC</a> = SQL_NUMERIC,00193 <a class="code" href="structodbc_1_1_types.html#s19s12">REAL</a> = SQL_REAL,00195 <a class="code" href="structodbc_1_1_types.html#s19s13">SMALLINT</a> = SQL_SMALLINT,00197 <a class="code" href="structodbc_1_1_types.html#s19s14">TIME</a> = ODBC3_C(SQL_TYPE_TIME,SQL_TIME),00199 <a class="code" href="structodbc_1_1_types.html#s19s15">TIMESTAMP</a> = ODBC3_C(SQL_TYPE_TIMESTAMP,SQL_TIMESTAMP),00201 <a class="code" href="structodbc_1_1_types.html#s19s16">TINYINT</a> = SQL_TINYINT,00203 <a class="code" href="structodbc_1_1_types.html#s19s17">VARBINARY</a> = SQL_VARBINARY,00205 <a class="code" href="structodbc_1_1_types.html#s19s18">VARCHAR</a> = SQL_VARCHAR00206 <font class="preprocessor">#if defined(ODBCXX_HAVE_SQLUCODE_H)</font>00207 <font class="preprocessor"></font> ,00209 WCHAR = SQL_WCHAR,00211 WVARCHAR = SQL_WVARCHAR,00213 WLONGVARCHAR = SQL_WLONGVARCHAR00214 <font class="preprocessor">#endif</font>00215 <font class="preprocessor"></font> };00216 };00217 00218 00219 <font class="preprocessor">#if !defined(ODBCXX_QT)</font>00220 <font class="preprocessor"></font><a name="l00226"></a><a class="code" href="classodbc_1_1_bytes.html">00226</a> <font class="keyword">class </font>ODBCXX_EXPORT Bytes {00227 <font class="keyword">private</font>:00228 <font class="keyword">struct </font>Rep {00229 ODBCXX_SIGNED_CHAR_TYPE* buf_;00230 size_t len_;00231 <font class="keywordtype">int</font> refCount_;00232 Rep(<font class="keyword">const</font> ODBCXX_SIGNED_CHAR_TYPE* b, size_t l)00233 :len_(l), refCount_(0) {00234 <font class="keywordflow">if</font>(len_>0) {00235 buf_=<font class="keyword">new</font> ODBCXX_SIGNED_CHAR_TYPE[len_];00236 memcpy((<font class="keywordtype">void</font>*)buf_,(<font class="keywordtype">void</font>*)b,len_);00237 } <font class="keywordflow">else</font> {00238 buf_=NULL;00239 }00240 }00241 ~Rep() {00242 <font class="keyword">delete</font> [] buf_;00243 }00244 };00245 00246 Rep* rep_;00247 <font class="keyword">public</font>:<a name="l00249"></a><a class="code" href="classodbc_1_1_bytes.html#a0">00249</a> Bytes()00250 :rep_(new Rep(NULL,0)) {00251 rep_->refCount_++;00252 }00253 <a name="l00255"></a><a class="code" href="classodbc_1_1_bytes.html#a1">00255</a> Bytes(<font class="keyword">const</font> ODBCXX_SIGNED_CHAR_TYPE* data, size_t dataLen)00256 :rep_(new Rep(data,dataLen)) {00257 rep_->refCount_++;00258 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -