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 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.
 
  21 See details of these classes in:
 
  22 \helpref{wxDb
}{wxdb
}, 
\helpref{wxDbTable
}{wxdbtable
} 
  24 \latexignore{\rtfignore{\wxheading{Members
}}} 
  26 \membersection{wxDatabase::wxDatabase
} 
  28 \func{}{wxDatabase
}{\void} 
  30 Constructor. The constructor of the first wxDatabase instance of an
 
  31 application initializes the ODBC manager.
 
  33 \membersection{wxDatabase::
\destruct{wxDatabase
}} 
  35 \func{}{\destruct{wxDatabase
}}{\void} 
  37 Destructor. Resets and destroys any associated wxRecordSet instances.
 
  39 The destructor of the last wxDatabase instance will deinitialize
 
  42 \membersection{wxDatabase::BeginTrans
} 
  44 \func{bool
}{BeginTrans
}{\void} 
  48 \membersection{wxDatabase::Cancel
} 
  50 \func{void
}{Cancel
}{\void} 
  54 \membersection{wxDatabase::CanTransact
} 
  56 \func{bool
}{CanTransact
}{\void} 
  61 \membersection{wxDatabase::CanUpdate
} 
  63 \func{bool
}{CanUpdate
}{\void} 
  67 \membersection{wxDatabase::Close
} 
  69 \func{bool
}{Close
}{\void} 
  71 Resets the statement handles of any associated wxRecordSet objects,
 
  72 and disconnects from the current data source.
 
  74 \membersection{wxDatabase::CommitTrans
} 
  76 \func{bool
}{CommitTrans
}{\void} 
  78 Commits previous transactions. Not implemented.
 
  80 \membersection{wxDatabase::ErrorOccured
} 
  82 \func{bool
}{ErrorOccured
}{\void} 
  84 Returns true if the last action caused an error.
 
  86 \membersection{wxDatabase::ErrorSnapshot
} 
  88 \func{void
}{ErrorSnapshot
}{\param{HSTMT
}{ statement = SQL
\_NULL\_HSTMT}} 
  90 This function will be called whenever an ODBC error occured. It stores the
 
  91 error related information returned by ODBC. If a statement handle of the
 
  92 concerning ODBC action is available it should be passed to the function.
 
  94 \membersection{wxDatabase::GetDatabaseName
} 
  96 \func{wxString
}{GetDatabaseName
}{\void} 
  98 Returns the name of the database associated with the current connection.
 
 100 \membersection{wxDatabase::GetDataSource
} 
 102 \func{wxString
}{GetDataSource
}{\void} 
 104 Returns the name of the connected data source.
 
 106 \membersection{wxDatabase::GetErrorClass
} 
 108 \func{wxString
}{GetErrorClass
}{\void} 
 110 Returns the error class of the last error. The error class consists of
 
 111 five characters where the first two characters contain the class
 
 112 and the other three characters contain the subclass of the ODBC error.
 
 113 See ODBC documentation for further details.
 
 115 \membersection{wxDatabase::GetErrorCode
} 
 117 \func{wxRETCODE
}{GetErrorCode
}{\void} 
 119 Returns the error code of the last ODBC function call. This will be one of:
 
 121 \begin{twocollist
}\itemsep=
0pt
 
 122 \twocolitem{SQL
\_ERROR}{General error.
} 
 123 \twocolitem{SQL
\_INVALID\_HANDLE}{An invalid handle was passed to an ODBC function.
} 
 124 \twocolitem{SQL
\_NEED\_DATA}{ODBC expected some data.
} 
 125 \twocolitem{SQL
\_NO\_DATA\_FOUND}{No data was found by this ODBC call.
} 
 126 \twocolitem{SQL
\_SUCCESS}{The call was successful.
} 
 127 \twocolitem{SQL
\_SUCCESS\_WITH\_INFO}{The call was successful, but further information can be
 
 128 obtained from the ODBC manager.
} 
 131 \membersection{wxDatabase::GetErrorMessage
} 
 133 \func{wxString
}{GetErrorMessage
}{\void} 
 135 Returns the last error message returned by the ODBC manager.
 
 137 \membersection{wxDatabase::GetErrorNumber
} 
 139 \func{long
}{GetErrorNumber
}{\void} 
 141 Returns the last native error. A native error is an ODBC driver dependent
 
 144 \membersection{wxDatabase::GetHDBC
} 
 146 \func{HDBC
}{GetHDBC
}{\void} 
 148 Returns the current ODBC database handle.
 
 150 \membersection{wxDatabase::GetHENV
} 
 152 \func{HENV
}{GetHENV
}{\void} 
 154 Returns the ODBC environment handle. 
 
 156 \membersection{wxDatabase::GetInfo
} 
 158 \func{bool
}{GetInfo
}{\param{long
}{ infoType
}, 
\param{long *
}{buf
}} 
 160 \func{bool
}{GetInfo
}{\param{long
}{ infoType
}, 
\param{const wxString\& 
}{buf
}, 
\param{int
}{ bufSize=-
1}} 
 162 Returns requested information. The return value is true if successful, false otherwise.
 
 164 {\it infoType
} is an ODBC identifier specifying the type of information to be returned.
 
 166 {\it buf
} is a character or long integer pointer to storage which must be allocated by the
 
 167 application, and which will contain the information if the function is successful.
 
 169 {\it bufSize
} is the size of the character buffer. A value of -
1 indicates that the size
 
 170 should be computed by the GetInfo function.
 
 172 \membersection{wxDatabase::GetPassword
} 
 174 \func{wxString
}{GetPassword
}{\void} 
 176 Returns the password of the current user.
 
 178 \membersection{wxDatabase::GetUsername
} 
 180 \func{wxString
}{GetUsername
}{\void} 
 182 Returns the current username.
 
 184 \membersection{wxDatabase::GetODBCVersionFloat
} 
 186 \func{float
}{GetODBCVersionFloat
}{\param{bool
}{ implementation=true
}} 
 188 Returns the version of ODBC in floating point format, e.g. 
