1998-05-20 14:25:30 +00:00
|
|
|
\section{\class{wxDatabase}}\label{wxdatabase}
|
|
|
|
|
1999-02-15 20:41:29 +00:00
|
|
|
Every database object represents an ODBC connection.
|
|
|
|
The connection may be closed and reopened.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-02-15 20:41:29 +00:00
|
|
|
\wxheading{Derived from}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 20:41:29 +00:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/odbc.h>
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\overview{wxDatabase overview}{wxdatabaseoverview}, \helpref{wxRecordSet}{wxrecordset}
|
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
A much more robust and feature-rich set of ODBC classes is now
|
|
|
|
available and recommended for use in place of the wxDatabase class.
|
|
|
|
|
|
|
|
See details of these classes in:
|
2001-02-05 13:33:43 +00:00
|
|
|
\helpref{wxDb}{wxdb}, \helpref{wxDbTable}{wxdbtable}
|
2000-07-15 19:51:35 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxDatabase::wxDatabase}
|
|
|
|
|
|
|
|
\func{}{wxDatabase}{\void}
|
|
|
|
|
|
|
|
Constructor. The constructor of the first wxDatabase instance of an
|
|
|
|
application 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 deinitialize
|
|
|
|
the 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.
|
|
|
|
|
2000-08-08 06:11:51 +00:00
|
|
|
\membersection{wxDatabase::ErrorOccured}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
2000-08-08 06:11:51 +00:00
|
|
|
\func{bool}{ErrorOccured}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Returns TRUE if the last action caused an error.
|
|
|
|
|
|
|
|
\membersection{wxDatabase::ErrorSnapshot}
|
|
|
|
|
|
|
|
\func{void}{ErrorSnapshot}{\param{HSTMT}{ statement = SQL\_NULL\_HSTMT}}
|
|
|
|
|
2000-08-08 06:11:51 +00:00
|
|
|
This function will be called whenever an ODBC error occured. It stores the
|
1998-05-20 14:25:30 +00:00
|
|
|
error related information returned by ODBC. If a statement handle of the
|
|
|
|
concerning ODBC action is available it should be passed to the function.
|
|
|
|
|
|
|
|
\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.
|
1998-08-18 14:54:21 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\membersection{wxDatabase::GetErrorClass}
|
|
|
|
|
|
|
|
\func{wxString}{GetErrorClass}{\void}
|
|
|
|
|
|
|
|
Returns the error class of the last error. The error class consists of
|
|
|
|
five characters where the first two characters contain the class
|
|
|
|
and 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 be
|
|
|
|
obtained 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 dependent
|
|
|
|
error 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.
|
1998-08-18 14:54:21 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\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 the
|
|
|
|
application, 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 size
|
|
|
|
should 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 the
|
|
|
|
version 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 early
|
|
|
|
versions 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 the
|
|
|
|
version 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 early
|
|
|
|
versions 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 data
|
|
|
|
source. The parameters exclusive and readOnly are not used.
|
|
|
|
|
|
|
|
\membersection{wxDatabase::OnSetOptions}
|
|
|
|
|
|
|
|
\func{void}{OnSetOptions}{\param{wxRecordSet *}{recordSet}}
|
|
|
|
|
|
|
|
Not implemented.
|
1998-08-18 14:54:21 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\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.
|
1998-08-18 14:54:21 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\membersection{wxDatabase::SetLoginTimeout}
|
|
|
|
|
|
|
|
\func{void}{SetLoginTimeout}{\param{long}{ seconds}}
|
|
|
|
|
|
|
|
Sets the time to wait for an user login. Not implemented.
|
1998-08-18 14:54:21 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\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 synchronous
|
|
|
|
mode 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.
|
1998-08-18 14:54:21 +00:00
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\membersection{wxDatabase::SetUsername}
|
|
|
|
|
|
|
|
\func{void}{SetUsername}{\param{const wxString\& }{s}}
|
|
|
|
|
|
|
|
Sets the name of the current user. Not implemented.
|
|
|
|
|
|
|
|
|