Skip to content

Commit 87e92bd

Browse files
authored
Merge pull request #1 from MyCATApache/master
合拼
2 parents 722e673 + 59f018c commit 87e92bd

15 files changed

+1589
-552
lines changed

Diff for: README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ SQLParser
99
* ""和''字符串支持 √
1010
* 注释支持 √
1111
* 生成sql语句hash值
12-
* 生成schema和table name的hash值
12+
* 生成schema和table name的hash值
1313
* 支持获取limit条数 √
1414

1515
SQLContext考虑实现以下接口:
16-
1. sql语句个数(通过 ; 区分)
16+
1. sql语句个数(通过 ; 区分)
1717
2. 单个sql语句中token位置,例如 [select(1), from(15), join(26)]
18-
3. 单个sql语句表名位置及其hash
19-
4. 单个sql语句库名(与表名相关)位置及其hash
20-
5. 是否包含注解
21-
6. 注解类型
22-
7. 注解语句
18+
3. 单个sql语句表名位置及其hash
19+
4. 单个sql语句库名(与表名相关)位置及其hash
20+
5. 是否包含注解
21+
6. 注解类型
22+
7. 注解语句
2323
8. sql关键字替换
2424

Diff for: minimal_sql_tokens.txt

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@ IF
44
ON
55
FOR
66
NOT
7+
SET
78
SQL
89
USE
10+
XML
911
CALL
12+
DATA
1013
DROP
1114
DESC
1215
FROM
16+
HELP
1317
INTO
1418
JOIN
1519
KILL
20+
LOAD
1621
LOCK
1722
LEFT
1823
NAME
@@ -21,27 +26,33 @@ SLOW
2126
TIME
2227
USER
2328
ALTER
29+
BEGIN
2430
CLEAR
2531
CACHE
2632
GROUP
2733
GRANT
2834
INDEX
2935
LIMIT
36+
LOCAL
3037
MYCAT
3138
ORDER
39+
QUERY
3240
RIGHT
3341
ROUTE
42+
START
3443
TABLE
3544
UNION
3645
WHERE
3746
CATLET
47+
COMMIT
3848
CONFIG
3949
CREATE
4050
DETAIL
4151
DELETE
4252
EXISTS
43-
INSERT
4453
IGNORE
54+
INFILE
55+
INSERT
4556
ONLINE
4657
RELOAD
4758
RENAME
@@ -72,9 +83,14 @@ TRUNCATE
7283
HEARTBEAT
7384
PROCEDURE
7485
PROCESSOR
86+
SAVEPOINT
87+
CACHE_TIME
88+
CONCURRENT
7589
CONNECTION
7690
DATASOURCE
7791
THREADPOOL
92+
ACCESS_COUNT
93+
AUTO_REFRESH
7894
LOW_PRIORITY
7995
HIGH_PRIORITY
8096

Diff for: pom.xml

+74-9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>com.test</groupId>
7+
<name>SQLParser</name>
8+
<description>A Quick SQL Parser Designed for MyCAT 2.0</description>
9+
<url>https://github.com/MyCATApache/SQLparser.git</url>
10+
<groupId>io.mycat</groupId>
811
<artifactId>SQLParser</artifactId>
9-
<version>1.0-SNAPSHOT</version>
12+
<version>1.4-SNAPSHOT</version>
1013
<properties>
1114
<jmh.version>1.17.4</jmh.version>
1215
<junit.version>4.12</junit.version>
@@ -42,12 +45,74 @@
4245
<version>${jmh.version}</version>
4346
<scope>provided</scope>
4447
</dependency>
45-
<!--druid -->
46-
<dependency>
47-
<groupId>com.alibaba</groupId>
48-
<artifactId>druid</artifactId>
49-
<version>1.0.27</version>
50-
</dependency>
51-
5248
</dependencies>
49+
50+
<licenses>
51+
<license>
52+
<name>The Apache Software License, Version 2.0</name>
53+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
54+
</license>
55+
</licenses>
56+
57+
<developers>
58+
<developer>
59+
<name>ishotoli</name>
60+
<email>[email protected]</email>
61+
</developer>
62+
</developers>
63+
64+
<scm>
65+
<connection>scm:git:https://github.com/MyCATApache/SQLparser.git</connection>
66+
<developerConnection>scm:git:https://github.com/MyCATApache/SQLparser.git</developerConnection>
67+
<url>https://github.com/MyCATApache/SQLparser.git</url>
68+
</scm>
69+
70+
<profiles>
71+
<profile>
72+
<id>snapshot</id>
73+
<build>
74+
<plugins>
75+
<!-- Source -->
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-source-plugin</artifactId>
79+
<version>2.2.1</version>
80+
<executions>
81+
<execution>
82+
<phase>package</phase>
83+
<goals>
84+
<goal>jar-no-fork</goal>
85+
</goals>
86+
</execution>
87+
</executions>
88+
</plugin>
89+
<!-- GPG -->
90+
<plugin>
91+
<groupId>org.apache.maven.plugins</groupId>
92+
<artifactId>maven-gpg-plugin</artifactId>
93+
<executions>
94+
<execution>
95+
<id>sign-artifacts</id>
96+
<phase>verify</phase>
97+
<goals>
98+
<goal>sign</goal>
99+
</goals>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
</plugins>
104+
</build>
105+
<distributionManagement>
106+
<snapshotRepository>
107+
<id>oss</id>
108+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
109+
</snapshotRepository>
110+
<repository>
111+
<id>oss</id>
112+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
113+
</repository>
114+
</distributionManagement>
115+
</profile>
116+
</profiles>
117+
53118
</project>

