MCPcopy
hub / github.com/alibaba/druid / hash

Method hash

core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1844–1867  ·  view source on GitHub ↗
(String sql, DbType dbType)

Source from the content-addressed store, hash-verified

1842 }
1843
1844 public static long hash(String sql, DbType dbType) {
1845 Lexer lexer = SQLParserUtils.createLexer(sql, dbType);
1846
1847 StringBuilder buf = new StringBuilder(sql.length());
1848
1849 for (; ; ) {
1850 lexer.nextToken();
1851
1852 Token token = lexer.token();
1853 if (token == Token.EOF) {
1854 break;
1855 }
1856
1857 if (token == Token.ERROR) {
1858 return Utils.fnv_64(sql);
1859 }
1860
1861 if (buf.length() != 0) {
1862 // skip
1863 }
1864 }
1865
1866 return buf.hashCode();
1867 }
1868
1869 public static SQLExpr not(SQLExpr expr) {
1870 if (expr instanceof SQLBinaryOpExpr) {

Callers 3

hashCodeMethod · 0.80
hashCodeMethod · 0.80
hashCodeMethod · 0.80

Calls 6

createLexerMethod · 0.95
nextTokenMethod · 0.95
tokenMethod · 0.95
fnv_64Method · 0.95
lengthMethod · 0.45
hashCodeMethod · 0.45

Tested by

no test coverage detected