Dashboard > Contributions > Contributions > Yxa
Yxa Log In View a printable version of the current page.

Added by Mickaël Rémond , last edited by Mickaël Rémond on Apr 23, 2006  (view change)
Labels: 
(None)

This page gathers contributions to the Yxa SIP server project.

News

  • 2006-02-28: Added a binary archive (mysql_beam.tar.gz).
  • 2006-01-13: Added a start_link/6 method in mysql_conn.erl module.

Native Mysql access from Erlang: patch

Getting the number of updated rows during a query

The patch slightly changes the behaviour of the MySQL module to convey more information in the query result. Previously, the number of update row was ignored. In case of update — insert or delete for example — the result was simply:

{ok, [], []}

The return API of the fetch function has changed. Possible results were:

{ok, FieldInfo, Rows} |
{error, Reason}
with:
         FieldInfo    = list() of term()
         Rows         = list() of [string()]
         Reason       = term()

Possible results are now:

{data, MySQLRes} |
{updated, MySQLRes} |
{error, MySQLRes}
with:
         MySQLRes       = term()

Actual data can be extracted from MySQLRes by calling the following API functions:

  • on data received:
FieldInfo = mysql:get_result_field_info(MysqlRes)
AllRows   = mysql:get_result_rows(MysqlRes)
with:
       FieldInfo = list() of {Table, Field, Length, Name}
       AllRows   = list() of list() representing records
  • on update:
Affected  = mysql:get_result_affected_rows(MysqlRes)
with:
      Affected  = integer()
  • on error:
Reason    = mysql:get_result_reason(MysqlRes)
with:
       Reason    = string()

Protocol fix for the FieldInfo description

On our system, we were not able to get the correct fields description in the select statement result. It seems that the MySQL protocol has changed.

The new version should now work correctly from MySQL 4.0.x to MySQL 5.0.x. Please, tell us if it breaks something on your system.

Download

You can download the MySQL native driver for Erlang as source code, as a binary format or as an Yxa patch.

Download MySQL Native Erlang driver as binary

You can try the module by simply putting the beam files contained in the following archive into your Erlang path: mysql_beam.tar.gz

Download the complete MySQL Erlang source code

You can try the MySQL native driver easily by downloading the complete Erlang MySQL module source code: mysql.tar.gz

Download the patch

If you are using Yxa, you can prefer to download the patch for Yxa:

Download: mysql_erlang.patch
This patch can be applied to yxa/src/mysql directory from Yxa Subversion repository:

svn checkout svn://anonsvn.it.su.se/yxa/trunk/ yxa
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators