{"id":16343439,"url":"https://github.com/ryantm/hdbc-mysql","last_synced_at":"2025-06-25T19:03:33.089Z","repository":{"id":59150741,"uuid":"1662974","full_name":"ryantm/hdbc-mysql","owner":"ryantm","description":"This package provides a MySQL driver for Haskell's HDBC library, implemented via bindings to the C mysqlclient library.  ","archived":false,"fork":false,"pushed_at":"2020-05-18T16:07:46.000Z","size":161,"stargazers_count":30,"open_issues_count":9,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-21T22:53:42.860Z","etag":null,"topics":["driver","haskell","hdbc-mysql","mysql-server"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryantm.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-04-26T03:27:47.000Z","updated_at":"2022-11-15T18:15:21.000Z","dependencies_parsed_at":"2022-09-13T11:00:26.155Z","dependency_job_id":null,"html_url":"https://github.com/ryantm/hdbc-mysql","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/ryantm/hdbc-mysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryantm%2Fhdbc-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryantm%2Fhdbc-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryantm%2Fhdbc-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryantm%2Fhdbc-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryantm","download_url":"https://codeload.github.com/ryantm/hdbc-mysql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryantm%2Fhdbc-mysql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261937020,"owners_count":23232843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["driver","haskell","hdbc-mysql","mysql-server"],"created_at":"2024-10-11T00:24:33.030Z","updated_at":"2025-06-25T19:03:33.059Z","avatar_url":"https://github.com/ryantm.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HDBC-mysql\n\nThis is a \"native\" HDBC driver for MySQL that makes use of\nlibmysqlclient to communicate with a MySQL server.  By way of\nsynopsis:\n\n```haskell\nimport Control.Monad\nimport Database.HDBC\nimport Database.HDBC.MySQL\nmain = do conn \u003c- connectMySQL defaultMySQLConnectInfo {\n                       mysqlHost     = \"db1.example.com\",\n                       mysqlUser     = \"scott\",\n                       mysqlPassword = \"tiger\"\n                    }\n\n          rows \u003c- quickQuery' conn \"SELECT 1 + 1\" []\n          forM_ rows $ \\row -\u003e putStrLn $ show row\n```\n\nAt the moment, please consider this to be \"alpha\" software.  As far as\nI can tell, it works.  There are some limitations that you should be\naware of.\n\n## Caveats\n\n\n  * This works with MySQL server and client libraries 5.0.75.  I\n    haven't tried with 4.x nor 5.1.  I suspect that using a server\n    version less than 4.1 won't work, due to lack of support for\n    prepared statements.\n\n  * MySQL DATETIME and TIMESTAMP columns have no time zone information,\n    because they just don't.  So, I'm just converting them blindly to\n    SqlEpochTime values, and assuming the times are UTC.  This is all\n    fine if you're actually running your server in UTC, but it will\n    probably be confusing if you're not.  It might be possible to\n    interpret the times using the current connection's default\n    time zone setting, instead.  Is that better?  Or worse?\n\n  * Regardless, the types I convert to are now deprecated, and I need\n    to implement the new types (SqlLocalDate, etc.)\n\n  * Out of the box, MySQL probably uses MyISAM tables to store its\n    data, and MyISAM tables don't support transactions.  Yet, I'm\n    going to blindly respond \"yes\" if you ask whether the driver\n    itself supports transactions, and assume that you know enough to\n    use InnoDB tables in the database if you want to make use of\n    HDBC's transactional support.  I *suppose* I might be able to\n    discover what the default table type is, and say \"no\" if it's not\n    a table type that supports transactions, but... meh.\n\n  * I'm not sure that I can tell the difference between a MySQL TEXT\n    and a MySQL BLOB column.  If you ask about the metadata of either,\n    I'll tell you it's a SqlBinaryT.\n\n  * The statement and table metadata could stand to be improved a bit.\n    In particular, it would be nice if \"describeTable foo\" and\n    \"describeResults\" on \"SELECT * FROM foo\" returned the same thing.\n    (They're sorta close, I guess...)\n\n  * Thread-safety could be an issue.  In the driver code, there's\n    definitely a race condition between \"prepare\" and \"disconnect\",\n    for example.  I haven't even *looked* at thread-safety issues for\n    the MySQL driver.  I'm not sure if I should worry about it, or if\n    we assume that's going to be dealt with at a higher level.\n\n  * We might crash if someone opens a connection, prepares a\n    statement, explicitly disconnects the connection, and then tries\n    to play with the statement.\n\n  * It probably makes sense to marshall to the SqlByteString type when\n    retrieving BLOB data.\n\n  * The only supported client charset is `utf8mb4`.\n\n## Testing\n\nThere's a little test program that runs a query and spews out the\nresults.  To compile it,\n\n```\nghc -idist/build -L/opt/local/lib/mysql5/mysql -lmysqlclient --make Test\n```\n\nI'm still trying to get the Makefile right so that it can build the\ntest sources: it's not there yet.  Here's how I've been doing it, for\nnow:\n\n```\ncd testsrc\nghc --make -package HUnit -package HDBC -Wall -i../dist/build -i.. -L/opt/local/lib/mysql5/mysql -lmysqlclient -o runtests runtests.hs\n```\n\nOne issue is that I want the location of the MySQL library to come\nfrom the configuration data, rather than be hard-coded.\n\n## Developing hdbc-mysql with nix\n\n```\n# Nix shell\nnix-shell -p ghc gcc mysql pkgconfig zlib openssl haskellPackages.haddock\n\n# Use Cabal to build\ncabal clean \u0026\u0026 cabal v2-build\n\n# Build test script\nghc -idist/build -L/nix/store/l2yf2p42lqpbkjn428gx9w76dxbhaaga-mariadb-server-10.3.20/lib/ -lmysqlclient --make Test\n\n# Run test script\n./Test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryantm%2Fhdbc-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryantm%2Fhdbc-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryantm%2Fhdbc-mysql/lists"}