packages feed

mysql 0.1.7.3 → 0.2.1

raw patch · 4 files changed

Files

ChangeLog.md view
@@ -1,3 +1,15 @@+## 0.2.1++* Work around incorrect test for header-file definition of MYSQL_TYPE_JSON (#45 and 51464fa)++## 0.2.0.1++* Make connection finalizer thread safe (#28).++## 0.2++* Remove obsolete `fieldDefault` from `data Field` (#41).+ ## 0.1.7.3  * Fix error on certain systems introduced by the change in (#40): some implementations of `mysql_config` do not recognise `--libs-sys`, yet return a zero status for attempts to use it.
Database/MySQL/Base.hs view
@@ -85,6 +85,7 @@     ) where  import Control.Applicative ((<$>), (<*>))+import Control.Concurrent (rtsSupportsBoundThreads, runInBoundThread) import Control.Exception (Exception, throw) import Control.Monad (forM_, unless, when) import Data.ByteString.Char8 ()@@ -300,7 +301,11 @@         cleanupConnResult res         wasClosed <- atomicModifyIORef closed $ \prev -> (True, prev)         unless wasClosed $ mysql_close ptr-  fp <- newForeignPtr ptr realClose+  -- In general, the user of this library is responsible for dealing with thread+  -- safety. However, the programmer has no control over the OS thread+  -- finalizers are run from so we use 'runInBoundThread' and 'initThread' here.+  let myRunInBoundThread = if rtsSupportsBoundThreads then runInBoundThread else id+  fp <- newForeignPtr ptr (myRunInBoundThread $ initThread >> realClose)   return Connection {                connFP = fp              , connClose = realClose
Database/MySQL/Base/Types.hsc view
@@ -69,6 +69,15 @@ type MYSQL_ROW_OFFSET = Ptr MYSQL_ROWS type MyBool = CChar +-- "mysql.h" defines the `MYSQL_TYPE_...` symbols as values of an enumeration,+-- not as preprocessor symbols.  Therefore we can't test for the presence of+-- `MYSQL_TYPE_JSON` using `#ifdef` or `#if defined()`, yet it is not available+-- in all versions of MySQL and MariaDB.  Although this is very unsatisfactory,+-- we have little alternative but to define it here.+--+mysql_type_json :: Int+mysql_type_json = 245+ -- | Column types supported by MySQL. data Type = Decimal           | Tiny@@ -132,9 +141,7 @@       , ((#const MYSQL_TYPE_VAR_STRING), VarString)       , ((#const MYSQL_TYPE_STRING), String)       , ((#const MYSQL_TYPE_GEOMETRY), Geometry)-#if defined(MYSQL_TYPE_JSON)-      , ((#const MYSQL_TYPE_JSON), Json)-#endif+      , (mysql_type_json, Json)       ]  -- | A description of a field (column) of a table.@@ -145,7 +152,6 @@     , fieldOrigTable :: ByteString -- ^ Original table name, if table was an alias.     , fieldDB :: ByteString        -- ^ Database for table.     , fieldCatalog :: ByteString   -- ^ Catalog for table.-    , fieldDefault :: Maybe ByteString   -- ^ Default value.     , fieldLength :: Word          -- ^ Width of column (create length).     , fieldMaxLength :: Word    -- ^ Maximum width for selected set.     , fieldFlags :: FieldFlags        -- ^ Div flags.@@ -216,9 +222,6 @@    <*> peekS ((#peek MYSQL_FIELD, org_table)) ((#peek MYSQL_FIELD, org_table_length))    <*> peekS ((#peek MYSQL_FIELD, db)) ((#peek MYSQL_FIELD, db_length))    <*> peekS ((#peek MYSQL_FIELD, catalog)) ((#peek MYSQL_FIELD, catalog_length))-   <*> (if flags `hasAllFlags` flagNoDefaultValue-       then pure Nothing-       else Just <$> peekS ((#peek MYSQL_FIELD, def)) ((#peek MYSQL_FIELD, def_length)))    <*> (uint <$> (#peek MYSQL_FIELD, length) ptr)    <*> (uint <$> (#peek MYSQL_FIELD, max_length) ptr)    <*> pure flags
mysql.cabal view
@@ -1,5 +1,5 @@ name:           mysql-version:        0.1.7.3+version:        0.2.1 homepage:       https://github.com/paul-rouse/mysql bug-reports:    https://github.com/paul-rouse/mysql/issues synopsis:       A low-level MySQL client library.