[erlang-questions] MySQL driver update

Yariv Sadan yarivvv@REDACTED
Mon Sep 25 18:36:25 CEST 2006


Hi,

I simplified the MySQL transaction API to look like that of Mnesia. I
also made a bunch of other improvements.

Here's an example:

mysql:prepare(insert_developer,
      <<"INSERT INTO person(name) VALUES (?)">>),

mysql:transaction(conn_pool,
  fun() ->
    mysql:execute(insert_developer, ["Bob"]),
    {data, Res} =
        mysql:fetch(<<"SELECT last_insert_id()">>),
    [[Id]] = mysql:get_result_rows(Res),
    mysql:fetch(
      [<<"UPDATE person SET name='Jane' WHERE id=">>,
      integer_to_list(Id)])
  end).


The full story is here:
http://yarivsblog.com/articles/2006/09/25/mnesia-mysql-its-the-same-transaction.

You can get the latest version of the driver in brachers/v0.9. The old
version is in branches/v0.8.

Best regards,
Yariv



More information about the erlang-questions mailing list