Home > Database > Mysql Tutorial > body text

SQLite3判断Token类型(Keyword)

WBOY
Release: 2016-06-07 17:11:53
Original
990 people have browsed it

SQLite3的getToken函数负责判断SQL语句中的Token(语素),并返回该Token的长度。一些基本的Token(如运算符,括号等)放在了冗长

SQLite3的getToken函数负责判断SQL语句中的Token(语素),并返回该Token的长度。一些基本的Token(如运算符,括号等)放在了冗长的Switch...case里。对keyword的判断提到了keywordCode里,其中竟包含了一个HashTable结构:

Hash函数:( ( toLower(z[0])*4 ) ^ ( toLower(z[n-1])*3 ) ^ n ) % 127

冲突解决:aNext数组

为了查找提高速度,先使用aLen比较长度。在实现toLower()时,使用charMap映射表,避免了If的判断。

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template