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

📄 db.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 5 页
字号:
\section{\class{wxDb}}\label{wxdb}A wxDb instance is a connection to an ODBC datasource which maybe opened, closed, and re-opened an unlimited number of times.  Adatabase connection allows function to be performed directly on thedatasource, as well as allowing access to any tables/views defined inthe datasource to which the user has sufficient privileges.See the \helpref{database classes overview}{odbcoverview} foran introduction to using the ODBC classes.\wxheading{Include files}<wx/db.h>\wxheading{Helper classes and data structures}The following classes and structs are defined in db.cpp/.h for use with the wxDb class.\begin{itemize}\itemsep=0pt\item \helpref{wxDbColFor}{wxdbcolfor}\item \helpref{wxDbColInf}{wxdbcolinf}\item \helpref{wxDbTableInf}{wxdbtableinf}\item \helpref{wxDbInf}{wxdbinf}\end{itemize}\wxheading{Constants}NOTE: In a future release, all ODBC class constants will be prefaced with 'wx'.\begin{verbatim}    wxDB_PATH_MAX           Maximum path length allowed to be passed to                            the ODBC driver to indicate where the data                            file(s) are located.    DB_MAX_COLUMN_NAME_LEN  Maximum supported length for the name of a                            column    DB_MAX_ERROR_HISTORY    Maximum number of error messages retained in                            the queue before being overwritten by new                            errors.    DB_MAX_ERROR_MSG_LEN    Maximum supported length of an error message                            returned by the ODBC classes    DB_MAX_STATEMENT_LEN    Maximum supported length for a complete SQL                            statement to be passed to the ODBC driver    DB_MAX_TABLE_NAME_LEN   Maximum supported length for the name of a                            table    DB_MAX_WHERE_CLAUSE_LEN Maximum supported WHERE clause length that                            can be passed to the ODBC driver    DB_TYPE_NAME_LEN        Maximum length of the name of a column's                            data type\end{verbatim}\subsection{Enumerated types}\label{wxdbenumeratedtypes}\wxheading{Enumerated types}\docparam{enum {\bf wxDbSqlLogState}}{sqlLogOFF, sqlLogON}{\it enum {\bf wxDBMS}}These are the databases currently tested and working with the ODBC classes.  A call to \helpref{wxDb::Dbms}{wxdbdbms} will return one of these enumerated values listed below.\begin{itemize}\itemsep=0pt\item DB2\item DBase (IV, V)**\item Firebird\item INFORMIX\item Interbase\item MS SQL Server (v7 - minimal testing)\item MS Access (97, 2000, 2002, and 2003)\item MySQL (2.x and 3.5 - use the 2.5x drivers though)\item Oracle (v7, v8, v8i)\item Pervasive SQL\item PostgreSQL\item Sybase (ASA and ASE)\item XBase Sequiter\item VIRTUOSO\end{itemize}See the remarks in \helpref{wxDb::Dbms}{wxdbdbms} for exceptions/issues with each of these database engines.\wxheading{Public member variables}\docparam{SWORD {\bf wxDb::cbErrorMsg}}{This member variable is populated as a result of calling \helpref{wxDb::GetNextError}{wxdbgetnexterror}.  Contains the count of bytes in the wxDb::errorMsg string.}\docparam{int {\bf wxDb::DB\_STATUS}}{The last ODBC error/status that occurred on this data connection.  Possible codes are:}\begin{verbatim}   DB_ERR_GENERAL_WARNING                     // SqlState = '01000'   DB_ERR_DISCONNECT_ERROR                    // SqlState = '01002'   DB_ERR_DATA_TRUNCATED                      // SqlState = '01004'   DB_ERR_PRIV_NOT_REVOKED                    // SqlState = '01006'   DB_ERR_INVALID_CONN_STR_ATTR               // SqlState = '01S00'   DB_ERR_ERROR_IN_ROW                        // SqlState = '01S01'   DB_ERR_OPTION_VALUE_CHANGED                // SqlState = '01S02'   DB_ERR_NO_ROWS_UPD_OR_DEL                  // SqlState = '01S03'   DB_ERR_MULTI_ROWS_UPD_OR_DEL               // SqlState = '01S04'   DB_ERR_WRONG_NO_OF_PARAMS                  // SqlState = '07001'   DB_ERR_DATA_TYPE_ATTR_VIOL                 // SqlState = '07006'   DB_ERR_UNABLE_TO_CONNECT                   // SqlState = '08001'   DB_ERR_CONNECTION_IN_USE                   // SqlState = '08002'   DB_ERR_CONNECTION_NOT_OPEN                 // SqlState = '08003'   DB_ERR_REJECTED_CONNECTION                 // SqlState = '08004'   DB_ERR_CONN_FAIL_IN_TRANS                  // SqlState = '08007'   DB_ERR_COMM_LINK_FAILURE                   // SqlState = '08S01'   DB_ERR_INSERT_VALUE_LIST_MISMATCH          // SqlState = '21S01'   DB_ERR_DERIVED_TABLE_MISMATCH              // SqlState = '21S02'   DB_ERR_STRING_RIGHT_TRUNC                  // SqlState = '22001'   DB_ERR_NUMERIC_VALUE_OUT_OF_RNG            // SqlState = '22003'   DB_ERR_ERROR_IN_ASSIGNMENT                 // SqlState = '22005'   DB_ERR_DATETIME_FLD_OVERFLOW               // SqlState = '22008'   DB_ERR_DIVIDE_BY_ZERO                      // SqlState = '22012'   DB_ERR_STR_DATA_LENGTH_MISMATCH            // SqlState = '22026'   DB_ERR_INTEGRITY_CONSTRAINT_VIOL           // SqlState = '23000'   DB_ERR_INVALID_CURSOR_STATE                // SqlState = '24000'   DB_ERR_INVALID_TRANS_STATE                 // SqlState = '25000'   DB_ERR_INVALID_AUTH_SPEC                   // SqlState = '28000'   DB_ERR_INVALID_CURSOR_NAME                 // SqlState = '34000'   DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL         // SqlState = '37000'   DB_ERR_DUPLICATE_CURSOR_NAME               // SqlState = '3C000'   DB_ERR_SERIALIZATION_FAILURE               // SqlState = '40001'   DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2        // SqlState = '42000'   DB_ERR_OPERATION_ABORTED                   // SqlState = '70100'   DB_ERR_UNSUPPORTED_FUNCTION                // SqlState = 'IM001'   DB_ERR_NO_DATA_SOURCE                      // SqlState = 'IM002'   DB_ERR_DRIVER_LOAD_ERROR                   // SqlState = 'IM003'   DB_ERR_SQLALLOCENV_FAILED                  // SqlState = 'IM004'   DB_ERR_SQLALLOCCONNECT_FAILED              // SqlState = 'IM005'   DB_ERR_SQLSETCONNECTOPTION_FAILED          // SqlState = 'IM006'   DB_ERR_NO_DATA_SOURCE_DLG_PROHIB           // SqlState = 'IM007'   DB_ERR_DIALOG_FAILED                       // SqlState = 'IM008'   DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL      // SqlState = 'IM009'   DB_ERR_DATA_SOURCE_NAME_TOO_LONG           // SqlState = 'IM010'   DB_ERR_DRIVER_NAME_TOO_LONG                // SqlState = 'IM011'   DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR         // SqlState = 'IM012'   DB_ERR_TRACE_FILE_ERROR                    // SqlState = 'IM013'   DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS        // SqlState = 'S0001'   DB_ERR_TABLE_NOT_FOUND                     // SqlState = 'S0002'   DB_ERR_INDEX_ALREADY_EXISTS                // SqlState = 'S0011'   DB_ERR_INDEX_NOT_FOUND                     // SqlState = 'S0012'   DB_ERR_COLUMN_ALREADY_EXISTS               // SqlState = 'S0021'   DB_ERR_COLUMN_NOT_FOUND                    // SqlState = 'S0022'   DB_ERR_NO_DEFAULT_FOR_COLUMN               // SqlState = 'S0023'   DB_ERR_GENERAL_ERROR                       // SqlState = 'S1000'   DB_ERR_MEMORY_ALLOCATION_FAILURE           // SqlState = 'S1001'   DB_ERR_INVALID_COLUMN_NUMBER               // SqlState = 'S1002'   DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE           // SqlState = 'S1003'   DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE          // SqlState = 'S1004'   DB_ERR_OPERATION_CANCELLED                 // SqlState = 'S1008'   DB_ERR_INVALID_ARGUMENT_VALUE              // SqlState = 'S1009'   DB_ERR_FUNCTION_SEQUENCE_ERROR             // SqlState = 'S1010'   DB_ERR_OPERATION_INVALID_AT_THIS_TIME      // SqlState = 'S1011'   DB_ERR_INVALID_TRANS_OPERATION_CODE        // SqlState = 'S1012'   DB_ERR_NO_CURSOR_NAME_AVAIL                // SqlState = 'S1015'   DB_ERR_INVALID_STR_OR_BUF_LEN              // SqlState = 'S1090'   DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE        // SqlState = 'S1091'   DB_ERR_OPTION_TYPE_OUT_OF_RANGE            // SqlState = 'S1092'   DB_ERR_INVALID_PARAM_NO                    // SqlState = 'S1093'   DB_ERR_INVALID_SCALE_VALUE                 // SqlState = 'S1094'   DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE          // SqlState = 'S1095'   DB_ERR_INF_TYPE_OUT_OF_RANGE               // SqlState = 'S1096'   DB_ERR_COLUMN_TYPE_OUT_OF_RANGE            // SqlState = 'S1097'   DB_ERR_SCOPE_TYPE_OUT_OF_RANGE             // SqlState = 'S1098'   DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE          // SqlState = 'S1099'   DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE // SqlState = 'S1100'   DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE   // SqlState = 'S1101'   DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE       // SqlState = 'S1103'   DB_ERR_INVALID_PRECISION_VALUE             // SqlState = 'S1104'   DB_ERR_INVALID_PARAM_TYPE                  // SqlState = 'S1105'   DB_ERR_FETCH_TYPE_OUT_OF_RANGE             // SqlState = 'S1106'   DB_ERR_ROW_VALUE_OUT_OF_RANGE              // SqlState = 'S1107'   DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE     // SqlState = 'S1108'   DB_ERR_INVALID_CURSOR_POSITION             // SqlState = 'S1109'   DB_ERR_INVALID_DRIVER_COMPLETION           // SqlState = 'S1110'   DB_ERR_INVALID_BOOKMARK_VALUE              // SqlState = 'S1111'   DB_ERR_DRIVER_NOT_CAPABLE                  // SqlState = 'S1C00'   DB_ERR_TIMEOUT_EXPIRED                     // SqlState = 'S1T00'\end{verbatim}\docparam{struct {\bf wxDb::dbInf}}{This structure is internal to thewxDb class and contains details of the ODBC datasource that the currentinstance of the wxDb is connected to in its members.  When the datasourceis opened, all of the information contained in the dbInf structure isqueried from the datasource.  This information is used almost exclusivelywithin the ODBC class library.  Where there may be a need for particularportions of this information outside of the class library, memberfunctions (e.g.\helpref{wxDbTable::IsCursorClosedOnCommit}{wxdbtableiscursorclosedoncommit})have been added for ease of use.}\begin{verbatim}   wxChar dbmsName[40]        - Name of the dbms product   wxChar dbmsVer[64]         - Version # of the dbms product   wxChar driverName[40]      - Driver name   wxChar odbcVer[60]         - ODBC version of the driver   wxChar drvMgrOdbcVer[60]   - ODBC version of the driver manager   wxChar driverVer[60]       - Driver version   wxChar serverName[80]      - Server Name, typically a connect string   wxChar databaseName[128]   - Database filename   wxChar outerJoins[2]       - Does datasource support outer joins   wxChar procedureSupport[2] - Does datasource support stored                                procedures   UWORD  maxConnections      - Maximum # of connections datasource                                supports   UWORD  maxStmts            - Maximum # of HSTMTs per HDBC   UWORD  apiConfLvl          - ODBC API conformance level   UWORD  cliConfLvl          - Is datasource SAG compliant   UWORD  sqlConfLvl          - SQL conformance level   UWORD  cursorCommitBehavior   - How cursors are affected on db commit   UWORD  cursorRollbackBehavior - How cursors are affected on db                                   rollback   UWORD  supportNotNullClause   - Does datasource support NOT NULL                                   clause   wxChar supportIEF[2]       - Integrity Enhancement Facility (Ref.                                Integrity)   UDWORD txnIsolation        - Transaction isolation level supported by                                driver   UDWORD txnIsolationOptions - Transaction isolation level options                                available   UDWORD fetchDirections     - Fetch directions supported   UDWORD lockTypes           - Lock types supported in SQLSetPos   UDWORD posOperations       - Position operations supported in                                SQLSetPos   UDWORD posStmts            - Position statements supported   UDWORD scrollConcurrency   - Scrollable cursor concurrency options                                supported   UDWORD scrollOptions       - Scrollable cursor options supported   UDWORD staticSensitivity   - Can additions/deletions/updates be                                detected   UWORD  txnCapable          - Indicates if datasource supports                                transactions   UDWORD loginTimeout        - Number seconds to wait for a login                                request\end{verbatim}\docparam{wxChar {\bf wxDb::errorList}[DB\_MAX\_ERROR\_HISTORY][DB\_MAX\_ERROR\_MSG\_LEN]}{The last n ODBC errors that have occurred on this database connection.}\docparam{wxChar {\bf wxDb::errorMsg}[SQL\_MAX\_MESSAGE\_LENGTH]}{This member variable is populated as a result of calling \helpref{wxDb::GetNextError}{wxdbgetnexterror}.  It contains the ODBC error message text.}\docparam{SDWORD {\bf wxDb::nativeError}}{Set by wxDb::DispAllErrors,wxDb::GetNextError, and wxDb::DispNextError.  It contains thedatasource-specific error code returned by the datasource to the ODBC driver.Used for reporting ODBC errors.}\docparam{wxChar {\bf wxDb::sqlState}[20]}{Set by wxDb::TranslateSqlState().Indicates the error state after a failed ODBC operation.  Used for reportingODBC errors.}\wxheading{Remarks}Default cursor scrolling is defined by wxODBC\_FWD\_ONLY\_CURSORS in setup.hwhen the wxWidgets library is built.  This behavior can be overridden whenan instance of a wxDb is created (see \helpref{wxDb constructor}{wxdbctor}).Default setting of this value true, as not all databases/drivers supportboth types of cursors.\wxheading{See also}\helpref{wxDbColFor}{wxdbcolfor}, \helpref{wxDbColInf}{wxdbcolinf},\helpref{wxDbTable}{wxdbtable}, \helpref{wxDbTableInf}{wxdbtableinf},\helpref{wxDbInf}{wxdbinf}\subsection{Associated non-class functions}\label{wxdbfunctions}The following functions are used in conjunction with the wxDb class.\func{void}{wxDbCloseConnections}{\void}\wxheading{Remarks}Closes all cached connections that have been made through use of the\helpref{wxDbGetConnection}{wxdbfunctions} function.NOTE: These connections are closed regardless of whether they are in useor not.  This function should only be called after the program hasfinished using the connections and all wxDbTable instances that use any ofthe connections have been closed.This function performs a \helpref{wxDb::CommitTrans}{wxdbcommittrans}on the connection before closing it to commit any changes that are stillpending, as well as to avoid any function sequence errors upon closingeach connection.\func{int }{wxDbConnectionsInUse}{\void}\wxheading{Remarks}Returns a count of how many database connections are currently free ( notbeing used) that have been cached through use of the \helpref{wxDbGetConnection}{wxdbfunctions}function.\func{bool}{wxDbFreeConnection}{\param{wxDb *}{pDb}}\wxheading{Remarks}Searches the list of cached database connections connection for one matchingthe passed in wxDb instance.  If found, that cached connection is freed.Freeing a connection means that it is marked as available (free) in thecache of connections, so that a call to \helpref{wxDbGetConnection}{wxdbfunctions}is able to return a pointer to the wxDb instance for use.  Freeing a

⌨️ 快捷键说明

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