[erlang-questions] PostgreSQL driver
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Fri Nov 30 16:32:52 CET 2007
nindeu@REDACTED skrev:
> On Nov 30, 2007 2:00 PM, Christian S <chsu79@REDACTED> wrote:
>> Yes it is all a mess. The following thread last year was full of good
>> ideas for what I really want generalized erlang sql access to be:
>>
>> http://www.nabble.com/Simple-DB-Access-t2028308.html
>
> edbc would for sure be a greate thing. Just look what significant
> value jdbc forms. It's one of the core technologies of so many java
> projects.
> Hmmm, I am pretty convinced it's not an easy task to create some kind
> of edbc.
On the topic of coordinating external DB transactions with mnesia
transactions, I think some form of extension of the mnesia callback
API is needed.
I introduced some extra callback functions for rdbms, in the form
of patches to mnesia:
begin_activity(Type, Factor, Tid, Ts) -> void()
pre_commit(Result, Type, Tid, Ts) -> void()
end_activity(Result, Type, Tid, Ts) -> void()
I made them optional, to be compatible with old callbacks.
With some peeking into mnesia's activity state, it is
possible to determine in begin_activity/4 whether the
transaction has been restarted, or whether it's a nested
transaction.
Crashes in begin_activity/4 or end_activity/4 lead to
mnesia dumping core. A crash in pre_commit leads to a
transaction abort.
I haven't given much thought to what would be required
to synch with e.g. MySql or PostgreSQL, but perhaps these
could form a starting point for such a discussion.
BR,
Ulf W
More information about the erlang-questions
mailing list