HDBC-MissingH API ManualContentsIndex
MissingH.AnyDBM.HDBCDBM
Portabilityportable
Stabilityprovisional
MaintainerJohn Goerzen <jgoerzen@complete.org>
Description

HDBC backend for DBM databases

Written by John Goerzen, jgoerzen@complete.org

Synopsis
data HDBCDBM
openSimpleHDBCDBM :: String -> Connection -> IO HDBCDBM
openHDBCDBM :: String -> String -> String -> Connection -> IO HDBCDBM
Documentation
data HDBCDBM

Main HDBC DBM type.

Please note that accessor methods on these objects will not return SqlErrors since AnyDBM users won't expect them. Instead, they will marshal those into IOErrors.

Also, please note that you cannot expect a HDBCDBM to be able to store the NUL character since most SQL databases can't store it. If you need to be able to store that character with your data, I suggest passing your data through read/show around this module.

show/hide Instances
AnyDBM HDBCDBM
openSimpleHDBCDBM :: String -> Connection -> IO HDBCDBM

Opens a DBM connection to the specified table and database.

If the given table does not already exist, it will be created for you automatically.

The column names dbmkey and dbmval will be used.

The clone method will be used to obtain a new handle to the database for internal use. That will help prevent conflicts with things like commits from occuring with the main application handle. You should not have to worry about side-effects to your main application as a result of using this function.

If you need more control, see openHDBCDBM

openHDBCDBM
:: StringName of table to use
-> StringName of column with keys
-> StringName of column with values
-> ConnectionHDBC connection object to clone
-> IO HDBCDBMReturned DBM object

Opens a DBM connection to the specified table, column name for key, column name for value, and database.

It is an error if the given table does not exist, lacks the specified columns, or has an incorrect type definition for the specified columns. However, it is not guaranteed that this error will be detected at object creation time.

This function does not create a table for you if it doesn't exist.

You can use the table created and used by openSimpleHDBCDBM like this:

openHDBCDBM "tablename" "dbmkey" "dbmval" conn

Incidentally, such a table could be created with:

CREATE TABLE tablename (dbmkey text NOT NULL PRIMARY KEY, dmval text NOT NULL)

The clone method will be used to obtain a new handle to the database for internal use. That will help prevent conflicts with things like commits from occuring with the main application handle. You should not have to worry about side-effects to your main application as a result of using this function.

Produced by Haddock version 0.7