Questions tagged [hdbc]

HDBC, Haskell Database Connectivity, is a Haskell library for connecting to and querying relational database management systems. The library provides a uniform interface to several common RDBMSs through the use of pluggable back ends.

59 questions
0
votes
0 answers

HDBC ODBC fetchAllRows returns SqlError

I'm trying to get a simple haskell program to talk to a MySQL database. The program builds properly, but when I run the program, I get about half of the output from the first query, and then the following error which I'm having difficulty…
Ouyang Ze
  • 490
  • 4
  • 8
0
votes
1 answer

Haskell, HDBC.Sqlite3 - How to add a column if it doesn't exist already?

I have a function that given an Int returns a list of lists of Strings. fetchParts :: Int -> [[String]] This is what the output looks like [["title", "some title"], ["rate", "2.4"], ["dist", "some string"], ["tr", "1"], ["td, "2"] ..]] The length of…
atis
  • 881
  • 5
  • 22
0
votes
1 answer

Haskell HDBC library: Is there an elegant way to convert between [SqlValue] and records?

Since I can't map over a record, the best method I have found is to just use brute force: data Item = Item { vendor :: Int, lotNumber :: Int, description :: String, reserve :: Maybe Double, preSaleBids :: Maybe Double, salePrice :: Maybe…
James
  • 104
  • 1
  • 8
0
votes
0 answers

How to Read XML as Objects and Write to MySQL using Haskell

I have several XML files of the following format in path location: enter image description here 1 One 1
harshainfo
  • 504
  • 7
  • 11
0
votes
1 answer

Sequencing queries for MS SQL with HDBC-ODBC

What is the proper way to use a single connection and run multiple queries when connecting to MS SQL server from Haskell? import qualified Database.HDBC as DB import qualified Database.HDBC.ODBC as DB import Data.Time.Calendar (fromGregorian) import…
bkc
  • 1
  • 2
0
votes
0 answers

How can I prepare a database query for multiple items in HDBC?

I have a Sqlite table called text that has colums id and text. I want to get these values out for every row from a list of ids, using HDBC and Haskell. In the sqlite3 command-line program, I can run the query: select id, text from text where id in…
Jonathan
  • 10,571
  • 13
  • 67
  • 103
0
votes
0 answers

How do I connect Haskell HDBC to an oracle db on osx

I was wondering how you are supposed to connect to an oracle db on mac with Haskell HDBC. I tried doing it through ODBC, by running brew install unixobcd and then installing oracle instant client basic and obdc into a directory. Then in Haskell,…
semicolon
  • 2,530
  • 27
  • 37
0
votes
1 answer

HDBC-ODBC with MS Access 2016

I am unable to understand the error I am getting when I try to connect to a MS access database file λ: :m + Database.HDBC Database.HDBC.ODBC λ: let connectionString = "DBQ=c:\\Users\\user\\Desktop\\Database1.accdb;Driver={Microsoft Access Driver…
matt
  • 1,817
  • 14
  • 35
0
votes
2 answers

HDBC-postgreSQL bytea fields get returned as SqlByteString hex strings

When I select bytea fields filled with binary data in my Postgres database using the HDBC-postgreSQL driver (version 2.3.2.3), they come out as: SqlByteString "\x" That is, it returns a ByteString which contains a…
Thomas
  • 3,321
  • 1
  • 21
  • 44
0
votes
1 answer

Build connection with HaskellDB.HDBC.Odbc

I'm new to Haskell. I've read most of LYAH and RWH and have also done some small programms. No I would like to use Haskell with an Oracle DB. I would like to use HaskellDB with HDBC.ODBC. I was able to connect to the DB via HDBC and run a query. But…
user3535953
  • 143
  • 6
0
votes
1 answer

Retrieving values from SQLite3 Database for Scotty

I'm trying to get information from a SQLite DB (HDBC.sqlite3) to feed to a web view using the Scotty framework. I'm currently trying to complete a "grab all" or rather select all the information from the table and then return it to display on my…
Sleep Deprived Bulbasaur
  • 2,368
  • 4
  • 21
  • 33
0
votes
1 answer

Submitting multiple SQL statements strictly to SQLite in a single transaction from Haskell HDBC

My Haskell skills are very much in it's infancy, and monads puzzle me. However, I need to construct a function that will install all the fixtures in a sqlite3 database. module UmeQuery where import Database.HDBC import…
Fredrik Karlsson
  • 485
  • 8
  • 21
0
votes
1 answer

HDBC and multiple resultsets in a single statement: only first resultset returned

I'm looking for a way for HDBC to support multiple resultsets in a single statement testMultipleResultsetSingleStatement = do let sql = "select 1,2,3 union all select 2,3,4 select 'a', 'b'" c <- connectODBC connectionString rs <- quickQuery c…
smoothdeveloper
  • 1,972
  • 18
  • 19
0
votes
1 answer

Add multiple entries from within a program to an SQLite3 database with HDBC / Haskell

I'm trying to use Database.HDBC and Database.HDBC.Sqlite3. To add tables to an SQLite3 database, this is the kind of command I'd enter into GHCI: run conn "CREATE TABLE table1 (a INTEGER)" [] I'd like to now use a list of strings to add table names…
subtlearray
  • 1,251
  • 1
  • 11
  • 23
1 2 3
4