diff --git a/Database/SQLite/Simple.hs b/Database/SQLite/Simple.hs
--- a/Database/SQLite/Simple.hs
+++ b/Database/SQLite/Simple.hs
@@ -1,11 +1,11 @@
-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings #-}
+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, GeneralizedNewtypeDeriving #-}
 
 ------------------------------------------------------------------------------
 -- |
 -- Module:      Database.SQLite.Simple
 -- Copyright:   (c) 2011 MailRank, Inc.
 --              (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
@@ -45,6 +45,7 @@
   , (:.)(..)
   , Base.SQLData(..)
   , Statement
+  , ColumnIndex(..)
     -- * Connections
   , open
   , close
@@ -66,6 +67,7 @@
   , withStatement
   , bind
   , reset
+  , columnName
   , withBind
   , nextRow
     -- ** Exceptions
@@ -74,7 +76,7 @@
   ) where
 
 import           Control.Applicative
-import           Control.Exception (Exception, throw, throwIO, bracket)
+import           Control.Exception
 import           Control.Monad (void, when)
 import           Control.Monad.Trans.Reader
 import           Control.Monad.Trans.State.Strict
@@ -96,6 +98,10 @@
 -- | An SQLite prepared statement.
 newtype Statement = Statement Base.Statement
 
+-- | Index of a column in a result set. Column indices start from 0.
+newtype ColumnIndex = ColumnIndex BaseD.ColumnIndex
+    deriving (Eq, Ord, Enum, Num, Real, Integral)
+
 -- | Exception thrown if a 'Query' was malformed.
 -- This may occur if the number of \'@?@\' characters in the query
 -- string does not match the number of parameters provided.
@@ -128,6 +134,9 @@
 withConnection :: String -> (Connection -> IO a) -> IO a
 withConnection connString = bracket (open connString) close
 
+unUtf8 :: BaseD.Utf8 -> T.Text
+unUtf8 (BaseD.Utf8 bs) = TE.decodeUtf8 bs
+
 -- | <http://www.sqlite.org/c3ref/profile.html>
 --
 -- Enable/disable tracing of SQL execution.  Tracing can be disabled
@@ -138,8 +147,6 @@
 setTrace :: Connection -> Maybe (T.Text -> IO ()) -> IO ()
 setTrace (Connection db) logger =
   BaseD.setTrace db (fmap (\lf -> lf . unUtf8) logger)
-  where
-    unUtf8 (BaseD.Utf8 bs) = TE.decodeUtf8 bs
 
 -- | Binds parameters to a prepared statement. Once 'nextRow' returns 'Nothing',
 -- the statement must be reset with the 'reset' function before it can be
@@ -170,11 +177,30 @@
 reset :: Statement -> IO ()
 reset (Statement stmt) = Base.reset stmt
 
--- | Binds parameters to a prepared statement and then resets them, even in the
--- presence of exceptions.
+-- | Return the name of a a particular column in the result set of a
+-- 'Statement'.  Throws an 'ArrayException' if the colum index is out
+-- of bounds.
+--
+-- <http://www.sqlite.org/c3ref/column_name.html>
+columnName :: Statement -> ColumnIndex -> IO T.Text
+columnName (Statement stmt) (ColumnIndex n) = BaseD.columnName stmt n >>= takeUtf8
+  where
+    takeUtf8 (Just s) = return $ unUtf8 s
+    takeUtf8 Nothing  =
+      throwIO (IndexOutOfBounds ("Column index " ++ show n ++ " out of bounds"))
+
+-- | Binds parameters to a prepared statement, and 'reset's the statement when
+-- the callback completes, even in the presence of exceptions.
+--
+-- Use 'withBind' to reuse prepared statements.  Because it 'reset's the
+-- statement /after/ each usage, it avoids a pitfall involving implicit
+-- transactions.  SQLite creates an implicit transaction if you don't say
+-- @BEGIN@ explicitly, and does not commit it until all active statements are
+-- finished with either 'reset' or 'closeStatement'.
 withBind :: (ToRow params) => Statement -> params -> IO a -> IO a
-withBind stmt params io =
-  bracket (bind stmt params >> return stmt) reset (const io)
+withBind stmt params io = do
+  bind stmt params
+  io `finally` reset stmt
 
 -- | Opens a prepared statement. A prepared statement must always be closed with
 -- a corresponding call to 'closeStatement' before closing the connection. Use
@@ -311,7 +337,7 @@
     Ok (val,col) | col == ncols -> return val
                  | otherwise -> do
                      let vals = map (\f -> (gettypename f, f)) rowRes
