[web-devel] Yesod, Sqlite, Enabling Foreign Key Support

Anton Cheshkov acheshkov at gmail.com
Tue Apr 26 17:47:38 CEST 2011


Ok.

I recompiled persistent with new changes. All works how i want and expect.
But now   *insertBy* function are not so safe as earlier.

*The insertBy function* checks only unique constrains defined on yesod
framework level via Unique... constructions  .
Now  *insertBy* function throws exception if we try to insert 'bad' value to
column with foreign constraint.

Please show me how to catch exception.
I think it would something like:
*
*
*import qualified Control.Exception.Control as E*
*...*
*do*
*   res <- runDB $ E.catch (insertBy offer) (\_ -> return Left ())*

But my exception handler is wrong.


Thanks.

2011/4/26 Greg Weber <greg at gregweber.info>

> Thanks!
>
> Please send a pull request to Michael.
>
> On Tue, Apr 26, 2011 at 5:58 AM, Anton Cheshkov <acheshkov at gmail.com>wrote:
>
>> I have pushed branch to fix it. probably it should be helpful.
>> https://github.com/acheshkov/persistent
>>
>> <https://github.com/acheshkov/persistent>Thanks.
>>
>>
>> 2011/4/26 Anton Cheshkov <acheshkov at gmail.com>
>>
>>> Hi Michael.
>>>
>>> Please show the way to enable foreign key support from sqlite connection.
>>>
>>> Now foreign key constrints does not work for sqlite from Yesod.
>>>
>>> Thanks.
>>>
>>>
>>> http://www.sqlite.org/foreignkeys.html
>>>
>>> --
>>> Best regards,
>>> Cheshkov Anton
>>> Phone: +7 909 005 18 82
>>> Skype: cheshkov_anton
>>>
>>
>>
>>
>> --
>> Best regards,
>> Cheshkov Anton
>> Phone: +7 909 005 18 82
>> Skype: cheshkov_anton
>>
>> _______________________________________________
>> web-devel mailing list
>> web-devel at haskell.org
>> http://www.haskell.org/mailman/listinfo/web-devel
>>
>>
>


-- 
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110426/bae0d623/attachment.htm>


More information about the web-devel mailing list