Diff for: sql_tokens.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ACCESSIBLE
2+
ACCESS_COUNT
23
ACCOUNT
34
ACTION
45
ADD
@@ -22,6 +23,7 @@ AT
2223
AUTHORS
2324
AUTOEXTEND_SIZE
2425
AUTO_INCREMENT
26+
AUTO_REFRESH
2527
AVG_ROW_LENGTH
2628
AVG
2729
BACKEND
@@ -47,6 +49,7 @@ BTREE
4749
BY
4850
BYTE
4951
CACHE
52+
CACHE_TIME
5053
CALL
5154
CASCADE
5255
CASCADED

Diff for: src/main/java/io/mycat/IntTokenHash.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class IntTokenHash {
77
public static final int ANNOTATION_BALANCE= 0x00140001;
88
public static final int ANNOTATION_START = 0x00150002;
99
public static final int ANNOTATION_END = 0x00160002;
10+
public static final int SQL_DELIMETER = 0x000c0001;
1011

1112
//generate by MatchMethodGenerator.GenerateSqlTokenHash
1213
public static final int AS = 0x46580002;
@@ -15,15 +16,20 @@ public class IntTokenHash {
1516
public static final int ON = 0x409e0002;
1617
public static final int FOR = 0x576e0003;
1718
public static final int NOT = 0x68b00003;
19+
public static final int SET = 0x52330003;
1820
public static final int SQL = 0x53820003;
1921
public static final int USE = 0x0f840003;
22+
public static final int XML = 0x7fe20003;
2023
public static final int CALL = 0x25d00004;
24+
public static final int DATA = 0x30b50004;
2125
public static final int DROP = 0xba5d0004;
2226
public static final int DESC = 0xc08f0004;
2327
public static final int FROM = 0x992e0004;
28+
public static final int HELP = 0xd4e30004;
2429
public static final int INTO = 0xb2e70004;
2530
public static final int JOIN = 0xf9700004;
2631
public static final int KILL = 0x5f7f0004;
32+
public static final int LOAD = 0xed8b0004;
2733
public static final int LOCK = 0xed330004;
2834
public static final int LEFT = 0xf4e50004;
2935
public static final int NAME = 0x33200004;
@@ -32,27 +38,33 @@ public class IntTokenHash {
3238
public static final int TIME = 0x5f050004;
3339
public static final int USER = 0x7bfa0004;
3440
public static final int ALTER = 0xb2db0005;
41+
public static final int BEGIN = 0xf8f50005;
3542
public static final int CLEAR = 0x19bf0005;
3643
public static final int CACHE = 0xf61c0005;
3744
public static final int GROUP = 0x43f50005;
3845
public static final int GRANT = 0x29c20005;
3946
public static final int INDEX = 0xfcff0005;
4047
public static final int LIMIT = 0x450a0005;
48+
public static final int LOCAL = 0x7a200005;
4149
public static final int MYCAT = 0xdce50005;
50+
public static final int QUERY = 0xdf8c0005;
4251
public static final int ORDER = 0x88da0005;
4352
public static final int RIGHT = 0xec610005;
4453
public static final int ROUTE = 0x82ef0005;
54+
public static final int START = 0xbf880005;
4555
public static final int TABLE = 0x03780005;
4656
public static final int UNION = 0xcf9d0005;
4757
public static final int WHERE = 0x75950005;
4858
public static final int CATLET = 0xda600006;
59+
public static final int COMMIT = 0xac850006;
4960
public static final int CONFIG = 0xebd60006;
5061
public static final int CREATE = 0xdde00006;
5162
public static final int DETAIL = 0x47690006;
5263
public static final int DELETE = 0x33e50006;
5364
public static final int EXISTS = 0x2ed70006;
54-
public static final int INSERT = 0xa3b10006;
5565
public static final int IGNORE = 0x6c360006;
66+
public static final int INFILE = 0xba240006;
67+
public static final int INSERT = 0xa3b10006;
5668
public static final int ONLINE = 0x05bc0006;
5769
public static final int RELOAD = 0xd7200006;
5870
public static final int RENAME = 0xe6c60006;
@@ -83,9 +95,14 @@ public class IntTokenHash {
8395
public static final int HEARTBEAT = 0xabb70009;
8496
public static final int PROCEDURE = 0x11600009;
8597
public static final int PROCESSOR = 0xfdbc0009;
98+
public static final int SAVEPOINT = 0xca160009;
99+
public static final int CACHE_TIME = 0x9047000a;
100+
public static final int CONCURRENT = 0x91cf000a;
86101
public static final int CONNECTION = 0x307d000a;
87102
public static final int DATASOURCE = 0x0b35000a;
88103
public static final int THREADPOOL = 0x5a7a000a;
104+
public static final int ACCESS_COUNT = 0xec30000c;
105+
public static final int AUTO_REFRESH = 0x06b8000c;
89106
public static final int LOW_PRIORITY = 0xb805000c;
90107
public static final int HIGH_PRIORITY = 0x7c6f000d;
91108
}

0 commit comments

Comments
 (0)