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