On 10/24/07, Gaetan de Menten <[EMAIL PROTECTED]> wrote: > What breaks your example has nothing to do with Elixir. It left me > puzzled for a bit, but it seems like an in-memory sqlite database > can't be shared between several threads, hence the error (in the > second thread, the table doesn't exist). Try using a file, or another > DB.
Hooray! Changing to a SQLite file db solved the problem. I could swear I tried that early on in the debugging process (perhaps something else was broken at that point). > Other than that, you don't need to bind both the sesion and the > metadata. It's usually one or the other. And I suggest you use an > explicit setup_all() call (see the upgrade notes on the Wiki), because > even if your code works here (after resolving the sqlite problem), you > might run into strange problems if the setup is triggered at a bad > time (for example in two different threads at the same time). I've removed the session binding for now, although I may return to it later (since it's vaguely possible that later different threads will want to bind to different engines and if I'm understanding things correctly, the metadata binding won't allow that). Re setup_all(): Thankfully I have control over the main thread in the real application and the binding and init are currently called from that. However, better to do things properly, so I've added setup_all() at the bottom of the module with the entities. > Hope this helps, It does. :) Schiavo Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
