Hi,

We had a problem for quite sometime that there is no possibility to create
alias for database name in mysql (at least we could not find out how to do
this, symlinks can drive mysql berserk). 

So I wrote little proxy daemon which rewrites the packets which
(supposedly) contain queries to connect to these aliases. That is , it
rewrites alias to real database name.

I used packet dumps + hexeditor to get information on mysql packets (I
tried to dig in mysql source code at first, but it looked as it was
going to take too much time).

Daemon does it job fine now, but some things are still unclear to me:

1) Endiannes. I figured out that  the size of packet is stored at the
beginning of packet as little endian unsigned int. 

Is it so in all cases, or it just happens because both client and server
run on little endian machines?

2) Currently I rewrite only packets which contain:
 <size uint>+\x02+dbname
 <size uint>+<something>+\x00+dbname (connection init)
 <size uint>+\x03+"\s*use\s*"+dbname. 
 
 I am not sure whether it is always correct.

3) Does anyone need such tool, should I post it on web somewhere?

Thanks in advance,
Grigory

--
Grigory Kolesov - MIPS-IBI, GSF
e-mail [EMAIL PROTECTED] (remove caps)
http://mips.gsf.de/~kolesov/


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to