]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxDatabase}}\label{wxdatabase} |
2 | ||
954b8ae6 JS |
3 | Every database object represents an ODBC connection. |
4 | The connection may be closed and reopened. | |
a660d684 | 5 | |
fa482912 JS |
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). | |
8 | ||
954b8ae6 | 9 | \wxheading{Derived from} |
a660d684 KB |
10 | |
11 | \helpref{wxObject}{wxobject} | |
12 | ||
954b8ae6 JS |
13 | \wxheading{Include files} |
14 | ||
15 | <wx/odbc.h> | |
16 | ||
a660d684 KB |
17 | \wxheading{See also} |
18 | ||
19 | \overview{wxDatabase overview}{wxdatabaseoverview}, \helpref{wxRecordSet}{wxrecordset} | |
20 | ||
f6bcfd97 BP |
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. | |
23 | ||
24 | See details of these classes in: | |
25 | \helpref{wxDB}{wxdb}, \helpref{wxTable}{wxtable} | |
26 | ||
a660d684 KB |
27 | \latexignore{\rtfignore{\wxheading{Members}}} |
28 | ||
29 | \membersection{wxDatabase::wxDatabase} | |
30 | ||
31 | \func{}{wxDatabase}{\void} | |
32 | ||
33 | Constructor. The constructor of the first wxDatabase instance of an | |
34 | application initializes the ODBC manager. | |
35 | ||
36 | \membersection{wxDatabase::\destruct{wxDatabase}} | |
37 | ||
38 | \func{}{\destruct{wxDatabase}}{\void} | |
39 | ||
40 | Destructor. Resets and destroys any associated wxRecordSet instances. | |
41 | ||
42 | The destructor of the last wxDatabase instance will deinitialize | |
43 | the ODBC manager. | |
44 | ||
45 | \membersection{wxDatabase::BeginTrans} | |
46 | ||
47 | \func{bool}{BeginTrans}{\void} | |
48 | ||
49 | Not implemented. | |
50 | ||
51 | \membersection{wxDatabase::Cancel} | |
52 | ||
53 | \func{void}{Cancel}{\void} | |
54 | ||
55 | Not implemented. | |
56 | ||
57 | \membersection{wxDatabase::CanTransact} | |
58 | ||
59 | \func{bool}{CanTransact}{\void} | |
60 | ||
61 | Not implemented. | |
62 | ||
63 | ||
64 | \membersection{wxDatabase::CanUpdate} | |
65 | ||
66 | \func{bool}{CanUpdate}{\void} | |
67 | ||
68 | Not implemented. | |
69 | ||
70 | \membersection{wxDatabase::Close} | |
71 | ||
72 | \func{bool}{Close}{\void} | |
73 | ||
74 | Resets the statement handles of any associated wxRecordSet objects, | |
75 | and disconnects from the current data source. | |
76 | ||
77 | \membersection{wxDatabase::CommitTrans} | |
78 | ||
79 | \func{bool}{CommitTrans}{\void} | |
80 | ||
81 | Commits previous transactions. Not implemented. | |
82 | ||
f6bcfd97 | 83 | \membersection{wxDatabase::ErrorOccurred} |
a660d684 | 84 | |
f6bcfd97 | 85 | \func{bool}{ErrorOccurred}{\void} |
a660d684 KB |
86 | |
87 | Returns TRUE if the last action caused an error. | |
88 | ||
89 | \membersection{wxDatabase::ErrorSnapshot} | |
90 | ||
91 | \func{void}{ErrorSnapshot}{\param{HSTMT}{ statement = SQL\_NULL\_HSTMT}} | |
92 | ||
f6bcfd97 | 93 | This function will be called whenever an ODBC error occurred. It stores the |
a660d684 KB |
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. | |
96 | ||
97 | \membersection{wxDatabase::GetDatabaseName} | |
98 | ||
99 | \func{wxString}{GetDatabaseName}{\void} | |
100 | ||
101 | Returns the name of the database associated with the current connection. | |
102 | ||
103 | \membersection{wxDatabase::GetDataSource} | |
104 | ||
105 | \func{wxString}{GetDataSource}{\void} | |
106 | ||
107 | Returns the name of the connected data source. | |
b8de493f | 108 | |
a660d684 KB |
109 | \membersection{wxDatabase::GetErrorClass} |
110 | ||
111 | \func{wxString}{GetErrorClass}{\void} | |
112 | ||
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. | |
117 | ||
118 | \membersection{wxDatabase::GetErrorCode} | |
119 | ||
120 | \func{wxRETCODE}{GetErrorCode}{\void} | |
121 | ||
122 | Returns the error code of the last ODBC function call. This will be one of: | |
123 | ||
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.} | |
132 | \end{twocollist} | |
133 | ||
134 | \membersection{wxDatabase::GetErrorMessage} | |
135 | ||
136 | \func{wxString}{GetErrorMessage}{\void} | |
137 | ||
138 | Returns the last error message returned by the ODBC manager. | |
139 | ||
140 | \membersection{wxDatabase::GetErrorNumber} | |
141 | ||
142 | \func{long}{GetErrorNumber}{\void} | |
143 | ||
144 | Returns the last native error. A native error is an ODBC driver dependent | |
145 | error number. | |
146 | ||
147 | \membersection{wxDatabase::GetHDBC} | |
148 | ||
149 | \func{HDBC}{GetHDBC}{\void} | |
150 | ||
151 | Returns the current ODBC database handle. | |
152 | ||
153 | \membersection{wxDatabase::GetHENV} | |
154 | ||
155 | \func{HENV}{GetHENV}{\void} | |
156 | ||
157 | Returns the ODBC environment handle. | |
b8de493f | 158 | |
a660d684 KB |
159 | \membersection{wxDatabase::GetInfo} |
160 | ||
161 | \func{bool}{GetInfo}{\param{long}{ infoType}, \param{long *}{buf}} | |
162 | ||
163 | \func{bool}{GetInfo}{\param{long}{ infoType}, \param{const wxString\& }{buf}, \param{int}{ bufSize=-1}} | |
164 | ||
165 | Returns requested information. The return value is TRUE if successful, FALSE otherwise. | |
166 | ||
167 | {\it infoType} is an ODBC identifier specifying the type of information to be returned. | |
168 | ||
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. | |
171 | ||
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. | |
174 | ||
175 | \membersection{wxDatabase::GetPassword} | |
176 | ||
177 | \func{wxString}{GetPassword}{\void} | |
178 | ||
179 | Returns the password of the current user. | |
180 | ||
181 | \membersection{wxDatabase::GetUsername} | |
182 | ||
183 | \func{wxString}{GetUsername}{\void} | |
184 | ||
185 | Returns the current username. | |
186 | ||
187 | \membersection{wxDatabase::GetODBCVersionFloat} | |
188 | ||
189 | \func{float}{GetODBCVersionFloat}{\param{bool}{ implementation=TRUE}} | |
190 | ||
191 | Returns the version of ODBC in floating point format, e.g. 2.50. | |
192 | ||
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. | |
195 | ||
196 | This function can return the value 0.0 if the header version number is not defined (for early | |
197 | versions of ODBC). | |
198 | ||
199 | \membersection{wxDatabase::GetODBCVersionString} | |
200 | ||
201 | \func{wxString}{GetODBCVersionString}{\param{bool}{ implementation=TRUE}} | |
202 | ||
203 | Returns the version of ODBC in string format, e.g. ``02.50". | |
204 | ||
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. | |
207 | ||
208 | This function can return the value ``00.00" if the header version number is not defined (for early | |
209 | versions of ODBC). | |
210 | ||
211 | \membersection{wxDatabase::InWaitForDataSource} | |
212 | ||
213 | \func{bool}{InWaitForDataSource}{\void} | |
214 | ||
215 | Not implemented. | |
216 | ||
217 | \membersection{wxDatabase::IsOpen} | |
218 | ||
219 | \func{bool}{IsOpen}{\void} | |
220 | ||
221 | Returns TRUE if a connection is open. | |
222 | ||
223 | \membersection{wxDatabase::Open}\label{wxdatabaseopen} | |
224 | ||
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 = ``"}} | |
227 | ||
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. | |
230 | ||
231 | \membersection{wxDatabase::OnSetOptions} | |
232 | ||
233 | \func{void}{OnSetOptions}{\param{wxRecordSet *}{recordSet}} | |
234 | ||
235 | Not implemented. | |
b8de493f | 236 | |
a660d684 KB |
237 | \membersection{wxDatabase::OnWaitForDataSource} |
238 | ||
239 | \func{void}{OnWaitForDataSource}{\param{bool}{ stillExecuting}} | |
240 | ||
241 | Not implemented. | |
242 | ||
243 | \membersection{wxDatabase::RollbackTrans} | |
244 | ||
245 | \func{bool}{RollbackTrans}{\void} | |
246 | ||
247 | Sends a rollback to the ODBC driver. Not implemented. | |
248 | ||
249 | \membersection{wxDatabase::SetDataSource} | |
250 | ||
251 | \func{void}{SetDataSource}{\param{const wxString\& }{s}} | |
252 | ||
253 | Sets the name of the data source. Not implemented. | |
b8de493f | 254 | |
a660d684 KB |
255 | \membersection{wxDatabase::SetLoginTimeout} |
256 | ||
257 | \func{void}{SetLoginTimeout}{\param{long}{ seconds}} | |
258 | ||
259 | Sets the time to wait for an user login. Not implemented. | |
b8de493f | 260 | |
a660d684 KB |
261 | \membersection{wxDatabase::SetPassword} |
262 | ||
263 | \func{void}{SetPassword}{\param{const wxString\& }{s}} | |
264 | ||
265 | Sets the password of the current user. Not implemented. | |
266 | ||
267 | \membersection{wxDatabase::SetSynchronousMode} | |
268 | ||
269 | \func{void}{SetSynchronousMode}{\param{bool }{synchronous}} | |
270 | ||
271 | Toggles between synchronous and asynchronous mode. Currently only synchronous | |
272 | mode is supported, so this function has no effect. | |
273 | ||
274 | \membersection{wxDatabase::SetQueryTimeout} | |
275 | ||
276 | \func{void}{SetQueryTimeout}{\param{long}{ seconds}} | |
277 | ||
278 | Sets the time to wait for a response to a query. Not implemented. | |
b8de493f | 279 | |
a660d684 KB |
280 | \membersection{wxDatabase::SetUsername} |
281 | ||
282 | \func{void}{SetUsername}{\param{const wxString\& }{s}} | |
283 | ||
284 | Sets the name of the current user. Not implemented. | |
285 | ||
286 |