|
From: Colin P. A. <co...@co...> - 2009-09-28 17:20:13
|
>>>>> "Justin" == Justin Bailey <jgb...@gm...> writes:
The type used is not determined by HaskellDB. Your application
Justin> determines the type it expects, and the appropriate
Justin> Convertible instance is selected. If that doesn't make
Justin> sense, what I mean is the type signature of your result
Justin> determines the type to which the value will be
Justin> converted. For example, if your function is named
Justin> "getTimestampRows", you can control the type converted to
Justin> via it's signature:
Justin> getTimestampRows :: IO [Record (Col1 (Expr Day)) ... )]
Justin> or
Justin> getTimestampRows :: IO [Record (Col1 (Expr ZonedTime))
Justin> ... )]
Justin> or
Justin> getTimestampRows :: IO [Record (Col1 (Expr UTCTime))
Justin> ... )]
Justin> Does that help?
Not really, as I am not actually requesting that column (not
intentioanlly, anyway).
Probably I have got the project call wrong. My code looks like this:
let q = do
t <- DB.table IT.imageTable
DB.project (IT.indexNumber DB.<< t DB.! IT.indexNumber)
DB.order [DB.desc t IT.indexNumber]
return t
rs <- DB.query db q
let nextIndex = case null rs of
True -> 1
False -> 1 + (head rs DB.! IT.indexNumber)
I can't say that I could understand the project function from the
examples I saw. Mu intention was just to retrieve the indexNumber
column, which is defined as an integerT in the FieldDesc.
--
Colin Adams
Preston Lancashire
|