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