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