Skip to content

Commit

Permalink
Add columnCount function
Browse files Browse the repository at this point in the history
  • Loading branch information
Shimuuar committed Feb 13, 2017
1 parent 64c5287 commit 54d4af6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Database/SQLite/Simple.hs
Expand Up @@ -90,6 +90,7 @@ module Database.SQLite.Simple (
, bindNamed
, reset
, columnName
, columnCount
, withBind
, nextRow
-- ** Exceptions
Expand Down Expand Up @@ -246,6 +247,10 @@ columnName (Statement stmt) (ColumnIndex n) = BaseD.columnName stmt n >>= takeUt
takeUtf8 Nothing =
throwIO (IndexOutOfBounds ("Column index " ++ show n ++ " out of bounds"))

-- | Return number of columns in the query
columnCount :: Statement -> IO ColumnIndex
columnCount (Statement stmt) = ColumnIndex <$> BaseD.columnCount stmt

-- | Binds parameters to a prepared statement, and 'reset's the statement when
-- the callback completes, even in the presence of exceptions.
--
Expand Down

0 comments on commit 54d4af6

Please sign in to comment.