Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of complete.org:git/hdbc into debian

  • Loading branch information...
commit c4ba3ed6533216cb5b4c1d436ac9e39761cfb21d 2 parents 6c95d7f + a67f2fe
@jgoerzen jgoerzen authored
View
4 Database/HDBC.hs
@@ -51,7 +51,7 @@ module Database.HDBC
-- ** Wrapped Connections
ConnWrapper(..), withWConn,
-- ** Preparing Queries
- run, sRun, prepare, quickQuery', quickQuery,
+ run, runRaw, sRun, prepare, quickQuery', quickQuery,
-- ** Transaction Handling
-- $transactions
@@ -65,7 +65,7 @@ module Database.HDBC
-- * Statements
Statement,
-- ** Execution
- execute, sExecute, executeMany, sExecuteMany,
+ execute, executeRaw, sExecute, executeMany, sExecuteMany,
-- ** Fetching Results
fetchRow, fetchRowAL, fetchRowMap, sFetchRow,
fetchAllRows, fetchAllRows', fetchAllRowsAL, fetchAllRowsAL',
View
13 Database/HDBC/SqlValue.hs
@@ -582,6 +582,9 @@ instance Convertible SqlValue Rational where
safeConvert (SqlTimeDiff x) = return . fromIntegral $ x
safeConvert y@(SqlNull) = quickError y
+#if __GLASGOW_HASKELL__ >= 610
+-- instances added in GHC 6.10.3
+#else
instance Typeable Day where
typeOf _ = mkTypeName "Day"
instance Typeable TimeOfDay where
@@ -590,14 +593,16 @@ instance Typeable LocalTime where
typeOf _ = mkTypeName "LocalTime"
instance Typeable ZonedTime where
typeOf _ = mkTypeName "ZonedTime"
-instance Typeable ST.ClockTime where
- typeOf _ = mkTypeName "ClockTime"
-instance Typeable ST.TimeDiff where
- typeOf _ = mkTypeName "TimeDiff"
instance Typeable DiffTime where
typeOf _ = mkTypeName "DiffTime"
instance Typeable TimeZone where
typeOf _ = mkTypeName "TimeZone"
+#endif
+
+instance Typeable ST.ClockTime where
+ typeOf _ = mkTypeName "ClockTime"
+instance Typeable ST.TimeDiff where
+ typeOf _ = mkTypeName "TimeDiff"
instance Convertible Day SqlValue where
safeConvert = return . SqlLocalDate
View
7 Database/HDBC/Statement.hs
@@ -32,6 +32,13 @@ data Statement = Statement
-}
execute :: [SqlValue] -> IO Integer,
+ {- | Execute the statement as-is, without supplying any
+ positional parameters. This is intended for statements for
+ which the results aren't interesting or present (e.g., DDL or
+ DML commands). If your query contains placeholders, this will
+ certainly fail; use 'execute' instead. -}
+ executeRaw :: IO (),
+
{- | Execute the query with many rows.
The return value is the return value from the final row
as if you had called 'execute' on it.
View
10 Database/HDBC/Types.hs
@@ -48,6 +48,7 @@ where
import Database.HDBC.Statement
import Database.HDBC.SqlValue
import Database.HDBC.ColTypes
+import Control.Exception ( finally )
{- | Main database handle object.
@@ -91,6 +92,15 @@ and vary by database. So don't do it.
{- | Roll back to the state the database was in prior to the
last 'commit' or 'rollback'. -}
rollback :: conn -> IO ()
+ {- | Execute an SQL string, which may contain multiple
+ queries. This is intended for situations where you
+ need to run DML or DDL queries and aren't
+ interested in results. -}
+ runRaw :: conn -> String -> IO ()
+ runRaw conn sql = do
+ sth <- prepare conn sql
+ execute sth [] `finally` finish sth
+ return ()
{- | Execute a single SQL query. Returns the number
of rows modified (see 'execute' for details).
The second parameter is a list
View
4 HDBC.cabal
@@ -1,5 +1,5 @@
Name: HDBC
-Version: 2.1.0
+Version: 2.1.1
License: LGPL
Maintainer: John Goerzen <jgoerzen@complete.org>
Author: John Goerzen
@@ -26,7 +26,7 @@ flag buildtests
library
if flag(splitBase)
- Build-Depends: base>=3, old-time, time, bytestring, containers, old-locale
+ Build-Depends: base>=3, old-time, time>=1.1.2.4, bytestring, containers, old-locale
else
Build-Depends: base<3
Build-Depends: mtl, convertible >= 1.0.1, utf8-string
Please sign in to comment.
Something went wrong with that request. Please try again.