📄 database.tex
字号:
\section{\class{wxDatabase}}\label{wxdatabase}Every database object represents an ODBC connection.The connection may be closed and reopened.\wxheading{Derived from}\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/odbc.h>\wxheading{See also}\overview{wxDatabase overview}{wxdatabaseoverview}, \helpref{wxRecordSet}{wxrecordset}A much more robust and feature-rich set of ODBC classes is nowavailable and recommended for use in place of the wxDatabase class.See details of these classes in:\helpref{wxDb}{wxdb}, \helpref{wxDbTable}{wxdbtable}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxDatabase::wxDatabase}\func{}{wxDatabase}{\void}Constructor. The constructor of the first wxDatabase instance of anapplication initializes the ODBC manager.\membersection{wxDatabase::\destruct{wxDatabase}}\func{}{\destruct{wxDatabase}}{\void}Destructor. Resets and destroys any associated wxRecordSet instances.The destructor of the last wxDatabase instance will deinitializethe ODBC manager.\membersection{wxDatabase::BeginTrans}\func{bool}{BeginTrans}{\void}Not implemented.\membersection{wxDatabase::Cancel}\func{void}{Cancel}{\void}Not implemented.\membersection{wxDatabase::CanTransact}\func{bool}{CanTransact}{\void}Not implemented.\membersection{wxDatabase::CanUpdate}\func{bool}{CanUpdate}{\void}Not implemented.\membersection{wxDatabase::Close}\func{bool}{Close}{\void}Resets the statement handles of any associated wxRecordSet objects,and disconnects from the current data source.\membersection{wxDatabase::CommitTrans}\func{bool}{CommitTrans}{\void}Commits previous transactions. Not implemented.\membersection{wxDatabase::GetDatabaseName}\func{wxString}{GetDatabaseName}{\void}Returns the name of the database associated with the current connection.\membersection{wxDatabase::GetDataSource}\func{wxString}{GetDataSource}{\void}Returns the name of the connected data source.\membersection{wxDatabase::GetErrorClass}\func{wxString}{GetErrorClass}{\void}Returns the error class of the last error. The error class consists offive characters where the first two characters contain the classand the other three characters contain the subclass of the ODBC error.See ODBC documentation for further details.\membersection{wxDatabase::GetErrorCode}\func{wxRETCODE}{GetErrorCode}{\void}Returns the error code of the last ODBC function call. This will be one of:\begin{twocollist}\itemsep=0pt\twocolitem{SQL\_ERROR}{General error.}\twocolitem{SQL\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.}\twocolitem{SQL\_NEED\_DATA}{ODBC expected some data.}\twocolitem{SQL\_NO\_DATA\_FOUND}{No data was found by this ODBC call.}\twocolitem{SQL\_SUCCESS}{The call was successful.}\twocolitem{SQL\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can beobtained from the ODBC manager.}\end{twocollist}\membersection{wxDatabase::GetErrorMessage}\func{wxString}{GetErrorMessage}{\void}Returns the last error message returned by the ODBC manager.\membersection{wxDatabase::GetErrorNumber}\func{long}{GetErrorNumber}{\void}Returns the last native error. A native error is an ODBC driver dependenterror number.\membersection{wxDatabase::GetHDBC}\func{HDBC}{GetHDBC}{\void}Returns the current ODBC database handle.\membersection{wxDatabase::GetHENV}\func{HENV}{GetHENV}{\void}Returns the ODBC environment handle. \membersection{wxDatabase::GetInfo}\func{bool}{GetInfo}{\param{long}{ infoType}, \param{long *}{buf}}\func{bool}{GetInfo}{\param{long}{ infoType}, \param{const wxString\& }{buf}, \param{int}{ bufSize=-1}}Returns requested information. The return value is true if successful, false otherwise.{\it infoType} is an ODBC identifier specifying the type of information to be returned.{\it buf} is a character or long integer pointer to storage which must be allocated by theapplication, and which will contain the information if the function is successful.{\it bufSize} is the size of the character buffer. A value of -1 indicates that the sizeshould be computed by the GetInfo function.\membersection{wxDatabase::GetPassword}\func{wxString}{GetPassword}{\void}Returns the password of the current user.\membersection{wxDatabase::GetUsername}\func{wxString}{GetUsername}{\void}Returns the current username.\membersection{wxDatabase::GetODBCVersionFloat}\func{float}{GetODBCVersionFloat}{\param{bool}{ implementation=true}}Returns the version of ODBC in floating point format, e.g. 2.50.{\it implementation} should be true to get the DLL version, or false to get theversion defined in the {\tt sql.h} header file.This function can return the value 0.0 if the header version number is not defined (for earlyversions of ODBC).\membersection{wxDatabase::GetODBCVersionString}\func{wxString}{GetODBCVersionString}{\param{bool}{ implementation=true}}Returns the version of ODBC in string format, e.g. ``02.50".{\it implementation} should be true to get the DLL version, or false to get theversion defined in the {\tt sql.h} header file.This function can return the value ``00.00" if the header version number is not defined (for earlyversions of ODBC).\membersection{wxDatabase::InWaitForDataSource}\func{bool}{InWaitForDataSource}{\void}Not implemented.\membersection{wxDatabase::IsOpen}\func{bool}{IsOpen}{\void}Returns true if a connection is open.\membersection{wxDatabase::Open}\label{wxdatabaseopen}\func{bool}{Open}{\param{const wxString\& }{datasource}, \param{bool}{ exclusive = false}, \param{bool }{readOnly = true}, \param{const wxString\& }{username = ``ODBC"}, \param{const wxString\& }{password = ``"}}Connect to a data source. {\it datasource} contains the name of the ODBC datasource. The parameters exclusive and readOnly are not used.\membersection{wxDatabase::OnSetOptions}\func{void}{OnSetOptions}{\param{wxRecordSet *}{recordSet}}Not implemented. \membersection{wxDatabase::OnWaitForDataSource}\func{void}{OnWaitForDataSource}{\param{bool}{ stillExecuting}}Not implemented.\membersection{wxDatabase::RollbackTrans}\func{bool}{RollbackTrans}{\void}Sends a rollback to the ODBC driver. Not implemented.\membersection{wxDatabase::SetDataSource}\func{void}{SetDataSource}{\param{const wxString\& }{s}}Sets the name of the data source. Not implemented.\membersection{wxDatabase::SetLoginTimeout}\func{void}{SetLoginTimeout}{\param{long}{ seconds}}Sets the time to wait for an user login. Not implemented.\membersection{wxDatabase::SetPassword}\func{void}{SetPassword}{\param{const wxString\& }{s}}Sets the password of the current user. Not implemented.\membersection{wxDatabase::SetSynchronousMode}\func{void}{SetSynchronousMode}{\param{bool }{synchronous}}Toggles between synchronous and asynchronous mode. Currently only synchronousmode is supported, so this function has no effect.\membersection{wxDatabase::SetQueryTimeout}\func{void}{SetQueryTimeout}{\param{long}{ seconds}}Sets the time to wait for a response to a query. Not implemented.\membersection{wxDatabase::SetUsername}\func{void}{SetUsername}{\param{const wxString\& }{s}}Sets the name of the current user. Not implemented.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -