in reply to database emulation

You might want to start with a look-see at DBD::Proxy, which does something similar, allowing you to connect to a DBI session over an TCP connection. There may be some aspect of that which'll work for your goal.

For full-bore SQL-to-SQL language translations, you might want to start with SQL::Translator. So far as I know, SQL::Translator does not deal with arbitrary SQL commands per se; from my readings on it, its focus is on converting tables from one SQL Type to another. However, I a) could very well be wrong, and b) suspect that the code to do much of what you're looking for is already in the module. Indeed, it even offers a cgi app for doing it's work. The SQL::Translator manual 'plains more.

Does that help any?

----Asim, known to some as Woodrow.