]>
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 | ||
21 | \latexignore{\rtfignore{\wxheading{Members}}} | |
22 | ||
23 | \membersection{wxDatabase::wxDatabase} | |
24 | ||
25 | \func{}{wxDatabase}{\void} | |
26 | ||
27 | Constructor. The constructor of the first wxDatabase instance of an | |
28 | application initializes the ODBC manager. | |
29 | ||
30 | \membersection{wxDatabase::\destruct{wxDatabase}} | |
31 | ||
32 | \func{}{\destruct{wxDatabase}}{\void} | |
33 | ||
34 | Destructor. Resets and destroys any associated wxRecordSet instances. | |
35 | ||
36 | The destructor of the last wxDatabase instance will deinitialize | |
37 | the ODBC manager. | |
38 | ||
39 | \membersection{wxDatabase::BeginTrans} | |
40 | ||
41 | \func{bool}{BeginTrans}{\void} | |
42 | ||
43 | Not implemented. | |
44 | ||
45 | \membersection{wxDatabase::Cancel} | |
46 | ||
47 | \func{void}{Cancel}{\void} | |
48 | ||
49 | Not implemented. | |
50 | ||
51 | \membersection{wxDatabase::CanTransact} | |
52 | ||
53 | \func{bool}{CanTransact}{\void} | |
54 | ||
55 | Not implemented. | |
56 | ||
57 | ||
58 | \membersection{wxDatabase::CanUpdate} | |
59 | ||
60 | \func{bool}{CanUpdate}{\void} | |
61 | ||
62 | Not implemented. | |
63 | ||
64 | \membersection{wxDatabase::Close} | |
65 | ||
66 | \func{bool}{Close}{\void} | |
67 | ||
68 | Resets the statement handles of any associated wxRecordSet objects, | |
69 | and disconnects from the current data source. | |
70 | ||
71 | \membersection{wxDatabase::CommitTrans} | |
72 | ||
73 | \func{bool}{CommitTrans}{\void} | |
74 | ||
75 | Commits previous transactions. Not implemented. | |
76 | ||
77 | \membersection{wxDatabase::ErrorOccured} | |
78 | ||
79 | \func{bool}{ErrorOccured}{\void} | |
80 | ||
81 | Returns TRUE if the last action caused an error. | |
82 | ||
83 | \membersection{wxDatabase::ErrorSnapshot} | |
84 | ||
85 | \func{void}{ErrorSnapshot}{\param{HSTMT}{ statement = SQL\_NULL\_HSTMT}} | |
86 | ||
87 | This function will be called whenever an ODBC error occured. It stores the | |
88 | error related information returned by ODBC. If a statement handle of the | |
89 | concerning ODBC action is available it should be passed to the function. | |
90 | ||
91 | \membersection{wxDatabase::GetDatabaseName} | |
92 | ||
93 | \func{wxString}{GetDatabaseName}{\void} | |
94 | ||
95 | Returns the name of the database associated with the current connection. | |
96 | ||
97 | \membersection{wxDatabase::GetDataSource} | |
98 | ||
99 | \func{wxString}{GetDataSource}{\void} | |
100 | ||
101 | Returns the name of the connected data source. | |
b8de493f | 102 | |
a660d684 KB |
103 | \membersection{wxDatabase::GetErrorClass} |
104 | ||
105 | \func{wxString}{GetErrorClass}{\void} | |
106 | ||
107 | Returns the error class of the last error. The error class consists of | |
108 | five characters where the first two characters contain the class | |
109 | and the other three characters contain the subclass of the ODBC error. | |
110 | See ODBC documentation for further details. | |
111 | ||
112 | \membersection{wxDatabase::GetErrorCode} | |
113 | ||
114 | \func{wxRETCODE}{GetErrorCode}{\void} | |
115 | ||
116 | Returns the error code of the last ODBC function call. This will be one of: | |
117 | ||
118 | \begin{twocollist}\itemsep=0pt | |
119 | \twocolitem{SQL\_ERROR}{General error.} | |
120 | \twocolitem{SQL\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.} | |
121 | \twocolitem{SQL\_NEED\_DATA}{ODBC expected some data.} | |
122 | \twocolitem{SQL\_NO\_DATA\_FOUND}{No data was found by this ODBC call.} | |
123 | \twocolitem{SQL\_SUCCESS}{The call was successful.} | |
124 | \twocolitem{SQL\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can be | |
125 | obtained from the ODBC manager.} | |
126 | \end{twocollist} | |
127 | ||
128 | \membersection{wxDatabase::GetErrorMessage} | |
129 | ||
130 | \func{wxString}{GetErrorMessage}{\void} | |
131 | ||
132 | Returns the last error message returned by the ODBC manager. | |
133 | ||
134 | \membersection{wxDatabase::GetErrorNumber} | |
135 | ||
136 | \func{long}{GetErrorNumber}{\void} | |
137 | ||
138 | Returns the last native error. A native error is an ODBC driver dependent | |
139 | error number. | |
140 | ||
141 | \membersection{wxDatabase::GetHDBC} | |
142 | ||
143 | \func{HDBC}{GetHDBC}{\void} | |
144 | ||
145 | Returns the current ODBC database handle. | |
146 | ||
147 | \membersection{wxDatabase::GetHENV} | |
148 | ||
149 | \func{HENV}{GetHENV}{\void} | |
150 | ||
151 | Returns the ODBC environment handle. | |
b8de493f | 152 | |
a660d684 KB |
153 | \membersection{wxDatabase::GetInfo} |
154 | ||
155 | \func{bool}{GetInfo}{\param{long}{ infoType}, \param{long *}{buf}} | |
156 | ||
157 | \func{bool}{GetInfo}{\param{long}{ infoType}, \param{const wxString\& }{buf}, \param{int}{ bufSize=-1}} | |
158 | ||
159 | Returns requested information. The return value is TRUE if successful, FALSE otherwise. | |
160 | ||
161 | {\it infoType} is an ODBC identifier specifying the type of information to be returned. | |
162 | ||
163 | {\it buf} is a character or long integer pointer to storage which must be allocated by the | |
164 | application, and which will contain the information if the function is successful. | |
165 | ||
166 | {\it bufSize} is the size of the character buffer. A value of -1 indicates that the size | |
167 | should be computed by the GetInfo function. | |
168 | ||
169 | \membersection{wxDatabase::GetPassword} | |
170 | ||
171 | \func{wxString}{GetPassword}{\void} | |
172 | ||
173 | Returns the password of the current user. | |
174 | ||
175 | \membersection{wxDatabase::GetUsername} | |
176 | ||
177 | \func{wxString}{GetUsername}{\void} | |
178 | ||
179 | Returns the current username. | |
180 | ||
181 | \membersection{wxDatabase::GetODBCVersionFloat} | |
182 | ||
183 | \func{float}{GetODBCVersionFloat}{\param{bool}{ implementation=TRUE}} | |
184 | ||
185 | Returns the version of ODBC in floating point format, e.g. 2.50. | |
186 | ||
187 | {\it implementation} should be TRUE to get the DLL version, or FALSE to get the | |
188 | version defined in the {\tt sql.h} header file. | |
189 | ||
190 | This function can return the value 0.0 if the header version number is not defined (for early | |
191 | versions of ODBC). | |
192 | ||
193 | \membersection{wxDatabase::GetODBCVersionString} | |
194 | ||
195 | \func{wxString}{GetODBCVersionString}{\param{bool}{ implementation=TRUE}} | |
196 | ||
197 | Returns the version of ODBC in string format, e.g. ``02.50". | |
198 | ||
199 | {\it implementation} should be TRUE to get the DLL version, or FALSE to get the | |
200 | version defined in the {\tt sql.h} header file. | |
201 | ||
202 | This function can return the value ``00.00" if the header version number is not defined (for early | |
203 | versions of ODBC). | |
204 | ||
205 | \membersection{wxDatabase::InWaitForDataSource} | |
206 | ||
207 | \func{bool}{InWaitForDataSource}{\void} | |
208 | ||
209 | Not implemented. | |
210 | ||
211 | \membersection{wxDatabase::IsOpen} | |
212 | ||
213 | \func{bool}{IsOpen}{\void} | |
214 | ||
215 | Returns TRUE if a connection is open. | |
216 | ||
217 | \membersection{wxDatabase::Open}\label{wxdatabaseopen} | |
218 | ||
219 | \func{bool}{Open}{\param{const wxString\& }{datasource}, \param{bool}{ exclusive = FALSE}, \param{bool }{readOnly = TRUE}, | |
220 | \param{const wxString\& }{username = ``ODBC"}, \param{const wxString\& }{password = ``"}} | |
221 | ||
222 | Connect to a data source. {\it datasource} contains the name of the ODBC data | |
223 | source. The parameters exclusive and readOnly are not used. | |
224 | ||
225 | \membersection{wxDatabase::OnSetOptions} | |
226 | ||
227 | \func{void}{OnSetOptions}{\param{wxRecordSet *}{recordSet}} | |
228 | ||
229 | Not implemented. | |
b8de493f | 230 | |
a660d684 KB |
231 | \membersection{wxDatabase::OnWaitForDataSource} |
232 | ||
233 | \func{void}{OnWaitForDataSource}{\param{bool}{ stillExecuting}} | |
234 | ||
235 | Not implemented. | |
236 | ||
237 | \membersection{wxDatabase::RollbackTrans} | |
238 | ||
239 | \func{bool}{RollbackTrans}{\void} | |
240 | ||
241 | Sends a rollback to the ODBC driver. Not implemented. | |
242 | ||
243 | \membersection{wxDatabase::SetDataSource} | |
244 | ||
245 | \func{void}{SetDataSource}{\param{const wxString\& }{s}} | |
246 | ||
247 | Sets the name of the data source. Not implemented. | |
b8de493f | 248 | |
a660d684 KB |
249 | \membersection{wxDatabase::SetLoginTimeout} |
250 | ||
251 | \func{void}{SetLoginTimeout}{\param{long}{ seconds}} | |
252 | ||
253 | Sets the time to wait for an user login. Not implemented. | |
b8de493f | 254 | |
a660d684 KB |
255 | \membersection{wxDatabase::SetPassword} |
256 | ||
257 | \func{void}{SetPassword}{\param{const wxString\& }{s}} | |
258 | ||
259 | Sets the password of the current user. Not implemented. | |
260 | ||
261 | \membersection{wxDatabase::SetSynchronousMode} | |
262 | ||
263 | \func{void}{SetSynchronousMode}{\param{bool }{synchronous}} | |
264 | ||
265 | Toggles between synchronous and asynchronous mode. Currently only synchronous | |
266 | mode is supported, so this function has no effect. | |
267 | ||
268 | \membersection{wxDatabase::SetQueryTimeout} | |
269 | ||
270 | \func{void}{SetQueryTimeout}{\param{long}{ seconds}} | |
271 | ||
272 | Sets the time to wait for a response to a query. Not implemented. | |
b8de493f | 273 | |
a660d684 KB |
274 | \membersection{wxDatabase::SetUsername} |
275 | ||
276 | \func{void}{SetUsername}{\param{const wxString\& }{s}} | |
277 | ||
278 | Sets the name of the current user. Not implemented. | |
279 | ||
280 |