3 Do not edit this file directly!
6 /* Copyright 2001-2008 MySQL AB, 2008 Sun Microsystems, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; version 2 of the License.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to the
19 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
22 /* Do not edit this file! This is generated by gen_lex_hash.cc
23 that seeks for a perfect hash function */
27 static uchar sql_functions_map
[12604]= {
3181 static uchar symbols_map
[11740]= {
6119 static unsigned int sql_functions_max_len
=29;
6121 static unsigned int symbols_max_len
=29;
6123 static SYMBOL
*get_hash_symbol(const char *s
,
6124 unsigned int len
,bool function
)
6126 register uchar
*hash_map
;
6127 register const char *cur_str
= s
;
6130 DBUG_PRINT("warning", ("get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.")); return(NULL
);
6133 if (len
>sql_functions_max_len
) return 0;
6134 hash_map
= sql_functions_map
;
6135 register uint32 cur_struct
= uint4korr(hash_map
+((len
-1)*4));
6138 register uchar first_char
= (uchar
)cur_struct
;
6140 if (first_char
== 0)
6142 register int16 ires
= (int16
)(cur_struct
>>16);
6143 if (ires
==array_elements(symbols
)) return 0;
6144 register SYMBOL
*res
;
6148 res
= sql_functions
-ires
-1;
6149 register uint count
= (uint
) (cur_str
- s
);
6150 return lex_casecmp(cur_str
,res
->name
+count
,len
-count
) ? 0 : res
;
6153 register uchar cur_char
= (uchar
)to_upper_lex
[(uchar
)*cur_str
];
6154 if (cur_char
<first_char
) return 0;
6156 if (cur_char
>(uchar
)cur_struct
) return 0;
6159 cur_struct
= uint4korr(hash_map
+
6160 (((uint16
)cur_struct
+ cur_char
- first_char
)*4));
6164 if (len
>symbols_max_len
) return 0;
6165 hash_map
= symbols_map
;
6166 register uint32 cur_struct
= uint4korr(hash_map
+((len
-1)*4));
6169 register uchar first_char
= (uchar
)cur_struct
;
6172 register int16 ires
= (int16
)(cur_struct
>>16);
6173 if (ires
==array_elements(symbols
)) return 0;
6174 register SYMBOL
*res
= symbols
+ires
;
6175 register uint count
= (uint
) (cur_str
- s
);
6176 return lex_casecmp(cur_str
,res
->name
+count
,len
-count
)!=0 ? 0 : res
;
6179 register uchar cur_char
= (uchar
)to_upper_lex
[(uchar
)*cur_str
];
6180 if (cur_char
<first_char
) return 0;
6182 if (cur_char
>(uchar
)cur_struct
) return 0;
6185 cur_struct
= uint4korr(hash_map
+
6186 (((uint16
)cur_struct
+ cur_char
- first_char
)*4));