Re-exports MetaHDBC modules and a little part HDBC.ODBC.
- module Database.MetaHDBC.SimpleSqlParser
- module Database.MetaHDBC.SqlExpr
- module Database.MetaHDBC.SqlTypeIdExpQ
- cachingConnection :: String -> IO CachingConnection
- disconnect :: IConnection conn => conn -> IO ()
- commit :: IConnection conn => conn -> IO ()
- rollback :: IConnection conn => conn -> IO ()
- connectODBC :: String -> IO Connection
- data Connection
Documentation
module Database.MetaHDBC.SqlExpr
disconnect :: IConnection conn => conn -> IO ()
Disconnect from the remote database.
You do not need to explicitly close an IConnection object, but you may do so if
you so desire. If you don't, the object will disconnect from the database
in a sane way when it is garbage-collected. However, a disconnection may
raise an error, so you are encouraged to explicitly call disconnect
. Also,
garbage collection may not run when the program terminates, and some databases
really like an explicit disconnect.
So, bottom line is, you're best off calling disconnect
directly, but the
world won't end if you forget.
This function discards any data not committed already. Database driver
implementators should explicitly call rollback
if their databases don't
do this automatically on disconnect.
Bad Things (TM) could happen if you call this while you have Statement
s
active. In more precise language, the results in such situations are undefined
and vary by database. So don't do it.
commit :: IConnection conn => conn -> IO ()
Commit any pending data to the database.
Required to make any changes take effect.
rollback :: IConnection conn => conn -> IO ()
connectODBC :: String -> IO Connection
Connect to an ODBC server.
For information on the meaning of the passed string, please see:
http://msdn2.microsoft.com/en-us/library/ms715433(VS.85).aspx
An example string is:
"DSN=hdbctest1"
This, and all other functions that use ODBC directly or indirectly, can raise
SqlErrors just like other HDBC backends. The seErrorMsg field is specified
as a String in HDBC. ODBC specifies this data as a list of strings.
Therefore, this driver uses show on the data from ODBC. For friendly display,
or handling of individual component messages in your code, you can use
read on the seErrorMsg field in a context that expects [String]
.
Important note for MySQL users:
Unless you are going to use InnoDB tables, you are strongly encouraged to set
Option = 262144
in your odbc.ini (for Unix users), or to disable transaction support in your DSN setup for Windows users.
If you fail to do this, the MySQL ODBC driver will incorrectly state that it supports transactions. dbTransactionSupport will incorrectly return True. commit and rollback will then silently fail. This is certainly NOT what you want. It is a bug (or misfeature) in the MySQL driver, not in HDBC.
You should ignore this advice if you are using InnoDB tables.