2.50.
 
 190 {\it implementation
} should be true to get the DLL version, or false to get the
 
 191 version defined in the 
{\tt sql.h
} header file.
 
 193 This function can return the value 
0.0 if the header version number is not defined (for early
 
 196 \membersection{wxDatabase::GetODBCVersionString
} 
 198 \func{wxString
}{GetODBCVersionString
}{\param{bool
}{ implementation=true
}} 
 200 Returns the version of ODBC in string format, e.g. ``
02.50".
 
 202 {\it implementation
} should be true to get the DLL version, or false to get the
 
 203 version defined in the 
{\tt sql.h
} header file.
 
 205 This function can return the value ``
00.00" if the header version number is not defined (for early
 
 208 \membersection{wxDatabase::InWaitForDataSource
} 
 210 \func{bool
}{InWaitForDataSource
}{\void} 
 214 \membersection{wxDatabase::IsOpen
} 
 216 \func{bool
}{IsOpen
}{\void} 
 218 Returns true if a connection is open.
 
 220 \membersection{wxDatabase::Open
}\label{wxdatabaseopen
} 
 222 \func{bool
}{Open
}{\param{const wxString\& 
}{datasource
}, 
\param{bool
}{ exclusive = false
}, 
\param{bool 
}{readOnly = true
},
 
 223  \param{const wxString\& 
}{username = ``ODBC"
}, 
\param{const wxString\& 
}{password = ``"
}} 
 225 Connect to a data source. 
{\it datasource
} contains the name of the ODBC data
 
 226 source. The parameters exclusive and readOnly are not used.
 
 228 \membersection{wxDatabase::OnSetOptions
} 
 230 \func{void
}{OnSetOptions
}{\param{wxRecordSet *
}{recordSet
}} 
 234 \membersection{wxDatabase::OnWaitForDataSource
} 
 236 \func{void
}{OnWaitForDataSource
}{\param{bool
}{ stillExecuting
}} 
 240 \membersection{wxDatabase::RollbackTrans
} 
 242 \func{bool
}{RollbackTrans
}{\void} 
 244 Sends a rollback to the ODBC driver. Not implemented.
 
 246 \membersection{wxDatabase::SetDataSource
} 
 248 \func{void
}{SetDataSource
}{\param{const wxString\& 
}{s
}} 
 250 Sets the name of the data source. Not implemented.
 
 252 \membersection{wxDatabase::SetLoginTimeout
} 
 254 \func{void
}{SetLoginTimeout
}{\param{long
}{ seconds
}} 
 256 Sets the time to wait for an user login. Not implemented.
 
 258 \membersection{wxDatabase::SetPassword
} 
 260 \func{void
}{SetPassword
}{\param{const wxString\& 
}{s
}} 
 262 Sets the password of the current user. Not implemented.
 
 264 \membersection{wxDatabase::SetSynchronousMode
} 
 266 \func{void
}{SetSynchronousMode
}{\param{bool 
}{synchronous
}} 
 268 Toggles between synchronous and asynchronous mode. Currently only synchronous
 
 269 mode is supported, so this function has no effect.
 
 271 \membersection{wxDatabase::SetQueryTimeout
} 
 273 \func{void
}{SetQueryTimeout
}{\param{long
}{ seconds
}} 
 275 Sets the time to wait for a response to a query. Not implemented.
 
 277 \membersection{wxDatabase::SetUsername
} 
 279 \func{void
}{SetUsername
}{\param{const wxString\& 
}{s
}} 
 281 Sets the name of the current user. Not implemented.