Migration from HDBC 1.0.x

You can do this two ways. The "easy" way will have you use wrappers, so you have minimal changes to your type signatures. However, it will not be as easy to use private database features this way. The other way will upgrade you to the full HDBC 1.1.x API.

Easy Wrapper-Based Method

There are a few code changes you need to make:

1. Modify all static type signatures that reference

Connection
to reference
ConnWrapper

2. After connecting to the database, wrap the connection.

That is, change:

do ...
   dbh <- connect...

to:

do ...
   tempdbh <- connect...
   let dbh = ConnWrapper tempdbh

Full Typeclass-Based Method

The basic idea is: find all static type signatures that reference

Connection
. Instead, have them reference
IConnection => conn ... conn

Example:

myfunc :: Connection -> IO ()

changes to:

myfunc :: IConnection conn => conn -> IO ()

Some other changes may be necessary as well, depending upon how you use the database connection.

Also available in: HTML TXT