Think about Loose Coupling | |
PerlMonks |
Re: OT: Is MD5 ALWAYS 32 character long?by l3nz (Friar) |
on Dec 18, 2003 at 13:42 UTC ( [id://315514]=note: print w/replies, xml ) | Need Help?? |
I believe that, as the 32 byte string you see is the textual encoding of a 128 bit (16 bytes) binary string, it will consistently hold the same length no matter what the binary content will be.
About CHAR or VARCHAR, it depends. It's usually better to use a CHAR because in most implementations a VARCHAR will require one more page fetch per string read because VARCHAR data will be stored in a separate disk table, but if you plan to access one row at a time and you will fetch that row from an index seek, the performance cost will be quite small anyway. On the other side, I would not routinely query a one million row database with a LIKE statement on a VARCHAR.... :-) A number of SQL implementations (mySQL for one) don't support mixed CHAR / VARCHAR fields in the same row, so if you change one field to VARCHAR all other CHARs will be converted to VARCHAR. So beware! Please note that whether you say CHAR(32) or VARCHAR(32), only the first 32 chars will be stored in the database.
In Section
Seekers of Perl Wisdom
|
|