Shawn Fessenden wrote:
I don't need to duplicate libmysql in it's entirety. All I need to be able
to do is execute simple queries and add and delete records. It's not that
big a deal.
Heh! Reminds me of one of my first contract programming offers, right
out of school. A guy wanted to hire me (at a fixed bid) to write a
subset of SQL using shell scripts and awk. He said, "you only have to
support one command from SQL. I only need SELECT implemented."
I think you're opening yourself up for a nasty headache if you try to
write code to talk directly to port 3306. But I still say that's not
the only way to solve you problem.
Given the constraints, what I would do in this situation is write my own
simple server that functions as a middleware, or proxy, for the simple
queries that you're describing.
That is, you write a client that talks to (for instance) port 3406, and
you also write a server that listens on port 3406. Your server would
typically run on the same host as the MySQL instance, but it doesn't
have to.
Then your server in turn uses the MySQL API, translating your simple
subset of specialized queries into the standard MySQL-provided API
calls, to talk to the MySQL client/server protocol. So your code
defines both ends of your custom client/server protocol, and therefore
it doesn't risk getting out of sync with the MySQL protocol implementation.
You could alternately use MySQL Connector/J or something else to write
your middleware server, depending on what language you want to use to
program the server. You should be less constrained for what language
you use, you could use anything that runs on the same platform as your
MySQL instance.
Regards,
Bill K.