#include <sql_class.h>
Inheritance diagram for Key:


Public Types | |
| PRIMARY | |
| UNIQUE | |
| MULTIPLE | |
| FULLTEXT | |
| SPATIAL | |
| FOREIGN_KEY | |
| enum | Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY } |
Public Member Functions | |
| Key (enum Keytype type_par, const char *name_arg, KEY_CREATE_INFO *key_info_arg, bool generated_arg, List< key_part_spec > &cols) | |
| ~Key () | |
Public Attributes | |
| enum Keytype | type |
| KEY_CREATE_INFO | key_create_info |
| List< key_part_spec > | columns |
| const char * | name |
| bool | generated |
Friends | |
| bool | foreign_key_prefix (Key *a, Key *b) |
Definition at line 113 of file sql_class.h.
| enum Key::Keytype |
| Key::Key | ( | enum Keytype | type_par, | |
| const char * | name_arg, | |||
| KEY_CREATE_INFO * | key_info_arg, | |||
| bool | generated_arg, | |||
| List< key_part_spec > & | cols | |||
| ) | [inline] |
Definition at line 122 of file sql_class.h.
00125 :type(type_par), key_create_info(*key_info_arg), columns(cols), 00126 name(name_arg), generated(generated_arg) 00127 {}
| Key::~Key | ( | ) | [inline] |
Definition at line 109 of file sql_class.cc.
00110 { 00111 /* Ensure that 'a' is the generated key */ 00112 if (a->generated) 00113 { 00114 if (b->generated && a->columns.elements > b->columns.elements) 00115 swap_variables(Key*, a, b); // Put shorter key in 'a' 00116 } 00117 else 00118 { 00119 if (!b->generated) 00120 return TRUE; // No foreign key 00121 swap_variables(Key*, a, b); // Put generated key in 'a' 00122 } 00123 00124 /* Test if 'a' is a prefix of 'b' */ 00125 if (a->columns.elements > b->columns.elements) 00126 return TRUE; // Can't be prefix 00127 00128 List_iterator<key_part_spec> col_it1(a->columns); 00129 List_iterator<key_part_spec> col_it2(b->columns); 00130 const key_part_spec *col1, *col2; 00131 00132 #ifdef ENABLE_WHEN_INNODB_CAN_HANDLE_SWAPED_FOREIGN_KEY_COLUMNS 00133 while ((col1= col_it1++)) 00134 { 00135 bool found= 0; 00136 col_it2.rewind(); 00137 while ((col2= col_it2++)) 00138 { 00139 if (*col1 == *col2) 00140 { 00141 found= TRUE; 00142 break; 00143 } 00144 } 00145 if (!found) 00146 return TRUE; // Error 00147 } 00148 return FALSE; // Is prefix 00149 #else 00150 while ((col1= col_it1++)) 00151 { 00152 col2= col_it2++; 00153 if (!(*col1 == *col2)) 00154 return TRUE; 00155 } 00156 return FALSE; // Is prefix 00157 #endif 00158 }
Definition at line 118 of file sql_class.h.
Referenced by foreign_key_prefix(), mysql_alter_table(), and mysql_copy_key_list().
Definition at line 120 of file sql_class.h.
Referenced by foreign_key_prefix(), mysql_alter_table(), and mysql_copy_key_list().
Definition at line 117 of file sql_class.h.
Referenced by mysql_alter_table(), and mysql_copy_key_list().
| const char* Key::name |
Definition at line 119 of file sql_class.h.
Referenced by mysql_alter_table(), and mysql_copy_key_list().
Definition at line 116 of file sql_class.h.
Referenced by mysql_alter_table(), and mysql_copy_key_list().
1.4.7

