1 \section{\class{wxDatabase
}}\label{wxdatabase
}
3 Every database object represents an ODBC connection.
4 The connection may be closed and reopened.
6 \wxheading{Derived from
}
8 \helpref{wxObject
}{wxobject
}
10 \wxheading{Include files
}
16 \overview{wxDatabase overview
}{wxdatabaseoverview
},
\helpref{wxRecordSet
}{wxrecordset
}
18 \latexignore{\rtfignore{\wxheading{Members
}}}
20 \membersection{wxDatabase::wxDatabase
}
22 \func{}{wxDatabase
}{\void}
24 Constructor. The constructor of the first wxDatabase instance of an
25 application initializes the ODBC manager.
27 \membersection{wxDatabase::
\destruct{wxDatabase
}}
29 \func{}{\destruct{wxDatabase
}}{\void}
31 Destructor. Resets and destroys any associated wxRecordSet instances.
33 The destructor of the last wxDatabase instance will deinitialize
36 \membersection{wxDatabase::BeginTrans
}
38 \func{bool
}{BeginTrans
}{\void}
42 \membersection{wxDatabase::Cancel
}
44 \func{void
}{Cancel
}{\void}
48 \membersection{wxDatabase::CanTransact
}
50 \func{bool
}{CanTransact
}{\void}
55 \membersection{wxDatabase::CanUpdate
}
57 \func{bool
}{CanUpdate
}{\void}
61 \membersection{wxDatabase::Close
}
63 \func{bool
}{Close
}{\void}
65 Resets the statement handles of any associated wxRecordSet objects,
66 and disconnects from the current data source.
68 \membersection{wxDatabase::CommitTrans
}
70 \func{bool
}{CommitTrans
}{\void}
72 Commits previous transactions. Not implemented.
74 \membersection{wxDatabase::ErrorOccured
}
76 \func{bool
}{ErrorOccured
}{\void}
78 Returns TRUE if the last action caused an error.
80 \membersection{wxDatabase::ErrorSnapshot
}
82 \func{void
}{ErrorSnapshot
}{\param{HSTMT
}{ statement = SQL
\_NULL\_HSTMT}}
84 This function will be called whenever an ODBC error occured. It stores the
85 error related information returned by ODBC. If a statement handle of the
86 concerning ODBC action is available it should be passed to the function.
88 \membersection{wxDatabase::GetDatabaseName
}
90 \func{wxString
}{GetDatabaseName
}{\void}
92 Returns the name of the database associated with the current connection.
94 \membersection{wxDatabase::GetDataSource
}
96 \func{wxString
}{GetDataSource
}{\void}
98 Returns the name of the connected data source.
100 \membersection{wxDatabase::GetErrorClass
}
102 \func{wxString
}{GetErrorClass
}{\void}
104 Returns the error class of the last error. The error class consists of
105 five characters where the first two characters contain the class
106 and the other three characters contain the subclass of the ODBC error.
107 See ODBC documentation for further details.
109 \membersection{wxDatabase::GetErrorCode
}
111 \func{wxRETCODE
}{GetErrorCode
}{\void}
113 Returns the error code of the last ODBC function call. This will be one of:
115 \begin{twocollist
}\itemsep=
0pt
116 \twocolitem{SQL
\_ERROR}{General error.
}
117 \twocolitem{SQL
\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.
}
118 \twocolitem{SQL
\_NEED\_DATA}{ODBC expected some data.
}
119 \twocolitem{SQL
\_NO\_DATA\_FOUND}{No data was found by this ODBC call.
}
120 \twocolitem{SQL
\_SUCCESS}{The call was successful.
}
121 \twocolitem{SQL
\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can be
122 obtained from the ODBC manager.
}
125 \membersection{wxDatabase::GetErrorMessage
}
127 \func{wxString
}{GetErrorMessage
}{\void}
129 Returns the last error message returned by the ODBC manager.
131 \membersection{wxDatabase::GetErrorNumber
}
133 \func{long
}{GetErrorNumber
}{\void}
135 Returns the last native error. A native error is an ODBC driver dependent
138 \membersection{wxDatabase::GetHDBC
}
140 \func{HDBC
}{GetHDBC
}{\void}
142 Returns the current ODBC database handle.
144 \membersection{wxDatabase::GetHENV
}
146 \func{HENV
}{GetHENV
}{\void}
148 Returns the ODBC environment handle.
150 \membersection{wxDatabase::GetInfo
}
152 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{long *
}{buf
}}
154 \func{bool
}{GetInfo
}{\param{long
}{ infoType
},
\param{const wxString\&
}{buf
},
\param{int
}{ bufSize=-
1}}
156 Returns requested information. The return value is TRUE if successful, FALSE otherwise.
158 {\it infoType
} is an ODBC identifier specifying the type of information to be returned.
160 {\it buf
} is a character or long integer pointer to storage which must be allocated by the
161 application, and which will contain the information if the function is successful.
163 {\it bufSize
} is the size of the character buffer. A value of -
1 indicates that the size
164 should be computed by the GetInfo function.
166 \membersection{wxDatabase::GetPassword
}
168 \func{wxString
}{GetPassword
}{\void}
170 Returns the password of the current user.
172 \membersection{wxDatabase::GetUsername
}
174 \func{wxString
}{GetUsername
}{\void}
176 Returns the current username.
178 \membersection{wxDatabase::GetODBCVersionFloat
}
180 \func{float
}{GetODBCVersionFloat
}{\param{bool
}{ implementation=TRUE
}}
182 Returns the version of ODBC in floating point format, e.g.
2.50.
184 {\it implementation
} should be TRUE to get the DLL version, or FALSE to get the
185 version defined in the
{\tt sql.h
} header file.
187 This function can return the value
0.0 if the header version number is not defined (for early
190 \membersection{wxDatabase::GetODBCVersionString
}
192 \func{wxString
}{GetODBCVersionString
}{\param{bool
}{ implementation=TRUE
}}
194 Returns the version of ODBC in string format, e.g. ``
02.50".
196 {\it implementation
} should be TRUE to get the DLL version, or FALSE to get the
197 version defined in the
{\tt sql.h
} header file.
199 This function can return the value ``
00.00" if the header version number is not defined (for early
202 \membersection{wxDatabase::InWaitForDataSource
}
204 \func{bool
}{InWaitForDataSource
}{\void}
208 \membersection{wxDatabase::IsOpen
}
210 \func{bool
}{IsOpen
}{\void}
212 Returns TRUE if a connection is open.
214 \membersection{wxDatabase::Open
}\label{wxdatabaseopen
}
216 \func{bool
}{Open
}{\param{const wxString\&
}{datasource
},
\param{bool
}{ exclusive = FALSE
},
\param{bool
}{readOnly = TRUE
},
217 \param{const wxString\&
}{username = ``ODBC"
},
\param{const wxString\&
}{password = ``"
}}
219 Connect to a data source.
{\it datasource
} contains the name of the ODBC data
220 source. The parameters exclusive and readOnly are not used.
222 \membersection{wxDatabase::OnSetOptions
}
224 \func{void
}{OnSetOptions
}{\param{wxRecordSet *
}{recordSet
}}
228 \membersection{wxDatabase::OnWaitForDataSource
}
230 \func{void
}{OnWaitForDataSource
}{\param{bool
}{ stillExecuting
}}
234 \membersection{wxDatabase::RollbackTrans
}
236 \func{bool
}{RollbackTrans
}{\void}
238 Sends a rollback to the ODBC driver. Not implemented.
240 \membersection{wxDatabase::SetDataSource
}
242 \func{void
}{SetDataSource
}{\param{const wxString\&
}{s
}}
244 Sets the name of the data source. Not implemented.
246 \membersection{wxDatabase::SetLoginTimeout
}
248 \func{void
}{SetLoginTimeout
}{\param{long
}{ seconds
}}
250 Sets the time to wait for an user login. Not implemented.
252 \membersection{wxDatabase::SetPassword
}
254 \func{void
}{SetPassword
}{\param{const wxString\&
}{s
}}
256 Sets the password of the current user. Not implemented.
258 \membersection{wxDatabase::SetSynchronousMode
}
260 \func{void
}{SetSynchronousMode
}{\param{bool
}{synchronous
}}
262 Toggles between synchronous and asynchronous mode. Currently only synchronous
263 mode is supported, so this function has no effect.
265 \membersection{wxDatabase::SetQueryTimeout
}
267 \func{void
}{SetQueryTimeout
}{\param{long
}{ seconds
}}
269 Sets the time to wait for a response to a query. Not implemented.
271 \membersection{wxDatabase::SetUsername
}
273 \func{void
}{SetUsername
}{\param{const wxString\&
}{s
}}
275 Sets the name of the current user. Not implemented.