MySAC (MySQL Simple Asynchronous Client)

About MySAC

MySAC is a library that provides mechanisms for making asynchronous request to MySQL database.

It uses uses the official MySQL client library for authentication and network functions. Memory allocation must be done in user code, so any memory manager can be used.

The actual library is beta. I search people for testing it and submit ideas. Is only tested with mysql 5. I think that is running also with MySQL 4.1

  • for the asynchronous The lib run with the same asynchronous mechanism that openssl: the I/O functions called, returns message "need write" or "need read", and never block.
  • The lib is linked with the official mysql client lib, for using authentication method and conversion network host functions. This assure durability of the lib
  • The memory allocation are doing by the user code and not by the lib. With this choice, you can use your personnal memory manager.


  • In first step, you allocate memory for MYSAC pools. Each MYSAC struct manage connexion to MySQL server. Each MYSAC struct use 10384o (10240o just for buffering SQL requests and management responses)
  • In second step, you allocate buffer pool for containing responses. You can have big, medium and low memory buffers.
  • If you want speed in execution, you can prepare MySQL statements.
  • Send request: prepare request (or execute statement) and associate buffer with the request. when the request is terminated, you can dettach the buffer from MYSAC struct, and send other request. While the other request respond, you can use the buffer of the first request

what's new

1.x version

  • 1.1.1 06 Jun 2011
    Regression on authentication function. Maybe the server require a challenge password hashed with the old algoritm.
  • 1.1 24 Apr 2011
    Memory audit function added. Fix many bugs.

    Thanks to Mike Blumenkrantz for many tests and patchs.
  • 1.0 04 Apr 2011
    The lib can use memory allocation for responses. Fix many bugs. A major bug is that the lib doesn't threat empty responses.

    Thanks to Mike Blumenkrantz for many tests and patchs.

Beta version

  • 0.5b 31 Mar 2010
    A shared object (.so) library is compiled by default. The static library was renamed from limysac.a to libmysac-static.a. Compilation on the x64 platform was fixed.
  • 0.4b 30 Nov 2009
    Statement implementation was added. A new io function was added. This function can be always called in place of context functions: mysac_send_database, mysac_send_database, mysac_send_query, and mysac_connect. A bug in which columns were counted in place of rows was fixed. A wrong file descriptor in an example was fixed. A function that cannot return status was fixed. A compilation error was fixed. The exemple directory was cleaned from a makefile error
  • 0.2b 12 Oct 2009
    The license was clarified.
  • 0.1b 24 May 2009
    This release has code cleanup and updated documentation/license. It adds mysac_v_set_query for building stdarg compliant queries. It adds mysac_get_res, which returns resources. Many error messages are added. It can use 64-bit responses (untested). It returns the value of the last insert ID. It adds a function for browsing responses lines. An error with decoding fields > 64kB is fixed. MySQL response bloc decoding is fixed. Checking the minimum size of MYSAC_RES is fixed
  • 0.0b-1 05 Feb 2009 11:05
    This release has been tested with MySQL 5.