Monday, February 12, 2007

MySQL bindings

Berlin Brown has contributed bindings for the MySQL database client library, along with some Factorish wrappers. Support for prepared statements is in the works. The code is in the darcs repository in libs/mysql.

4 comments:

Dominique Boucher said...

Is it a wrapper for the C interface or does it implement the native protocol?

Slava Pestov said...

Its a wrapper for the C interface.

Berlin Brown said...

Yea, it is C binding. But the alien interface (FFI) for Factor is real clean and integrates nicely with C calls. An FFI binding to something like the mysql api is probably a simpler approach than a socket interface with features like SSL connectivy support, BLOB support, etc.

With that being said, a socket interface would be pretty interesting and I already talked to Mark Mathews the mysql jdbc driver author and MySQL has pretty good documentation on the protocol so it wouldnt be impossible to create a library around socket communication.

"Hi Berlin,

Between the source of either the JDBC driver or the ADO.Net driver and the internals documentation, you should be able to figure it out.

The internals documentation dealing with the protocol is here:"

http://dev.mysql.com/doc/internals/en/client-server-protocol.html

Dominique Boucher said...

A native protocol would of course be nice, since a query won't block the whole system.

But there may be some licensing issues. I think the native protocol is GPL:

"Because this is a GPL protocol, any product which uses it to connect to a MySQL server, or to emulate a MySQL server, or to interpose between any client and server which uses the protocol, or for any similar purpose, is also bound by the GPL."

That's quite restrictive, IMO.