List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:July 19 2007 7:56am
Subject:Re: Definitions in the frm file
View as plain text  
Hi!

On Jul 18, Bjørn Normann wrote:
> I'm working on a master dissertation about forensics investigation in
> a MySQL database system. I have gone through the definition of the
> .frm file and find some unclear information in the internals manual.
> 
> I need more information about the key area. It doesn't say anything
> about how the keys or indexes are stored in the .frm file.

Check the source. For example (in 5.1).
You need this function:
http://dev.mysql.com/sources/doxygen/mysql-5.1/table_8cc.html#90fcadffe69b32708bc42f9c71792524

keys are read from the frm file in lines 00527-00578, and 00690-00712.
It's easy to understand, for example:

00532       keyinfo->flags=      (uint) uint2korr(strpos) ^ HA_NOSAME;
00533       keyinfo->key_length= (uint) uint2korr(strpos+2);
00534       keyinfo->key_parts=  (uint) strpos[4];
00535       keyinfo->algorithm=  (enum ha_key_alg) strpos[5];
00536       keyinfo->block_size= uint2korr(strpos+6);
00537       strpos+=8;

means
  * two bytes for flags (with inverted HA_NOSAME bit)
  * two bytes for key length
  * one byte - number of key parts
  * one byte for key algorithm
  * two bytes - key block size
 
Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Radlkoferstr. 2, D-81373 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
Definitions in the frm fileBjørn Normann18 Jul
  • Re: Definitions in the frm fileSergei Golubchik19 Jul
    • Re: Definitions in the frm fileLenz Grimmer19 Jul
      • Re: Definitions in the frm fileSergei Golubchik19 Jul
      • Re: Definitions in the frm fileIngo Strüwing20 Jul