1.2.5 Major Directories: sql

The next major directory is mysql-5.0/sql. If you remember your manual, you know that you must pronounce this: ess queue ell.

The "parser" programs on mysql-5.0/sql:

size   name           comment
----   ----           -------
 51326 sql_lex.cc     lexer
230026 sql_yacc.yy    parser
+ many more *.cc programs

This is where we keep the parser. In other words, programs like sql_lex.cc and sql_yacc.yy are responsible for figuring out what's in an SQL command, and deciding what to do about it.

The "handler" programs on mysql-5.0/sql:

size   name             comment
----   ----             -------
 79798 ha_berkeley.cc   bdb
 56687 ha_federated.cc  federated (sql/med)
 61033 ha_heap.cc       heap (memory)
214046 ha_innodb.cc     innodb
 47361 ha_myisam.cc     myisam
 14727 ha_myisammrg.cc  merge
215091 ha_ndbcluster.cc ndb

This is also where we keep the handler programs. Now, you'll recall that the storage engine itself, for example myisam, is a separate directory. But here in the sql directory, we have programs which are responsible for determining which handler to call, formatting appropriate arguments, and checking results. In other words, the programs that begin with the letters ha are the handler interface programs, and there's one for each storage engine.

The "statement" routines in mysql-5.0/sql:

size   name           comment
----   ----           -------
 24212 sql_delete.cc  'delete ...' statement
  1217 sql_do.cc      'do ...'
 22362 sql_help.cc    'help ...'
 75331 sql_insert.cc  'insert ...'
430486 sql_select.cc  'select ...'
130861 sql_show.cc    'show ...'
 42346 sql_update.cc  'update ...'
+ many more sql_*.cc programs

Also in the sql directory, you'll find individual programs for handling each of the syntactical components of an SQL statement. These programs tend to have names beginning with sql_. So for the SELECT statement, check out sql_select.cc.

Thus, there are "statement" routines like sql_delete.c, sql_load.c, and sql_help.c, which take care of the DELETE, LOAD DATA, and HELP statements. The file names are hints about the SQL statements involved.

The "statement function" routines in mysql-5.0/sql:

size   name           comment
----   ----           -------
 19906 sql_string.cc  strings
  6152 sql_olap.cc    olap (rollup)
 14241 sql_udf.cc     user-defined functions
 17669 sql_union.cc   unions

Then there are the routines for components of statements, such as strings, or online analytical processing which at this moment just means ROLLUP, or user-defined functions, or the UNION operator.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.