]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/database.tex
renamed IsRefTo() to IsSameAs() (do complain if this is not more clear) and
[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 A much more robust and feature-rich set of ODBC classes is now
19 available and recommended for use in place of the wxDatabase class.
20
21 See details of these classes in:
22 \helpref{wxDb}{wxdb}, \helpref{wxDbTable}{wxdbtable}
23
24 \latexignore{\rtfignore{\wxheading{Members}}}
25
26 \membersection{wxDatabase::wxDatabase}
27
28 \func{}{wxDatabase}{\void}
29
30 Constructor. The constructor of the first wxDatabase instance of an
31 application initializes the ODBC manager.
32
33 \membersection{wxDatabase::\destruct{wxDatabase}}
34
35 \func{}{\destruct{wxDatabase}}{\void}
36
37 Destructor. Resets and destroys any associated wxRecordSet instances.
38
39 The destructor of the last wxDatabase instance will deinitialize
40 the ODBC manager.
41
42 \membersection{wxDatabase::BeginTrans}
43
44 \func{bool}{BeginTrans}{\void}
45
46 Not implemented.
47
48 \membersection{wxDatabase::Cancel}
49
50 \func{void}{Cancel}{\void}
51
52 Not implemented.
53
54 \membersection{wxDatabase::CanTransact}
55
56 \func{bool}{CanTransact}{\void}
57
58 Not implemented.
59
60
61 \membersection{wxDatabase::CanUpdate}
62
63 \func{bool}{CanUpdate}{\void}
64
65 Not implemented.
66
67 \membersection{wxDatabase::Close}
68
69 \func{bool}{Close}{\void}
70
71 Resets the statement handles of any associated wxRecordSet objects,
72 and disconnects from the current data source.
73
74 \membersection{wxDatabase::CommitTrans}
75
76 \func{bool}{CommitTrans}{\void}
77
78 Commits previous transactions. Not implemented.
79
80 \membersection{wxDatabase::GetDatabaseName}
81
82 \func{wxString}{GetDatabaseName}{\void}
83
84 Returns the name of the database associated with the current connection.
85
86 \membersection{wxDatabase::GetDataSource}
87
88 \func{wxString}{GetDataSource}{\void}
89
90 Returns the name of the connected data source.
91
92 \membersection{wxDatabase::GetErrorClass}
93
94 \func{wxString}{GetErrorClass}{\void}
95
96 Returns the error class of the last error. The error class consists of
97 five characters where the first two characters contain the class
98 and the other three characters contain the subclass of the ODBC error.
99 See ODBC documentation for further details.
100
101 \membersection{wxDatabase::GetErrorCode}
102
103 \func{wxRETCODE}{GetErrorCode}{\void}
104
105 Returns 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
114 obtained from the ODBC manager.}
115 \end{twocollist}
116
117 \membersection{wxDatabase::GetErrorMessage}
118
119 \func{wxString}{GetErrorMessage}{\void}
120
121 Returns the last error message returned by the ODBC manager.
122
123 \membersection{wxDatabase::GetErrorNumber}
124
125 \func{long}{GetErrorNumber}{\void}
126
127 Returns the last native error. A native error is an ODBC driver dependent
128 error number.
129
130 \membersection{wxDatabase::GetHDBC}
131
132 \func{HDBC}{GetHDBC}{\void}
133
134 Returns the current ODBC database handle.
135
136 \membersection{wxDatabase::GetHENV}
137
138 \func{HENV}{GetHENV}{\void}
139
140 Returns the ODBC environment handle.
141
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
148 Returns requested information. The return value is true if successful, false otherwise.
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
153 application, 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
156 should be computed by the GetInfo function.
157
158 \membersection{wxDatabase::GetPassword}
159
160 \func{wxString}{GetPassword}{\void}
161
162 Returns the password of the current user.
163
164 \membersection{wxDatabase::GetUsername}
165
166 \func{wxString}{GetUsername}{\void}
167
168 Returns the current username.
169
170 \membersection{wxDatabase::GetODBCVersionFloat}
171
172 \func{float}{GetODBCVersionFloat}{\param{bool}{ implementation=true}}
173
174 Returns the version of ODBC in floating point format, e.g. 2.50.
175
176 {\it implementation} should be true to get the DLL version, or false to get the
177 version defined in the {\tt sql.h} header file.
178
179 This function can return the value 0.0 if the header version number is not defined (for early
180 versions of ODBC).
181
182 \membersection{wxDatabase::GetODBCVersionString}
183
184 \func{wxString}{GetODBCVersionString}{\param{bool}{ implementation=true}}
185
186 Returns the version of ODBC in string format, e.g. ``02.50".
187
188 {\it implementation} should be true to get the DLL version, or false to get the
189 version defined in the {\tt sql.h} header file.
190
191 This function can return the value ``00.00" if the header version number is not defined (for early
192 versions of ODBC).
193
194 \membersection{wxDatabase::InWaitForDataSource}
195
196 \func{bool}{InWaitForDataSource}{\void}
197
198 Not implemented.
199
200 \membersection{wxDatabase::IsOpen}
201
202 \func{bool}{IsOpen}{\void}
203
204 Returns true if a connection is open.
205
206 \membersection{wxDatabase::Open}\label{wxdatabaseopen}
207
208 \func{bool}{Open}{\param{const wxString\& }{datasource}, \param{bool}{ exclusive = false}, \param{bool }{readOnly = true},
209 \param{const wxString\& }{username = ``ODBC"}, \param{const wxString\& }{password = ``"}}
210
211 Connect to a data source. {\it datasource} contains the name of the ODBC data
212 source. The parameters exclusive and readOnly are not used.
213
214 \membersection{wxDatabase::OnSetOptions}
215
216 \func{void}{OnSetOptions}{\param{wxRecordSet *}{recordSet}}
217
218 Not implemented.
219
220 \membersection{wxDatabase::OnWaitForDataSource}
221
222 \func{void}{OnWaitForDataSource}{\param{bool}{ stillExecuting}}
223
224 Not implemented.
225
226 \membersection{wxDatabase::RollbackTrans}
227
228 \func{bool}{RollbackTrans}{\void}
229
230 Sends a rollback to the ODBC driver. Not implemented.
231
232 \membersection{wxDatabase::SetDataSource}
233
234 \func{void}{SetDataSource}{\param{const wxString\& }{s}}
235
236 Sets the name of the data source. Not implemented.
237
238 \membersection{wxDatabase::SetLoginTimeout}
239
240 \func{void}{SetLoginTimeout}{\param{long}{ seconds}}
241
242 Sets the time to wait for an user login. Not implemented.
243
244 \membersection{wxDatabase::SetPassword}
245
246 \func{void}{SetPassword}{\param{const wxString\& }{s}}
247
248 Sets the password of the current user. Not implemented.
249
250 \membersection{wxDatabase::SetSynchronousMode}
251
252 \func{void}{SetSynchronousMode}{\param{bool }{synchronous}}
253
254 Toggles between synchronous and asynchronous mode. Currently only synchronous
255 mode is supported, so this function has no effect.
256
257 \membersection{wxDatabase::SetQueryTimeout}
258
259 \func{void}{SetQueryTimeout}{\param{long}{ seconds}}
260
261 Sets the time to wait for a response to a query. Not implemented.
262
263 \membersection{wxDatabase::SetUsername}
264
265 \func{void}{SetUsername}{\param{const wxString\& }{s}}
266
267 Sets the name of the current user. Not implemented.
268
269