[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] problem with sqlite constraints and orm



Is there a more current option people are using for working with a
database? I'd be happy to poke at the orm code in the longer term, but
I also want to get on with writing my actual app :)

martin

On Wed, Apr 1, 2015 at 12:53 AM, Thomas Gazagnaire
<thomas@xxxxxxxxxxxxxx> wrote:
> Hi Martin,
>
> I haven't touched at the code of mirage/orm for a very long time (2.5y!) but
> I'm not very surprised you can still find bugs in it: the code is quite
> fragile (too much camlp4 for its own good) and (mainly) works only because
> of the relatively large test-suite. But patches are always very welcome!
>
> Thanks,
> Thomas
>
>
> On 30 Mar 2015, at 12:20, Martin DeMello <martindemello@xxxxxxxxx> wrote:
>
> Problem demonstrated below: violating a unique constraint in sqlite3 seems
> to leave things in an inconsistent state.
>
> Also, tangentially, I discovered this while trying to maintain my own id on
> a table because my app is serving json objects over a rest api, and I need
> some sort of unique id for clients to be able to send updates to existing
> objects. If there were a way to have the autogenerated sql __id__ column be
> a record field, that would be extremely useful.
>
> martin
>
> $ cat db.ml
> type item = {
>   id: int;
> } with orm (
>   unique: item<id>
> )
>
> let db_name = "test.db"
>
> $ cat init_db.ml
> open Db
>
> let _ =
>   let db = item_init Db.db_name in
>   let item = {
>     id = 1;
>   } in
>   item_save db item
>
>
> $ ./init_db.native
> $ ./init_db.native
> Fatal error: exception Sqlite3.Error("CONSTRAINT")
>
> $ sqlite3 test.db
> sqlite> select * from item;
> __id__      id
> ----------  ----------
> 1           1
> 2
> sqlite> delete from item;
> Error: no such function: SYNC_CACHE_item
>
> _______________________________________________
> MirageOS-devel mailing list
> MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
>
>

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.