1 \section{\class{wxDatabase
}}\label{wxdatabase
}
3 Every database object represents an ODBC connection. The connection may be closed and reopened.
7 \helpref{wxObject
}{wxobject
}
11 \overview{wxDatabase overview
}{wxdatabaseoverview
},
\helpref{wxRecordSet
}{wxrecordset
}
13 \latexignore{\rtfignore{\wxheading{Members
}}}
15 \membersection{wxDatabase::wxDatabase
}
17 \func{}{wxDatabase
}{\void}
19 Constructor. The constructor of the first wxDatabase instance of an
20 application initializes the ODBC manager.
22 \membersection{wxDatabase::
\destruct{wxDatabase
}}
24 \func{}{\destruct{wxDatabase
}}{\void}
26 Destructor. Resets and destroys any associated wxRecordSet instances.
28 The destructor of the last wxDatabase instance will deinitialize
31 \membersection{wxDatabase::BeginTrans
}
33 \func{bool
}{BeginTrans
}{\void}
37 \membersection{wxDatabase::Cancel
}
39 \func{void
}{Cancel
}{\void}
43 \membersection{wxDatabase::CanTransact
}
45 \func{bool
}{CanTransact
}{\void}
50 \membersection{wxDatabase::CanUpdate
}
52 \func{bool
}{CanUpdate
}{\void}
56 \membersection{wxDatabase::Close
}
58 \func{bool
}{Close
}{\void}
60 Resets the statement handles of any associated wxRecordSet objects,
61 and disconnects from the current data source.
63 \membersection{wxDatabase::CommitTrans
}
65 \func{bool
}{CommitTrans
}{\void}
67 Commits previous transactions. Not implemented.
69 \membersection{wxDatabase::ErrorOccured
}
71 \func{bool
}{ErrorOccured
}{\void}
73 Returns TRUE if the last action caused an error.
75 \membersection{wxDatabase::ErrorSnapshot
}
77 \func{void
}{ErrorSnapshot
}{\param{HSTMT
}{ statement = SQL
\_NULL\_HSTMT}}
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.
83 \membersection{wxDatabase::GetDatabaseName
}
85 \func{wxString
}{GetDatabaseName
}{\void}
87 Returns the name of the database associated with the current connection.
89 \membersection{wxDatabase::GetDataSource
}
91 \func{wxString
}{GetDataSource
}{\void}
93 Returns the name of the connected data source.
95 \membersection{wxDatabase::GetErrorClass
}
97 \func{wxString
}{GetErrorClass
}{\void}
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.
104 \membersection{wxDatabase::GetErrorCode
}
106 \func{wxRETCODE
}{GetErrorCode
}{\void}
108 Returns the error code of the last ODBC function call. This will be one of:
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.
}
120 \membersection{wxDatabase::GetErrorMessage
}
122 \func{wxString
}{GetErrorMessage
}{\void}
124 Returns the last error message returned by the ODBC manager.
126 \membersection{wxDatabase::GetErrorNumber
}
128 \func{long
}{GetErrorNumber
}{\void}
130 Returns the last native error. A native error is an ODBC driver dependent
133 \membersection{wxDatabase::GetHDBC
}
135 \func{HDBC
}{GetHDBC
}{\void}
137 Returns the current ODBC database handle.
139 \membersection{wxDatabase::GetHENV
}
141 \func{HENV
}{GetHENV
}{\void}
143 Returns the ODBC environment handle.
145 \membersection{wxDatabase::GetInfo
}
147 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{long *
}{buf
}}
149 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{const wxString\&
}{buf
},
\param{int
}{ bufSize=-
1}}
151 Returns requested information. The return value is TRUE if successful, FALSE otherwise.
153 {\it infoType
} is an ODBC identifier specifying the type of information to be returned.
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.
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.
161 \membersection{wxDatabase::GetPassword
}
163 \func{wxString
}{GetPassword
}{\void}
165 Returns the password of the current user.
167 \membersection{wxDatabase::GetUsername
}
169 \func{wxString
}{GetUsername
}{\void}
171 Returns the current username.
173 \membersection{wxDatabase::GetODBCVersionFloat
}
175 \func{float
}{GetODBCVersionFloat
}{\param{bool
}{ implementation=TRUE
}}
177 Returns the version of ODBC in floating point format, e.g.
2.50.
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.
182 This function can return the value
0.0 if the header version number is not defined (for early
185 \membersection{wxDatabase::GetODBCVersionString
}
187 \func{wxString
}{GetODBCVersionString
}{\param{bool
}{ implementation=TRUE
}}
189 Returns the version of ODBC in string format, e.g. ``
02.50".
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.
194 This function can return the value ``
00.00" if the header version number is not defined (for early
197 \membersection{wxDatabase::InWaitForDataSource
}
199 \func{bool
}{InWaitForDataSource
}{\void}
203 \membersection{wxDatabase::IsOpen
}
205 \func{bool
}{IsOpen
}{\void}
207 Returns TRUE if a connection is open.
209 \membersection{wxDatabase::Open
}\label{wxdatabaseopen
}
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 = ``"
}}
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.
217 \membersection{wxDatabase::OnSetOptions
}
219 \func{void
}{OnSetOptions
}{\param{wxRecordSet *
}{recordSet
}}
223 \membersection{wxDatabase::OnWaitForDataSource
}
225 \func{void
}{OnWaitForDataSource
}{\param{bool
}{ stillExecuting
}}
229 \membersection{wxDatabase::RollbackTrans
}
231 \func{bool
}{RollbackTrans
}{\void}
233 Sends a rollback to the ODBC driver. Not implemented.
235 \membersection{wxDatabase::SetDataSource
}
237 \func{void
}{SetDataSource
}{\param{const wxString\&
}{s
}}
239 Sets the name of the data source. Not implemented.
241 \membersection{wxDatabase::SetLoginTimeout
}
243 \func{void
}{SetLoginTimeout
}{\param{long
}{ seconds
}}
245 Sets the time to wait for an user login. Not implemented.
247 \membersection{wxDatabase::SetPassword
}
249 \func{void
}{SetPassword
}{\param{const wxString\&
}{s
}}
251 Sets the password of the current user. Not implemented.
253 \membersection{wxDatabase::SetSynchronousMode
}
255 \func{void
}{SetSynchronousMode
}{\param{bool
}{synchronous
}}
257 Toggles between synchronous and asynchronous mode. Currently only synchronous
258 mode is supported, so this function has no effect.
260 \membersection{wxDatabase::SetQueryTimeout
}
262 \func{void
}{SetQueryTimeout
}{\param{long
}{ seconds
}}
264 Sets the time to wait for a response to a query. Not implemented.
266 \membersection{wxDatabase::SetUsername
}
268 \func{void
}{SetUsername
}{\param{const wxString\&
}{s
}}
270 Sets the name of the current user. Not implemented.