1 \section{\class{wxDatabase
}}\label{wxdatabase
}
3 Every database object represents an ODBC connection.
4 The connection may be closed and reopened.
6 Note: this class is considered obsolete, replaced by the Remstar wxDB/wxTable classes
7 (documented separately in Word and PDF format, as odbc.doc and odbc.pdf).
9 \wxheading{Derived from
}
11 \helpref{wxObject
}{wxobject
}
13 \wxheading{Include files
}
19 \overview{wxDatabase overview
}{wxdatabaseoverview
},
\helpref{wxRecordSet
}{wxrecordset
}
21 \latexignore{\rtfignore{\wxheading{Members
}}}
23 \membersection{wxDatabase::wxDatabase
}
25 \func{}{wxDatabase
}{\void}
27 Constructor. The constructor of the first wxDatabase instance of an
28 application initializes the ODBC manager.
30 \membersection{wxDatabase::
\destruct{wxDatabase
}}
32 \func{}{\destruct{wxDatabase
}}{\void}
34 Destructor. Resets and destroys any associated wxRecordSet instances.
36 The destructor of the last wxDatabase instance will deinitialize
39 \membersection{wxDatabase::BeginTrans
}
41 \func{bool
}{BeginTrans
}{\void}
45 \membersection{wxDatabase::Cancel
}
47 \func{void
}{Cancel
}{\void}
51 \membersection{wxDatabase::CanTransact
}
53 \func{bool
}{CanTransact
}{\void}
58 \membersection{wxDatabase::CanUpdate
}
60 \func{bool
}{CanUpdate
}{\void}
64 \membersection{wxDatabase::Close
}
66 \func{bool
}{Close
}{\void}
68 Resets the statement handles of any associated wxRecordSet objects,
69 and disconnects from the current data source.
71 \membersection{wxDatabase::CommitTrans
}
73 \func{bool
}{CommitTrans
}{\void}
75 Commits previous transactions. Not implemented.
77 \membersection{wxDatabase::ErrorOccured
}
79 \func{bool
}{ErrorOccured
}{\void}
81 Returns TRUE if the last action caused an error.
83 \membersection{wxDatabase::ErrorSnapshot
}
85 \func{void
}{ErrorSnapshot
}{\param{HSTMT
}{ statement = SQL
\_NULL\_HSTMT}}
87 This function will be called whenever an ODBC error occured. It stores the
88 error related information returned by ODBC. If a statement handle of the
89 concerning ODBC action is available it should be passed to the function.
91 \membersection{wxDatabase::GetDatabaseName
}
93 \func{wxString
}{GetDatabaseName
}{\void}
95 Returns the name of the database associated with the current connection.
97 \membersection{wxDatabase::GetDataSource
}
99 \func{wxString
}{GetDataSource
}{\void}
101 Returns the name of the connected data source.
103 \membersection{wxDatabase::GetErrorClass
}
105 \func{wxString
}{GetErrorClass
}{\void}
107 Returns the error class of the last error. The error class consists of
108 five characters where the first two characters contain the class
109 and the other three characters contain the subclass of the ODBC error.
110 See ODBC documentation for further details.
112 \membersection{wxDatabase::GetErrorCode
}
114 \func{wxRETCODE
}{GetErrorCode
}{\void}
116 Returns the error code of the last ODBC function call. This will be one of:
118 \begin{twocollist
}\itemsep=
0pt
119 \twocolitem{SQL
\_ERROR}{General error.
}
120 \twocolitem{SQL
\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.
}
121 \twocolitem{SQL
\_NEED\_DATA}{ODBC expected some data.
}
122 \twocolitem{SQL
\_NO\_DATA\_FOUND}{No data was found by this ODBC call.
}
123 \twocolitem{SQL
\_SUCCESS}{The call was successful.
}
124 \twocolitem{SQL
\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can be
125 obtained from the ODBC manager.
}
128 \membersection{wxDatabase::GetErrorMessage
}
130 \func{wxString
}{GetErrorMessage
}{\void}
132 Returns the last error message returned by the ODBC manager.
134 \membersection{wxDatabase::GetErrorNumber
}
136 \func{long
}{GetErrorNumber
}{\void}
138 Returns the last native error. A native error is an ODBC driver dependent
141 \membersection{wxDatabase::GetHDBC
}
143 \func{HDBC
}{GetHDBC
}{\void}
145 Returns the current ODBC database handle.
147 \membersection{wxDatabase::GetHENV
}
149 \func{HENV
}{GetHENV
}{\void}
151 Returns the ODBC environment handle.
153 \membersection{wxDatabase::GetInfo
}
155 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{long *
}{buf
}}
157 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{const wxString\&
}{buf
},
\param{int
}{ bufSize=-
1}}
159 Returns requested information. The return value is TRUE if successful, FALSE otherwise.
161 {\it infoType
} is an ODBC identifier specifying the type of information to be returned.
163 {\it buf
} is a character or long integer pointer to storage which must be allocated by the
164 application, and which will contain the information if the function is successful.
166 {\it bufSize
} is the size of the character buffer. A value of -
1 indicates that the size
167 should be computed by the GetInfo function.
169 \membersection{wxDatabase::GetPassword
}
171 \func{wxString
}{GetPassword
}{\void}
173 Returns the password of the current user.
175 \membersection{wxDatabase::GetUsername
}
177 \func{wxString
}{GetUsername
}{\void}
179 Returns the current username.
181 \membersection{wxDatabase::GetODBCVersionFloat
}
183 \func{float
}{GetODBCVersionFloat
}{\param{bool
}{ implementation=TRUE
}}
185 Returns the version of ODBC in floating point format, e.g.
2.50.
187 {\it implementation
} should be TRUE to get the DLL version, or FALSE to get the
188 version defined in the
{\tt sql.h
} header file.
190 This function can return the value
0.0 if the header version number is not defined (for early
193 \membersection{wxDatabase::GetODBCVersionString
}
195 \func{wxString
}{GetODBCVersionString
}{\param{bool
}{ implementation=TRUE
}}
197 Returns the version of ODBC in string format, e.g. ``
02.50".
199 {\it implementation
} should be TRUE to get the DLL version, or FALSE to get the
200 version defined in the
{\tt sql.h
} header file.
202 This function can return the value ``
00.00" if the header version number is not defined (for early
205 \membersection{wxDatabase::InWaitForDataSource
}
207 \func{bool
}{InWaitForDataSource
}{\void}
211 \membersection{wxDatabase::IsOpen
}
213 \func{bool
}{IsOpen
}{\void}
215 Returns TRUE if a connection is open.
217 \membersection{wxDatabase::Open
}\label{wxdatabaseopen
}
219 \func{bool
}{Open
}{\param{const wxString\&
}{datasource
},
\param{bool
}{ exclusive = FALSE
},
\param{bool
}{readOnly = TRUE
},
220 \param{const wxString\&
}{username = ``ODBC"
},
\param{const wxString\&
}{password = ``"
}}
222 Connect to a data source.
{\it datasource
} contains the name of the ODBC data
223 source. The parameters exclusive and readOnly are not used.
225 \membersection{wxDatabase::OnSetOptions
}
227 \func{void
}{OnSetOptions
}{\param{wxRecordSet *
}{recordSet
}}
231 \membersection{wxDatabase::OnWaitForDataSource
}
233 \func{void
}{OnWaitForDataSource
}{\param{bool
}{ stillExecuting
}}
237 \membersection{wxDatabase::RollbackTrans
}
239 \func{bool
}{RollbackTrans
}{\void}
241 Sends a rollback to the ODBC driver. Not implemented.
243 \membersection{wxDatabase::SetDataSource
}
245 \func{void
}{SetDataSource
}{\param{const wxString\&
}{s
}}
247 Sets the name of the data source. Not implemented.
249 \membersection{wxDatabase::SetLoginTimeout
}
251 \func{void
}{SetLoginTimeout
}{\param{long
}{ seconds
}}
253 Sets the time to wait for an user login. Not implemented.
255 \membersection{wxDatabase::SetPassword
}
257 \func{void
}{SetPassword
}{\param{const wxString\&
}{s
}}
259 Sets the password of the current user. Not implemented.
261 \membersection{wxDatabase::SetSynchronousMode
}
263 \func{void
}{SetSynchronousMode
}{\param{bool
}{synchronous
}}
265 Toggles between synchronous and asynchronous mode. Currently only synchronous
266 mode is supported, so this function has no effect.
268 \membersection{wxDatabase::SetQueryTimeout
}
270 \func{void
}{SetQueryTimeout
}{\param{long
}{ seconds
}}
272 Sets the time to wait for a response to a query. Not implemented.
274 \membersection{wxDatabase::SetUsername
}
276 \func{void
}{SetUsername
}{\param{const wxString\&
}{s
}}
278 Sets the name of the current user. Not implemented.