]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/database.tex
Ref counting overview.
[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
a660d684
KB
80\membersection{wxDatabase::GetDatabaseName}
81
82\func{wxString}{GetDatabaseName}{\void}
83
84Returns the name of the database associated with the current connection.
85
86\membersection{wxDatabase::GetDataSource}
87
88\func{wxString}{GetDataSource}{\void}
89
90Returns the name of the connected data source.
b8de493f 91
a660d684
KB
92\membersection{wxDatabase::GetErrorClass}
93
94\func{wxString}{GetErrorClass}{\void}
95
96Returns the error class of the last error. The error class consists of
97five characters where the first two characters contain the class
98and the other three characters contain the subclass of the ODBC error.
99See ODBC documentation for further details.
100
101\membersection{wxDatabase::GetErrorCode}
102
103\func{wxRETCODE}{GetErrorCode}{\void}
104
105Returns the error code of the last ODBC function call. This will be one of:
106
107\begin{twocollist}\itemsep=0pt
108\twocolitem{SQL\_ERROR}{General error.}
109\twocolitem{SQL\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.}
110\twocolitem{SQL\_NEED\_DATA}{ODBC expected some data.}
111\twocolitem{SQL\_NO\_DATA\_FOUND}{No data was found by this ODBC call.}
112\twocolitem{SQL\_SUCCESS}{The call was successful.}
113\twocolitem{SQL\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can be
114obtained from the ODBC manager.}
115\end{twocollist}
116
117\membersection{wxDatabase::GetErrorMessage}
118
119\func{wxString}{GetErrorMessage}{\void}
120
121Returns the last error message returned by the ODBC manager.
122
123\membersection{wxDatabase::GetErrorNumber}
124
125\func{long}{GetErrorNumber}{\void}
126
127Returns the last native error. A native error is an ODBC driver dependent
128error number.
129
130\membersection{wxDatabase::GetHDBC}
131
132\func{HDBC}{GetHDBC}{\void}
133
134Returns the current ODBC database handle.
135
136\membersection{wxDatabase::GetHENV}
137
138\func{HENV}{GetHENV}{\void}
139
140Returns the ODBC environment handle.
b8de493f 141
a660d684
KB
142\membersection{wxDatabase::GetInfo}
143
144\func{bool}{GetInfo}{\param{long}{ infoType}, \param{long *}{buf}}
145
146\func{bool}{GetInfo}{\param{long}{ infoType}, \param{const wxString\& }{buf}, \param{int}{ bufSize=-1}}
147
cc81d32f 148Returns requested information. The return value is true if successful, false otherwise.
a660d684
KB
149
150{\it infoType} is an ODBC identifier specifying the type of information to be returned.
151
152{\it buf} is a character or long integer pointer to storage which must be allocated by the
153application, and which will contain the information if the function is successful.
154
155{\it bufSize} is the size of the character buffer. A value of -1 indicates that the size
156should be computed by the GetInfo function.
157
158\membersection{wxDatabase::GetPassword}
159
160\func{wxString}{GetPassword}{\void}
161
162Returns the password of the current user.
163
164\membersection{wxDatabase::GetUsername}
165
166\func{wxString}{GetUsername}{\void}
167
168Returns the current username.
169
170\membersection{wxDatabase::GetODBCVersionFloat}
171
cc81d32f 172\func{float}{GetODBCVersionFloat}{\param{bool}{ implementation=true}}
a660d684
KB
173
174Returns the version of ODBC in floating point format, e.g. 2.50.
175
cc81d32f 176{\it implementation} should be true to get the DLL version, or false to get the
a660d684
KB
177version defined in the {\tt sql.h} header file.
178
179This function can return the value 0.0 if the header version number is not defined (for early
180versions of ODBC).
181
182\membersection{wxDatabase::GetODBCVersionString}
183
cc81d32f 184\func{wxString}{GetODBCVersionString}{\param{bool}{ implementation=true}}
a660d684
KB
185
186Returns the version of ODBC in string format, e.g. ``02.50".
187
cc81d32f 188{\it implementation} should be true to get the DLL version, or false to get the
a660d684
KB
189version defined in the {\tt sql.h} header file.
190
191This function can return the value ``00.00" if the header version number is not defined (for early
192versions of ODBC).
193
194\membersection{wxDatabase::InWaitForDataSource}
195
196\func{bool}{InWaitForDataSource}{\void}
197
198Not implemented.
199
200\membersection{wxDatabase::IsOpen}
201
202\func{bool}{IsOpen}{\void}
203
cc81d32f 204Returns true if a connection is open.
a660d684
KB
205
206\membersection{wxDatabase::Open}\label{wxdatabaseopen}
207
cc81d32f 208\func{bool}{Open}{\param{const wxString\& }{datasource}, \param{bool}{ exclusive = false}, \param{bool }{readOnly = true},
a660d684
KB
209 \param{const wxString\& }{username = ``ODBC"}, \param{const wxString\& }{password = ``"}}
210
211Connect to a data source. {\it datasource} contains the name of the ODBC data
212source. The parameters exclusive and readOnly are not used.
213
214\membersection{wxDatabase::OnSetOptions}
215
216\func{void}{OnSetOptions}{\param{wxRecordSet *}{recordSet}}
217
218Not implemented.
b8de493f 219
a660d684
KB
220\membersection{wxDatabase::OnWaitForDataSource}
221
222\func{void}{OnWaitForDataSource}{\param{bool}{ stillExecuting}}
223
224Not implemented.
225
226\membersection{wxDatabase::RollbackTrans}
227
228\func{bool}{RollbackTrans}{\void}
229
230Sends a rollback to the ODBC driver. Not implemented.
231
232\membersection{wxDatabase::SetDataSource}
233
234\func{void}{SetDataSource}{\param{const wxString\& }{s}}
235
236Sets the name of the data source. Not implemented.
b8de493f 237
a660d684
KB
238\membersection{wxDatabase::SetLoginTimeout}
239
240\func{void}{SetLoginTimeout}{\param{long}{ seconds}}
241
242Sets the time to wait for an user login. Not implemented.
b8de493f 243
a660d684
KB
244\membersection{wxDatabase::SetPassword}
245
246\func{void}{SetPassword}{\param{const wxString\& }{s}}
247
248Sets the password of the current user. Not implemented.
249
250\membersection{wxDatabase::SetSynchronousMode}
251
252\func{void}{SetSynchronousMode}{\param{bool }{synchronous}}
253
254Toggles between synchronous and asynchronous mode. Currently only synchronous
255mode is supported, so this function has no effect.
256
257\membersection{wxDatabase::SetQueryTimeout}
258
259\func{void}{SetQueryTimeout}{\param{long}{ seconds}}
260
261Sets the time to wait for a response to a query. Not implemented.
b8de493f 262
a660d684
KB
263\membersection{wxDatabase::SetUsername}
264
265\func{void}{SetUsername}{\param{const wxString\& }{s}}
266
267Sets the name of the current user. Not implemented.
268
269