[Haskell-cafe] Re: Oracle + Haskell advice?

Brian Strand bstrand at switchmanagement.com
Fri Aug 19 15:10:50 EDT 2005

Bayley, Alistair wrote:
>>From: Brian Strand [mailto:bstrand at switchmanagement.com] 
>>So far Takusen is working great (once I figured out the 
>>proper incantations 
>>for getting "select * from dual" working, things went much 
>>faster...).  We 
>>don't currently use LOBs, and very rarely call stored 
>>procedures, so there's a 
>>happy match between Takusen's missing features and our unused 
>>features ;)  One 
>>thing we do use extensively is bind parameters; do you have 
>>any hints on 
>>getting doQueryBind working, or pointers on what's left to do 
>>there?  And is 
>>the version in CVS on sf.net a good place to start?
> Hmm... I assume that you're using the experimental version from CVS, as
> you've mentioned doQueryBind, which is not in the Main branch. What problems
> are you having with bind parameters?
> Have you seen the tests in Database.Test.Enumerator? Specifically, the
> selectBindInt and selectBindDate functions demonstrate simple usage of bind
> parameters.

Actually, I just checked out haskell-libs from cvs.sf.net, and saw doQueryBind 
in the Takusen docs but couldn't find an implementation (that was the problem 
I was having with bind parameters).  Checking out the experimental branch 
clears things right up!

> There are a couple of implementation notes which might affect you:
>  - I think you have to specify the type of the bind parameter list (i.e.
> help the type-checker)
>  - user modules (like Database.Test.Enumerator) probably need to specify
> these pragmas:
>      {-# OPTIONS -fglasgow-exts #-}
>      {-# OPTIONS -fallow-overlapping-instances #-}
>  - bind parameters are specified with ?'s, and we convert those to the
> Oracle :x syntax. I think you should be able to use the :x syntax too
> though; I believe it will be passed through unmolested.
> Reviewing at the bind variable code has highlighted a glaring design flaw:
> you can only pass homogenous lists of bind values! We originally had a
> design where you passed a list of bind actions (a monadic action which
> returned ()). I think that in my zeal to reduce programmer effort I have
> reduced this to a list of values (to which we apply the bind action in the
> library). Maybe that's what's biting you... I'd better get onto that
> sharpish.

I was wondering about that; I thought maybe you just passed everything to OCI 
as String and let Oracle sort it out, but that doesn't seem very Haskell-ish.


More information about the Haskell-Cafe mailing list