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
1
vote
1 answer

(Unexpected SQL_NO_TOTAL) error on text fields larger than 4096 bytes

I filed a bug report: https://github.com/hdbc/hdbc-odbc/issues/4 But maybe this is not the hdbc-odbc issue, so i'll ask here as well. OS: linux 64 bit (archlinux), ghc-7.4.1, hdbc-odbc-2.3.1.0 Connecting to MS Sql server 2005. Retrieving a text…
Vagif Verdi
  • 4,816
  • 1
  • 26
  • 31
1
vote
1 answer

How do I use postgresqlConnect in the Database.HaskellDB.HDBC.PostgreSQL module?

I am not quite sure how to use the postgresqlConnect function in module Database.HaskellDB.HDBC.PostgreSQL to connect to a PostgreSQL database. The Haddock documentation page only states the type signature: postgresqlConnect :: MonadIO m =>…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
1
vote
0 answers

How to get an SqlUTCTime in Haskell HDBC?

I have a MariaDB database which I query through Haskell HDBC. In it I store a datetime column in UTC time. I would like to retrieve the values as SqlUTCTime and perform the conversion to UTCTime using fromSql. If I retrieve the values directly in…
vkubicki
  • 1,104
  • 1
  • 11
  • 26
1
vote
0 answers

Haskell hdbc-odbc connection to Sybase database only works if trace function is used

I am trying to connect to a Sybase database using hdbc-odbc via unixODBC and freetds. The following lines should be expected to open a connection, prepare a query on it, execute it and disconnect. conn <- connectODBC connectionString statement…
hllizi
  • 41
  • 5
1
vote
1 answer

How to get full(er) table schema with HDBC

HDBC beginner here. I'd like to view schemas for my tables. I know I can use describeTable to get the SqlColDesc for each table, but I'd also like to see primary and foreign keys, which SqlColDesc doesn't contain. Is there a way to access this…
thersites
  • 125
  • 4
1
vote
0 answers

Haskell more elegant conversion from Sql to other types

I have this: import Database.HDBC.Sqlite3 import Database.HDBC For converting fetched rows from a database I use this: convertFromSql :: [SqlValue] -> [String] convertFromSql [name, address, number, postal, city, country] = [cName, cAddress,…
Madderote
  • 1,107
  • 10
  • 19
1
vote
1 answer

Haskell HDBC.Sqlite3 fetchAllRows

Since I am an absolute Haskell beginner, but determined to conquer it, I am asking for help again. using: fetchData2 = do conn <- connectSqlite3 "dBase.db" statement <- prepare conn "SELECT * FROM test WHERE id > 0" execute statement [] …
Madderote
  • 1,107
  • 10
  • 19
1
vote
1 answer

How to pass HTTP request parameter to quickQuery?

I'm using Happstack to receive some parameters from an HTTP request then pass these parameters to a function that will retrieve data from the database and return this data in the HTTP response as follow: myFunc :: IO String myFunc = do r <- look…
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
1
vote
1 answer

How to use "IO String" as an HTTP response in Happstack?

I'm retrieving data from a database using HDBC, then trying to send this data to a web client using Happstack. myFunc :: Integer -> IO String myFunc = ... fetch from db here ... handlers :: ServerPart Response handlers = do decodeBody…
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
1
vote
1 answer

What's the syntax of using multiple handlers in Happstack?

Sorry for my basic question, but I'm new to Haskell. I'm following this example to receive some values from a request body, but my server also serves static files from a directory using the following code: fileServing :: ServerPart…
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
1
vote
1 answer

how to convert SqlByteString to String [HDBC]

I want do something on mysql with hdbc , I want know how can I convert SqlByteString to String? when I try to use fromSql bytestrobj, I got an error :20:1: error: • Non type-variable argument in the constraint:…
Lee Lee Lee
  • 45
  • 10
1
vote
1 answer

Error while connecting to mysql database, haskell

I'm absolutely newbie to haskell, but I need to write a simple application to work with DB. I'm reading realworldhaskell book, chapter about using databases: http://book.realworldhaskell.org/read/using-databases.html. I've installed HDBC and…
andrew_j
  • 41
  • 7
1
vote
1 answer

Scotty Parameters to feed in Sqlite3

I'm trying to create a web site that will get information via URL routes and then pass this information into a HDBC SQLITE3 database. I have figured out how to get the information via parameters using Scotty as well as how to create a database…
Sleep Deprived Bulbasaur
  • 2,368
  • 4
  • 21
  • 33
1
vote
1 answer

"Convertible SqlValue UTCTime" missing?

I was trying to convert a SqlValue into UTCTime like this: import Database.HDBC import Data.Time (UTCTime) getUTCTimeFromSql :: SqlValue -> UTCTime getUTCTimeFromSql time = fromSql time :: UTCTime But GHC complains that I'm missing a Convertible…
Daisuke Shimamoto
  • 5,206
  • 6
  • 32
  • 37
0
votes
1 answer

Retrieve a value from a SQLite INSERT INTO operation

I am building an SQL database with SQLite3 and the Haskell library HDBC to connect to the database from my program. It's used for tracking sales of products (ie. on an EPOS). The schema is roughly like this, amended for brevity: create table…
Lilly Cham
  • 1
  • 1
  • 3