⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sql-driver.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/doc/sql-driver.doc:35 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>SQL Module - Drivers</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>SQL Module - Drivers</h1> <p> <!-- toc --><ul><li><a href="#1"> Introduction</a><li><a href="#2"> Building the drivers using configure</a><li><a href="#3"> Building the plugins manually</a><ul><li><a href="#3-1"> QMYSQL3 - MySQL 3.x</a><ul><li><a href="#3-1-1"> General information</a><li><a href="#3-1-2"> How to build the plugin on Unix/Linux</a><li><a href="#3-1-3"> How to build the plugin on Windows</a></ul><li><a href="#3-2"> QOCI8 - Oracle Call Interface (OCI)</a><ul><li><a href="#3-2-1"> General information</a><li><a href="#3-2-2"> Unicode support</a><li><a href="#3-2-3"> BLOB/LOB support</a><li><a href="#3-2-4"> How to build the plugin on Unix/Linux</a><li><a href="#3-2-5"> How to build the plugin on Windows</a></ul><li><a href="#3-3"> QODBC3 - Open Database Connectivity (ODBC)</a><ul><li><a href="#3-3-1"> General information</a><li><a href="#3-3-2"> How to build the plugin on Unix/Linux</a><li><a href="#3-3-3"> How to build the plugin on Windows</a></ul><li><a href="#3-4"> QPSQL7 - PostgreSQL version 6 and 7</a><ul><li><a href="#3-4-1"> General information</a><li><a href="#3-4-2"> Unicode support</a><li><a href="#3-4-3"> BLOB support</a><li><a href="#3-4-4"> How to build the plugin on Unix/Linux</a></ul><li><a href="#3-5"> QTDS7 - Sybase Adaptive Server and Microsoft SQL Server</a><ul><li><a href="#3-5-1"> How to build the plugin on Unix/Linux</a><li><a href="#3-5-2"> How to build the plugin on Windows</a></ul></ul><li><a href="#4"> Troubleshooting</a><li><a href="#5"> How to write your own database driver</a></ul><!-- endtoc --><p> <a name="Introduction"></a><h2> Introduction</h2><a name="1"></a><p> The <a href="sql.html">SQL Module</a> uses driver <a href="plugins-howto.html">plugins</a> in order to communicate with different database APIs.Since the SQL Module API is database-independent, alldatabase-specific code is contained within these drivers.  Severaldrivers are supplied with Qt and other drivers can be added. Thedriver source code is supplied and can be used as a model for <a href="#development">writing your own drivers</a>.<p> To build a driver plugin you need the client API that is shipped withevery Database Management System (DBMS). Most installation programsalso allow you to install "development libraries", and these are whatyou need. These libraries are responsible for the low-levelcommunication with the DBMS.<p> The currently available drivers shipped with Qt are:<ul><li> <a href="#QMYSQL3">QMYSQL3</a> - MySQL Driver<li> <a href="#QOCI8">QOCI8</a> - Oracle Call Interface Driver, version 8 and 9<li> <a href="#QODBC3">QODBC3</a> - Open Database Connectivity Driver<li> <a href="#QPSQL7">QPSQL7</a> - PostgreSQL v6.x and v7.x Driver<li> <a href="#QTDS7">QTDS7</a> - Sybase Adaptive Server and Microsoft SQL Server Driver</ul><p> Note that not all of the plugins are shipped with the Qt Free Editiondue to license incompatibilities with the GPL. <p> <h2> Building the drivers using configure</h2><a name="2"></a><p> The Qt configure script automatically detects the available clientlibraries on your machine. Run "configure -help" to see what driversmay be built. You should get an output similar to this:<p> <pre>Possible values for &lt;driver&gt;: [ mysql oci odbc psql tds ]Auto-Detected on this system: [ mysql psql ]</pre> <p> Note that on Windows, the configure script doesn't currently do anyauto-detection.<p> Note that configure cannot detect the neccessary libraries and includefiles if they are not in the standard paths, so it may be necessary tospecify these paths using the "-I" and "-L" switches. If your MySQLinclude files are installed in /usr/local/mysql (or in C:&#92;mysql&#92;includeon Windows), then pass the following parameter to configure:"-I/usr/local/mysql" (or "-I C:&#92;mysql&#92;include" for Windows).<p> Note that on Windows the parameter -I doesn't allow spaces in filenames, so use the 8.3 name instead, i.e. use "C:&#92;progra~1&#92;mysql" instead of"C:&#92;program files&#92;mysql".<p> Use the <tt>-qt-sql-&lt;driver&gt;</tt> parameter to build the database driver staticallyinto your Qt library or <tt>-plugin-sql-&lt;driver&gt;</tt> to build the driver as aplugin. Look at the chapters below for additional information about requiredlibraries.<p> <h2> Building the plugins manually</h2><a name="3"></a><p> <a name="QMYSQL3"></a><h3> QMYSQL3 - MySQL 3.x</h3><a name="3-1"></a><p> <!-- index QMYSQL3 --><a name="QMYSQL3"></a><p> <h4> General information</h4><a name="3-1-1"></a><p> MySQL 3.x doesn't support SQL transactions by default. There are somebackends which offer this functionality. Recent versions of the MySQLclient libraries (>3.23.34) allow you to use transactions on thosemodified servers.<p> If you have a recent client library and connect to a transaction-enabled MySQLserver, a call to the <a href="qsqldriver.html#hasFeature">QSqlDriver::hasFeature</a>( QSqlDriver::Transactions ) function returns TRUE and SQL transactions can be used.<p> You can find information about MySQL on <a href="http://www.mysql.com">http://www.mysql.com</a><p> <h4> How to build the plugin on Unix/Linux</h4><a name="3-1-2"></a><p> You need the MySQL header files and as well as the shared library"libmysqlclient.so". Depending on your Linux distribution you need toinstall a package which is usually called "mysql-devel".<p> Tell qmake where to find the MySQL header files and shared libraries(here it is assumed that MySQL is installed in /usr/local) and run make:<p> <pre>cd $QTDIR/plugins/src/sqldrivers/mysqlqmake -o Makefile "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient" mysql.promake</pre> <p> <h4> How to build the plugin on Windows</h4><a name="3-1-3"></a><p> You need to get the MySQL installation files. Run SETUP.EXE andchoose "Custom Install". Install the "Libs & Include Files" Module.Build the plugin as follows (here it is assumed that MySQL isinstalled in C:&#92;MYSQL):<p> <pre>cd %QTDIR%\plugins\src\sqldrivers\mysqlqmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pronmake</pre> <p> If you are not using a Microsoft compiler, replace "nmake" with "make" in thestatement above.<p> <a name="QOCI8"></a><h3> QOCI8 - Oracle Call Interface (OCI)</h3><a name="3-2"></a><p> <!-- index QOCI8 --><a name="QOCI8"></a><p> <h4> General information</h4><a name="3-2-1"></a><p> The Qt OCI plugin supports both Oracle 8 and Oracle 9. Afterconnecting to the Oracle server, the plugin will auto-detect thedatabase version and enable features accordingly.<p> <h4> Unicode support</h4><a name="3-2-2"></a><p> If the Oracle server supports Unicode, the OCI plugin will use UTF-8encoding to communicate with the server. When accessing an Oracle 8database, only retrieval of Unicode strings are supported. For Oracle9 both retrieval and insertion of Unicode strings are supported.<p> <h4> BLOB/LOB support</h4><a name="3-2-3"></a><p> Binary Large Objects (BLOBs) can be retrieved, but be aware that thisprocess may require a lot of memory. We recommend using separatequeries and retrieving only one BLOB at a time.<p> Inserting BLOB fields is limited to Oracle's maximum SQL string size.<p> <h4> How to build the plugin on Unix/Linux</h4><a name="3-2-4"></a><p> All files required to build driver should ship with the standard OracleClient install.<p> Oracle library files required to build driver:<p> <ul><li> libclntsh.so<li> libclntsh.so.8.0 (Oracle 8) or libclntsh.so.9.0 (Oracle 9)<li> libwtc8.so or libwtc9.so</ul><p> Tell qmake where to find the Oracle header files and shared libraries(it is assumed that the variable $ORACLE_HOME points to the directorywhere Oracle is installed) and run make:<p> If you are using Oracle 8:<pre>cd $QTDIR/plugins/src/sqldrivers/ociqmake -o Makefile "INCLUDEPATH+=$ORACLE_HOME/rdbms/public $ORACLE_HOME/rdbms/demo" "LIBS+=-L$ORACLE_HOME/lib -lclntsh -lwtc8" oci.promake</pre> <p> For Oracle version 9:<pre>cd $QTDIR/plugins/src/sqldrivers/oci

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -