The SQL Relay client API's are ultimately based on the C++ API and the
Rudiments library. A more portable approach would be to implement the API
natively in a language like Java, Python or Perl. A more stripped down and
potentially higher performance version of the API could be written in any
language.
SQL Relay has always had an open-protocol by virtue of being
open-source, but reverse-engineering it from the API code can be a daunting
task. If it were documented in plainer terms, it would be "more open".
Born of these motivations, the following pseudocode demonstrates the
protocol and its capabilities. This code should provide enough detail about
the protocol to enable a developer to write his or her own API.
Note that this specification will likely change a bit as new features
are added to SQL Relay.
Legend
Yellow: long - a 32 bit integer
Red: short - a 16 bit integer
Green: string - a series of 8 bit chars
Blue: double - a 32 bit, double precision floating point number
Client/Listener Communication
Connect to the sqlr-listener using an inet or unix datagram socket
Send:
length of user name
user name string
length of password
password string
Receive:
error status: 1 or 0
If error status is 1
length of the error
error string
If error status is 0
whether to reconnect to the connection daemon or not