haskelldb basic documentation needed
with the release update haskelldb-0.9 -> haskelldb-0.10 several things have changed. Unfortunately the API documentation does not give enough information in generall. Is there any additional uptodate documentation around? In particular the fundamental function "connect" hast a new signature: *connect* :: (forall m a . MonadIO<http://hackage.haskell.org/packages/archive/mtl/1.1.0.0/doc/html/Control-Monad-Trans.html#t%3AMonadIO>m => [( String<http://hackage.haskell.org/packages/archive/base/3.0.0.0/doc/html/Data-Char.html#t%3AString>, String<http://hackage.haskell.org/packages/archive/base/3.0.0.0/doc/html/Data-Char.html#t%3AString>)] -> (Database<file:///usr/share/doc/haskelldb-0.10/Database-HaskellDB-Database.html#t%3ADatabase>-> m a) -> m a) I don't know what pairs of strings this function needs. The API description is to unspecific: The connect<file:///usr/share/doc/haskelldb-0.10/Database-HaskellDB-DriverAPI.html#v%3Aconnect>function takes some driver specific name, value pairs use to setup the
database connection, and a database action to run.
What are the specific name value pairs needed (for a connection to a mysql db )? Immanuel
2008/1/15 Immanuel Normann <immanuel.normann@googlemail.com>:
I don't know what pairs of strings this function needs. The API description is to unspecific:
The connect function takes some driver specific name, value pairs use to
setup the database connection, and a database action to run.
What are the specific name value pairs needed (for a connection to a mysql db )? Immanuel
Your best bet is to download the appropriate drivers - either haskelld-hdbc-mysql or haskelldb-hsql-mysql. If you get the haskelldb sources via darcs, you can also look in the test directory to see how the connections are established. In my specific case, I am using PostgreSQL and by login function looks like this: -- ^ Returns a function which can log into the database and perform operations. login :: MonadIO m => String -> Int -> String -> String -> String -> (Database -> m a) -> m a login server port user password dbname = postgresqlConnect [("host", server), ("port", show port), ("user", user), ("password", password), ("dbname", dbname)]
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
For mysql (via HDBC),some documentation is available here. But it is rather going through HDBC-ODBC-mysql. It is a bit complex than you would normally expect with mysql. http://en.wikibooks.org/wiki/Haskell/Database 2008/1/15 Justin Bailey <jgbailey@gmail.com>:
2008/1/15 Immanuel Normann <immanuel.normann@googlemail.com>:
I don't know what pairs of strings this function needs. The API description is to unspecific:
The connect function takes some driver specific name, value pairs use to setup the database connection, and a database action to run.
What are the specific name value pairs needed (for a connection to a mysql db )? Immanuel
Your best bet is to download the appropriate drivers - either haskelld-hdbc-mysql or haskelldb-hsql-mysql. If you get the haskelldb sources via darcs, you can also look in the test directory to see how the connections are established.
In my specific case, I am using PostgreSQL and by login function looks like this:
-- ^ Returns a function which can log into the database and perform operations. login :: MonadIO m => String -> Int -> String -> String -> String -> (Database -> m a) -> m a login server port user password dbname = postgresqlConnect [("host", server), ("port", show port), ("user", user), ("password", password), ("dbname", dbname)]
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Immanuel Normann -
Justin Bailey -
Steve Lihn