Trilogy is a client library for MySQL-compatible database servers, designed for performance, flexibility, and ease of embedding.
It's currently in production use on github.com.
Supports the most frequently used parts of the text protocol
- Password authentication
- Query, ping, and quit commands
Low-level protocol API completely decoupled from IO
Non-blocking client API wrapping the protocol API
Blocking client API wrapping the non-blocking API
No dependencies outside of POSIX and the C standard library
Minimal dynamic allocation
Only supports the parts of the text protocol that are in common use. There's no support for the binary protocol or prepared statements
No support for
LOAD DATA INFILEon local files
trilogy_escapeassumes an ASCII-compatible connection encoding
make - that's it. This will build a static
Trilogy should build out of the box on most UNIX systems which have OpenSSL installed.
Documentation for Trilogy's various APIs can be found in these header files:
The blocking client API. These are simply a set of convenient wrapper functions around the non-blocking client API in
The non-blocking client API. Every command is split into a
_recvfunction allowing callers to wait for IO readiness externally to Trilogy
MySQL-compatible packet builder API
Character set and encoding tables
Error table. Every Trilogy function returning an
intuses the error codes defined here
Streaming packet frame parser
Low-level protocol API. Provides IO-decoupled functions to parse and build packets
Bounds-checked packet reader API
We maintain a Ruby binding in this repository. This is currently stable and production-ready.
Trilogy is released under the MIT license.