disconnect :: (IO ()) | Disconnect from the remote database.
You do not need to explicitly close a Connection 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 Statements
active. In more precise language, the results in such situations are undefined
and vary by database. So don't do it.
|
commit :: (IO ()) | Commit any pending data to the database.
Required to make any changes take effect.
|
rollback :: (IO ()) | Roll back to the state the database was in prior to the
last commit or rollback.
|
run :: (String -> [SqlValue] -> IO Integer) | Execute a single SQL query. Returns the number
of rows modified (see execute for details).
The second parameter is a list
of replacement values, if any.
|
prepare :: (String -> IO Statement) | Prepares a statement for execution.
Question marks in the statement will be replaced by
positional parameters in a later call to execute.
Please note that, depending on the database
and the driver, errors in your SQL may be raised
either here or by execute. Make sure you
handle exceptions both places if necessary.
|
clone :: (IO Connection) | Create a new Connection object, pointed at the same
server as this object is. This will generally establish
a separate physical connection.
When you wish to establish multiple connections to a single
server, the correct way to do so is to establish the
first connection with the driver-specific connection
function, and then clone it for each additional connection.
This can be important when a database doesn't provide
much thread support itself, and the HDBC driver module
must serialize access to a particular database.
This can also be a handy utility function whenever you
need a separate connection to whatever database you are
connected to already.
|
hdbcDriverName :: String | The name of the HDBC driver module for this connection.
Ideally would be the same as the database name portion
of the Cabal package name. For instance, "sqlite3"
or "odbc". This is the layer that is bound most
tightly to HDBC.
|
hdbcClientVer :: String | The version of the C (or whatever) client library
that the HDBC driver module is bound to. The meaning
of this is driver-specific. For an ODBC or similar
proxying driver, this should be the version of the
ODBC library, not the eventual DB client driver.
|
proxiedClientName :: String | In the case of a system such as ODBC, the name of
the database client/server in use, if available.
For others,
identical to hdbcDriverName.
|
proxiedClientVer :: String | In the case of a system such as ODBC, the version of
the database client in use, if available. For others,
identical to hdbcClientVer. This is the next layer
out past the HDBC driver.
|
dbServerVer :: String | The version of the database server, if available.
|
dbTransactionSupport :: Bool | Whether or not the current database supports transactions.
If False, then commit and rollback should be expected
to raise errors.
MySQL is the only commonly-used database that is known
to not support transactions entirely. Please see
the MySQL notes in the ODBC driver for more information.
|
getTables :: (IO [String]) | The names of all tables accessible by the current
connection, excluding special meta-tables (system tables).
You should expect this to be returned in the same manner
as a result from fetchAllRows.
All results should be converted to lowercase for you
before you see them.
|
describeTable :: (String -> IO [(String, SqlColDesc)]) | Obtain information about the columns in a specific
table. The String in the result
set is the column name.
You should expect this to be returned in the same manner
as a result from fetchAllRows.
All results should be converted to lowercase for you
before you see them.
|