1 \section{\class{wxDatabase
}}\label{wxdatabase
}
3 Every database object represents an ODBC connection.
4 The connection may be closed and reopened.
6 Note: this class is considered obsolete, replaced by the Remstar wxDB/wxTable classes
7 (documented separately in Word and PDF format, as odbc.doc and odbc.pdf).
9 \wxheading{Derived from
}
11 \helpref{wxObject
}{wxobject
}
13 \wxheading{Include files
}
19 \overview{wxDatabase overview
}{wxdatabaseoverview
},
\helpref{wxRecordSet
}{wxrecordset
}
21 A much more robust and feature-rich set of ODBC classes is now
22 available and recommended for use in place of the wxDatabase class.
24 See details of these classes in:
25 \helpref{wxDB
}{wxdb
},
\helpref{wxTable
}{wxtable
}
27 \latexignore{\rtfignore{\wxheading{Members
}}}
29 \membersection{wxDatabase::wxDatabase
}
31 \func{}{wxDatabase
}{\void}
33 Constructor. The constructor of the first wxDatabase instance of an
34 application initializes the ODBC manager.
36 \membersection{wxDatabase::
\destruct{wxDatabase
}}
38 \func{}{\destruct{wxDatabase
}}{\void}
40 Destructor. Resets and destroys any associated wxRecordSet instances.
42 The destructor of the last wxDatabase instance will deinitialize
45 \membersection{wxDatabase::BeginTrans
}
47 \func{bool
}{BeginTrans
}{\void}
51 \membersection{wxDatabase::Cancel
}
53 \func{void
}{Cancel
}{\void}
57 \membersection{wxDatabase::CanTransact
}
59 \func{bool
}{CanTransact
}{\void}
64 \membersection{wxDatabase::CanUpdate
}
66 \func{bool
}{CanUpdate
}{\void}
70 \membersection{wxDatabase::Close
}
72 \func{bool
}{Close
}{\void}
74 Resets the statement handles of any associated wxRecordSet objects,
75 and disconnects from the current data source.
77 \membersection{wxDatabase::CommitTrans
}
79 \func{bool
}{CommitTrans
}{\void}
81 Commits previous transactions. Not implemented.
83 \membersection{wxDatabase::ErrorOccurred
}
85 \func{bool
}{ErrorOccurred
}{\void}
87 Returns TRUE if the last action caused an error.
89 \membersection{wxDatabase::ErrorSnapshot
}
91 \func{void
}{ErrorSnapshot
}{\param{HSTMT
}{ statement = SQL
\_NULL\_HSTMT}}
93 This function will be called whenever an ODBC error occurred. It stores the
94 error related information returned by ODBC. If a statement handle of the
95 concerning ODBC action is available it should be passed to the function.
97 \membersection{wxDatabase::GetDatabaseName
}
99 \func{wxString
}{GetDatabaseName
}{\void}
101 Returns the name of the database associated with the current connection.
103 \membersection{wxDatabase::GetDataSource
}
105 \func{wxString
}{GetDataSource
}{\void}
107 Returns the name of the connected data source.
109 \membersection{wxDatabase::GetErrorClass
}
111 \func{wxString
}{GetErrorClass
}{\void}
113 Returns the error class of the last error. The error class consists of
114 five characters where the first two characters contain the class
115 and the other three characters contain the subclass of the ODBC error.
116 See ODBC documentation for further details.
118 \membersection{wxDatabase::GetErrorCode
}
120 \func{wxRETCODE
}{GetErrorCode
}{\void}
122 Returns the error code of the last ODBC function call. This will be one of:
124 \begin{twocollist
}\itemsep=
0pt
125 \twocolitem{SQL
\_ERROR}{General error.
}
126 \twocolitem{SQL
\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.
}
127 \twocolitem{SQL
\_NEED\_DATA}{ODBC expected some data.
}
128 \twocolitem{SQL
\_NO\_DATA\_FOUND}{No data was found by this ODBC call.
}
129 \twocolitem{SQL
\_SUCCESS}{The call was successful.
}
130 \twocolitem{SQL
\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can be
131 obtained from the ODBC manager.
}
134 \membersection{wxDatabase::GetErrorMessage
}
136 \func{wxString
}{GetErrorMessage
}{\void}
138 Returns the last error message returned by the ODBC manager.
140 \membersection{wxDatabase::GetErrorNumber
}
142 \func{long
}{GetErrorNumber
}{\void}
144 Returns the last native error. A native error is an ODBC driver dependent
147 \membersection{wxDatabase::GetHDBC
}
149 \func{HDBC
}{GetHDBC
}{\void}
151 Returns the current ODBC database handle.
153 \membersection{wxDatabase::GetHENV
}
155 \func{HENV
}{GetHENV
}{\void}
157 Returns the ODBC environment handle.
159 \membersection{wxDatabase::GetInfo
}
161 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{long *
}{buf
}}
163 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{const wxString\&
}{buf
},
\param{int
}{ bufSize=-
1}}
165 Returns requested information. The return value is TRUE if successful, FALSE otherwise.
167 {\it infoType
} is an ODBC identifier specifying the type of information to be returned.
169 {\it buf
} is a character or long integer pointer to storage which must be allocated by the
170 application, and which will contain the information if the function is successful.
172 {\it bufSize
} is the size of the character buffer. A value of -
1 indicates that the size
173 should be computed by the GetInfo function.
175 \membersection{wxDatabase::GetPassword
}
177 \func{wxString
}{GetPassword
}{\void}
179 Returns the password of the current user.
181 \membersection{wxDatabase::GetUsername
}
183 \func{wxString
}{GetUsername
}{\void}
185 Returns the current username.
187 \membersection{wxDatabase::GetODBCVersionFloat
}
189 \func{float
}{GetODBCVersionFloat
}{\param{bool
}{ implementation=TRUE
}}
191 Returns the version of ODBC in floating point format, e.g.
2.50.
193 {\it implementation
} should be TRUE to get the DLL version, or FALSE to get the
194 version defined in the
{\tt sql.h
} header file.
196 This function can return the value
0.0 if the header version number is not defined (for early
199 \membersection{wxDatabase::GetODBCVersionString
}
201 \func{wxString
}{GetODBCVersionString
}{\param{bool
}{ implementation=TRUE
}}
203 Returns the version of ODBC in string format, e.g. ``
02.50".
205 {\it implementation
} should be TRUE to get the DLL version, or FALSE to get the
206 version defined in the
{\tt sql.h
} header file.
208 This function can return the value ``
00.00" if the header version number is not defined (for early
211 \membersection{wxDatabase::InWaitForDataSource
}
213 \func{bool
}{InWaitForDataSource
}{\void}
217 \membersection{wxDatabase::IsOpen
}
219 \func{bool
}{IsOpen
}{\void}
221 Returns TRUE if a connection is open.
223 \membersection{wxDatabase::Open
}\label{wxdatabaseopen
}
225 \func{bool
}{Open
}{\param{const wxString\&
}{datasource
},
\param{bool
}{ exclusive = FALSE
},
\param{bool
}{readOnly = TRUE
},
226 \param{const wxString\&
}{username = ``ODBC"
},
\param{const wxString\&
}{password = ``"
}}
228 Connect to a data source.
{\it datasource
} contains the name of the ODBC data
229 source. The parameters exclusive and readOnly are not used.
231 \membersection{wxDatabase::OnSetOptions
}
233 \func{void
}{OnSetOptions
}{\param{wxRecordSet *
}{recordSet
}}
237 \membersection{wxDatabase::OnWaitForDataSource
}
239 \func{void
}{OnWaitForDataSource
}{\param{bool
}{ stillExecuting
}}
243 \membersection{wxDatabase::RollbackTrans
}
245 \func{bool
}{RollbackTrans
}{\void}
247 Sends a rollback to the ODBC driver. Not implemented.
249 \membersection{wxDatabase::SetDataSource
}
251 \func{void
}{SetDataSource
}{\param{const wxString\&
}{s
}}
253 Sets the name of the data source. Not implemented.
255 \membersection{wxDatabase::SetLoginTimeout
}
257 \func{void
}{SetLoginTimeout
}{\param{long
}{ seconds
}}
259 Sets the time to wait for an user login. Not implemented.
261 \membersection{wxDatabase::SetPassword
}
263 \func{void
}{SetPassword
}{\param{const wxString\&
}{s
}}
265 Sets the password of the current user. Not implemented.
267 \membersection{wxDatabase::SetSynchronousMode
}
269 \func{void
}{SetSynchronousMode
}{\param{bool
}{synchronous
}}
271 Toggles between synchronous and asynchronous mode. Currently only synchronous
272 mode is supported, so this function has no effect.
274 \membersection{wxDatabase::SetQueryTimeout
}
276 \func{void
}{SetQueryTimeout
}{\param{long
}{ seconds
}}
278 Sets the time to wait for a response to a query. Not implemented.
280 \membersection{wxDatabase::SetUsername
}
282 \func{void
}{SetUsername
}{\param{const wxString\&
}{s
}}
284 Sets the name of the current user. Not implemented.