-                     throw (ConversionFailed
+                     throwIO (ConversionFailed
                        (show ncols ++ " values: " ++ show vals)
                        (show col ++ " slots in target type")
                        "mismatch between number of columns to \
diff --git a/Database/SQLite/Simple/FromField.hs b/Database/SQLite/Simple/FromField.hs
--- a/Database/SQLite/Simple/FromField.hs
+++ b/Database/SQLite/Simple/FromField.hs
@@ -7,7 +7,7 @@
 -- Module:      Database.SQLite.Simple.FromField
 -- Copyright:   (c) 2011 MailRank, Inc.
 --              (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
diff --git a/Database/SQLite/Simple/FromRow.hs b/Database/SQLite/Simple/FromRow.hs
--- a/Database/SQLite/Simple/FromRow.hs
+++ b/Database/SQLite/Simple/FromRow.hs
@@ -4,7 +4,7 @@
 -- |
 -- Module:      Database.SQLite.Simple.FromRow
 -- Copyright:   (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
diff --git a/Database/SQLite/Simple/Internal.hs b/Database/SQLite/Simple/Internal.hs
--- a/Database/SQLite/Simple/Internal.hs
+++ b/Database/SQLite/Simple/Internal.hs
@@ -3,7 +3,7 @@
 -- |
 -- Module:      Database.SQLite.Simple.Internal
 -- Copyright:   (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
diff --git a/Database/SQLite/Simple/Ok.hs b/Database/SQLite/Simple/Ok.hs
--- a/Database/SQLite/Simple/Ok.hs
+++ b/Database/SQLite/Simple/Ok.hs
@@ -5,7 +5,7 @@
 -- |
 -- Module:     Database.SQLite.Simple.Ok
 -- Copyright:  (c) 2012 Leon P Smith
---             (c) 2012 Janne Hellsten
+--             (c) 2012-2013 Janne Hellsten
 -- License:    BSD3
 -- Maintainer: Janne Hellsten <jjhellst@gmail.com>
 -- Stability:  experimental
diff --git a/Database/SQLite/Simple/ToField.hs b/Database/SQLite/Simple/ToField.hs
--- a/Database/SQLite/Simple/ToField.hs
+++ b/Database/SQLite/Simple/ToField.hs
@@ -6,7 +6,7 @@
 -- Module:      Database.SQLite.Simple.ToField
 -- Copyright:   (c) 2011 MailRank, Inc.
 --              (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
diff --git a/Database/SQLite/Simple/ToRow.hs b/Database/SQLite/Simple/ToRow.hs
--- a/Database/SQLite/Simple/ToRow.hs
+++ b/Database/SQLite/Simple/ToRow.hs
@@ -3,7 +3,7 @@
 -- Module:      Database.SQLite.Simple.ToRow
 -- Copyright:   (c) 2011 MailRank, Inc.
 --              (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
diff --git a/Database/SQLite/Simple/Types.hs b/Database/SQLite/Simple/Types.hs
--- a/Database/SQLite/Simple/Types.hs
+++ b/Database/SQLite/Simple/Types.hs
@@ -5,7 +5,7 @@
 -- Module:      Database.SQLite.Simple.Types
 -- Copyright:   (c) 2011 MailRank, Inc.
 --              (c) 2011-2012 Leon P Smith
---              (c) 2012 Janne Hellsten
+--              (c) 2012-2013 Janne Hellsten
 -- License:     BSD3
 -- Maintainer:  Janne Hellsten <jjhellst@gmail.com>
 -- Stability:   experimental
diff --git a/sqlite-simple.cabal b/sqlite-simple.cabal
--- a/sqlite-simple.cabal
+++ b/sqlite-simple.cabal
@@ -1,5 +1,5 @@
 Name:                sqlite-simple
-Version:             0.4.1.0
+Version:             0.4.2.0
 Synopsis:            Mid-Level SQLite client library
 Description:
     Mid-level SQLite client library, based on postgresql-simple.
@@ -15,7 +15,7 @@
 Maintainer:          Janne Hellsten <jjhellst@gmail.com>
 Copyright:           (c) 2011 MailRank, Inc.,
                      (c) 2011-2012 Leon P Smith,
-                     (c) 2012 Janne Hellsten
+                     (c) 2012-2013 Janne Hellsten
 Homepage:            http://github.com/nurpax/sqlite-simple
 bug-reports:         http://github.com/nurpax/sqlite-simple/issues
 Category:            Database
@@ -41,7 +41,7 @@
     base < 5,
     bytestring >= 0.9,
     containers,
-    direct-sqlite >= 2.3.3 && < 2.4,
+    direct-sqlite >= 2.3.4 && < 2.4,
     text >= 0.11,
     time,
     old-locale >= 1.0.0.0,
diff --git a/test/Errors.hs b/test/Errors.hs
--- a/test/Errors.hs
+++ b/test/Errors.hs
@@ -4,6 +4,7 @@
     testErrorsColumns
   , testErrorsInvalidParams
   , testErrorsWithStatement
+  , testErrorsColumnName
   ) where
 
 import Prelude hiding (catch)
@@ -27,8 +28,13 @@
 assertSQLErrorCaught :: IO a -> Assertion
 assertSQLErrorCaught action = do
   catch (action >> return False) (\(_ :: SQLError) -> return True) >>=
-    assertBool "assertErrorError exc"
+    assertBool "assertSQLError exc"
 
+assertOOBCaught :: IO a -> Assertion
+assertOOBCaught action = do
+  catch (action >> return False) (\(_ :: ArrayException) -> return True) >>=
+    assertBool "assertOOBCaught exc"
+
 testErrorsColumns :: TestEnv -> Test
 testErrorsColumns TestEnv{..} = TestCase $ do
   execute_ conn "CREATE TABLE cols (id INTEGER PRIMARY KEY, t TEXT)"
@@ -76,3 +82,10 @@
   assertSQLErrorCaught $
     withStatement conn "SELECT id, t, t1 FROM invstat" $ \_stmt ->
       assertFailure "Error not detected"
+
+testErrorsColumnName :: TestEnv -> Test
+testErrorsColumnName TestEnv{..} = TestCase $ do
+  execute_ conn "CREATE TABLE invcolumn (id INTEGER PRIMARY KEY, t TEXT)"
+  assertOOBCaught $
+    withStatement conn "SELECT id FROM invcolumn" $ \stmt ->
+      columnName stmt (ColumnIndex (-1)) >> assertFailure "Error not detected"
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -31,6 +31,7 @@
     , TestLabel "Errors"    . testErrorsColumns
     , TestLabel "Errors"    . testErrorsInvalidParams
     , TestLabel "Errors"    . testErrorsWithStatement
+    , TestLabel "Errors"    . testErrorsColumnName
     , TestLabel "Utf8"      . testUtf8Simplest
     , TestLabel "Utf8"      . testBlobs
     , TestLabel "Instances" . testUserFromField
