Add support for storing role and meta data as json #9

Merged
merged 1 commit into from Feb 22, 2013

Conversation

Projects
None yet
2 participants
@alexanderkjeldaas
Contributor

alexanderkjeldaas commented Feb 22, 2013

This is the branch with your 'Text' changes.
I've added tests, but they actually fail with this version. I have verified that the tests pass with the ByteString version.

Encode empty roles/meta data as NULLs in the database

Favor using Data.Text over ByteStrings for storing JSON text in the
database.

This patch requires the latest sqlite-simple version from github.
This will be released shortly on hackage.

Add support for storing role and meta data as json
Encode empty roles/meta data as NULLs in the database

Favor using Data.Text over ByteStrings for storing JSON text in the
database.

This patch requires the latest sqlite-simple version from github.
This will be released shortly on hackage.
@nurpax

This comment has been minimized.

Show comment Hide comment
@nurpax

nurpax Feb 22, 2013

Indeed, I get the same test failures too. I'll dig into this this evening.

nurpax commented on 88d538d Feb 22, 2013

Indeed, I get the same test failures too. I'll dig into this this evening.

@nurpax

This comment has been minimized.

Show comment Hide comment
@nurpax

nurpax Feb 22, 2013

Owner

BTW - there's one more way to trace what's going on.. You can turn on sqlite-simple tracing on with this patch:

nurpax:~/dev/snaplet-sqlite-simple$ git diff
diff --git a/src/Snap/Snaplet/SqliteSimple.hs b/src/Snap/Snaplet/SqliteSimple.hs
index cf5a73c..8b7baa0 100644
--- a/src/Snap/Snaplet/SqliteSimple.hs
+++ b/src/Snap/Snaplet/SqliteSimple.hs
@@ -95,6 +95,7 @@ import           Control.Monad.Trans.Writer
 import qualified Data.Configurator as C
 import           Data.List
 import           Data.Maybe
+import qualified Data.Text as T
 import           Database.SQLite.Simple.ToRow
 import           Database.SQLite.Simple.FromRow
 import qualified Database.SQLite.Simple as S
@@ -166,6 +167,7 @@ sqliteInit = makeSnaplet "sqlite-simple" description datadir $ do
     let ci = fromMaybe (error $ intercalate "\n" errs) mci

     conn <- liftIO $ (S.open ci >>= newMVar)
+    liftIO $ withMVar conn (\c -> S.setTrace c (Just (\s -> putStrLn . T.unpack $ s)))
     return $ Sqlite conn
Owner

nurpax commented Feb 22, 2013

BTW - there's one more way to trace what's going on.. You can turn on sqlite-simple tracing on with this patch:

nurpax:~/dev/snaplet-sqlite-simple$ git diff
diff --git a/src/Snap/Snaplet/SqliteSimple.hs b/src/Snap/Snaplet/SqliteSimple.hs
index cf5a73c..8b7baa0 100644
--- a/src/Snap/Snaplet/SqliteSimple.hs
+++ b/src/Snap/Snaplet/SqliteSimple.hs
@@ -95,6 +95,7 @@ import           Control.Monad.Trans.Writer
 import qualified Data.Configurator as C
 import           Data.List
 import           Data.Maybe
+import qualified Data.Text as T
 import           Database.SQLite.Simple.ToRow
 import           Database.SQLite.Simple.FromRow
 import qualified Database.SQLite.Simple as S
@@ -166,6 +167,7 @@ sqliteInit = makeSnaplet "sqlite-simple" description datadir $ do
     let ci = fromMaybe (error $ intercalate "\n" errs) mci

     conn <- liftIO $ (S.open ci >>= newMVar)
+    liftIO $ withMVar conn (\c -> S.setTrace c (Just (\s -> putStrLn . T.unpack $ s)))
     return $ Sqlite conn

nurpax added a commit that referenced this pull request Feb 22, 2013

Merge pull request #9 from alexanderkjeldaas/support_roles_and_meta_s…
…quash

Add support for storing role and meta data as json

@nurpax nurpax merged commit 704f9ff into nurpax:master Feb 22, 2013

1 check failed

default The Travis build could not complete due to an error
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment