chore(project): 添加项目配置文件和忽略规则
- 添加 Babel 配置文件支持 ES6+ 语法转换 - 添加 ESLint 忽略规则和配置文件 - 添加 Git 忽略规则文件 - 添加 Travis CI 配置文件 - 添加 1.4.2 版本变更日志文件 - 添加 Helm 图表辅助模板文件 - 添加 Helm 忽略规则文件
This commit is contained in:
34
sqlparser/seata-sqlparser-core/pom.xml
Normal file
34
sqlparser/seata-sqlparser-core/pom.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 1999-2019 Seata.io Group.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-sqlparser</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>seata-sqlparser-core</artifactId>
|
||||
<name>seata-sqlparser-core ${project.version}</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>seata-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The interface Parameters holder.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface ParametersHolder {
|
||||
|
||||
/**
|
||||
* Get parameters array list [ ].
|
||||
*
|
||||
* @return the array list [ ]
|
||||
*/
|
||||
Map<Integer,ArrayList<Object>> getParameters();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
/**
|
||||
* The interface Sql delete recognizer.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface SQLDeleteRecognizer extends WhereRecognizer {
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Sql insert recognizer.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface SQLInsertRecognizer extends SQLRecognizer {
|
||||
|
||||
/**
|
||||
* insert columns is empty.
|
||||
* @return true: empty. false: not empty.
|
||||
*/
|
||||
boolean insertColumnsIsEmpty();
|
||||
|
||||
/**
|
||||
* Gets insert columns.
|
||||
*
|
||||
* @return the insert columns
|
||||
*/
|
||||
List<String> getInsertColumns();
|
||||
|
||||
/**
|
||||
* Gets insert rows.
|
||||
*
|
||||
* @param primaryKeyIndex insert sql primary key index.
|
||||
* @return the insert rows
|
||||
*/
|
||||
List<List<Object>> getInsertRows(Collection<Integer> primaryKeyIndex);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
/**
|
||||
* The type Sql parsing exception.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public class SQLParsingException extends RuntimeException {
|
||||
/**
|
||||
* Instantiates a new Sql parsing exception.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public SQLParsingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Sql parsing exception.
|
||||
*
|
||||
* @param message the message
|
||||
* @param cause the cause
|
||||
*/
|
||||
public SQLParsingException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Sql parsing exception.
|
||||
*
|
||||
* @param cause the cause
|
||||
*/
|
||||
public SQLParsingException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
/**
|
||||
* The interface Sql recognizer.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface SQLRecognizer {
|
||||
|
||||
/**
|
||||
* Type of the SQL. INSERT/UPDATE/DELETE ...
|
||||
*
|
||||
* @return sql type
|
||||
*/
|
||||
SQLType getSQLType();
|
||||
|
||||
/**
|
||||
* TableRecords source related in the SQL, including alias if any.
|
||||
* SELECT id, name FROM user u WHERE ...
|
||||
* Alias should be 'u' for this SQL.
|
||||
*
|
||||
* @return table source.
|
||||
*/
|
||||
String getTableAlias();
|
||||
|
||||
/**
|
||||
* TableRecords name related in the SQL.
|
||||
* SELECT id, name FROM user u WHERE ...
|
||||
* TableRecords name should be 'user' for this SQL, without alias 'u'.
|
||||
*
|
||||
* @return table name.
|
||||
* @see #getTableAlias() #getTableAlias()#getTableAlias()
|
||||
*/
|
||||
String getTableName();
|
||||
|
||||
/**
|
||||
* Return the original SQL input by the upper application.
|
||||
*
|
||||
* @return The original SQL.
|
||||
*/
|
||||
String getOriginalSQL();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ggndnn
|
||||
*/
|
||||
public interface SQLRecognizerFactory {
|
||||
List<SQLRecognizer> create(String sql, String dbType);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
/**
|
||||
* The interface Sql select recognizer.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface SQLSelectRecognizer extends WhereRecognizer {
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
/**
|
||||
* The enum Sql type.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public enum SQLType {
|
||||
|
||||
/**
|
||||
* Select sql type.
|
||||
*/
|
||||
SELECT(0),
|
||||
/**
|
||||
* Insert sql type.
|
||||
*/
|
||||
INSERT(1),
|
||||
/**
|
||||
* Update sql type.
|
||||
*/
|
||||
UPDATE(2),
|
||||
/**
|
||||
* Delete sql type.
|
||||
*/
|
||||
DELETE(3),
|
||||
/**
|
||||
* Select for update sql type.
|
||||
*/
|
||||
SELECT_FOR_UPDATE(4),
|
||||
/**
|
||||
* Replace sql type.
|
||||
*/
|
||||
REPLACE(5),
|
||||
/**
|
||||
* Truncate sql type.
|
||||
*/
|
||||
TRUNCATE(6),
|
||||
/**
|
||||
* Create sql type.
|
||||
*/
|
||||
CREATE(7),
|
||||
/**
|
||||
* Drop sql type.
|
||||
*/
|
||||
DROP(8),
|
||||
/**
|
||||
* Load sql type.
|
||||
*/
|
||||
LOAD(9),
|
||||
/**
|
||||
* Merge sql type.
|
||||
*/
|
||||
MERGE(10),
|
||||
/**
|
||||
* Show sql type.
|
||||
*/
|
||||
SHOW(11),
|
||||
/**
|
||||
* Alter sql type.
|
||||
*/
|
||||
ALTER(12),
|
||||
/**
|
||||
* Rename sql type.
|
||||
*/
|
||||
RENAME(13),
|
||||
/**
|
||||
* Dump sql type.
|
||||
*/
|
||||
DUMP(14),
|
||||
/**
|
||||
* Debug sql type.
|
||||
*/
|
||||
DEBUG(15),
|
||||
/**
|
||||
* Explain sql type.
|
||||
*/
|
||||
EXPLAIN(16),
|
||||
/**
|
||||
* Stored procedure
|
||||
*/
|
||||
PROCEDURE(17),
|
||||
/**
|
||||
* Desc sql type.
|
||||
*/
|
||||
DESC(18),
|
||||
/**
|
||||
* Select last insert id
|
||||
*/
|
||||
SELECT_LAST_INSERT_ID(19),
|
||||
/**
|
||||
* Select without table sql type.
|
||||
*/
|
||||
SELECT_WITHOUT_TABLE(20),
|
||||
/**
|
||||
* Create sequence sql type.
|
||||
*/
|
||||
CREATE_SEQUENCE(21),
|
||||
/**
|
||||
* Show sequences sql type.
|
||||
*/
|
||||
SHOW_SEQUENCES(22),
|
||||
/**
|
||||
* Get sequence sql type.
|
||||
*/
|
||||
GET_SEQUENCE(23),
|
||||
/**
|
||||
* Alter sequence sql type.
|
||||
*/
|
||||
ALTER_SEQUENCE(24),
|
||||
/**
|
||||
* Drop sequence sql type.
|
||||
*/
|
||||
DROP_SEQUENCE(25),
|
||||
/**
|
||||
* Tddl show sql type.
|
||||
*/
|
||||
TDDL_SHOW(26),
|
||||
/**
|
||||
* Set sql type.
|
||||
*/
|
||||
SET(27),
|
||||
/**
|
||||
* Reload sql type.
|
||||
*/
|
||||
RELOAD(28),
|
||||
/**
|
||||
* Select union sql type.
|
||||
*/
|
||||
SELECT_UNION(29),
|
||||
/**
|
||||
* Create table sql type.
|
||||
*/
|
||||
CREATE_TABLE(30),
|
||||
/**
|
||||
* Drop table sql type.
|
||||
*/
|
||||
DROP_TABLE(31),
|
||||
/**
|
||||
* Alter table sql type.
|
||||
*/
|
||||
ALTER_TABLE(32),
|
||||
/**
|
||||
* Save point sql type.
|
||||
*/
|
||||
SAVE_POINT(33),
|
||||
/**
|
||||
* Select from update sql type.
|
||||
*/
|
||||
SELECT_FROM_UPDATE(34),
|
||||
/**
|
||||
* multi delete/update
|
||||
*/
|
||||
MULTI_DELETE(35),
|
||||
/**
|
||||
* Multi update sql type.
|
||||
*/
|
||||
MULTI_UPDATE(36),
|
||||
/**
|
||||
* Create index sql type.
|
||||
*/
|
||||
CREATE_INDEX(37),
|
||||
/**
|
||||
* Drop index sql type.
|
||||
*/
|
||||
DROP_INDEX(38),
|
||||
/**
|
||||
* Kill sql type.
|
||||
*/
|
||||
KILL(39),
|
||||
/**
|
||||
* Release dblock sql type.
|
||||
*/
|
||||
RELEASE_DBLOCK(40),
|
||||
/**
|
||||
* Lock tables sql type.
|
||||
*/
|
||||
LOCK_TABLES(41),
|
||||
/**
|
||||
* Unlock tables sql type.
|
||||
*/
|
||||
UNLOCK_TABLES(42),
|
||||
/**
|
||||
* Check table sql type.
|
||||
*/
|
||||
CHECK_TABLE(43),
|
||||
|
||||
/**
|
||||
* Select found rows.
|
||||
*/
|
||||
SELECT_FOUND_ROWS(44),
|
||||
|
||||
/**
|
||||
* Insert ignore sql type.
|
||||
*/
|
||||
INSERT_IGNORE(101),
|
||||
/**
|
||||
* Insert on duplicate update sql type.
|
||||
*/
|
||||
INSERT_ON_DUPLICATE_UPDATE(102);
|
||||
|
||||
private int i;
|
||||
|
||||
private SQLType(int i) {
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value int.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int value() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value of sql type.
|
||||
*
|
||||
* @param i the
|
||||
* @return the sql type
|
||||
*/
|
||||
public static SQLType valueOf(int i) {
|
||||
for (SQLType t : values()) {
|
||||
if (t.value() == i) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid SQLType:" + i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Sql update recognizer.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface SQLUpdateRecognizer extends WhereRecognizer {
|
||||
|
||||
/**
|
||||
* Gets update columns.
|
||||
*
|
||||
* @return the update columns
|
||||
*/
|
||||
List<String> getUpdateColumns();
|
||||
|
||||
/**
|
||||
* Gets update values.
|
||||
*
|
||||
* @return the update values
|
||||
*/
|
||||
List<Object> getUpdateValues();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
/**
|
||||
* @author ggndnn
|
||||
*/
|
||||
public interface SqlParserType {
|
||||
/**
|
||||
* The constant SQL_PARSER_TYPE_DRUID.
|
||||
*/
|
||||
String SQL_PARSER_TYPE_DRUID = "druid";
|
||||
|
||||
/**
|
||||
* The constant SQL_PARSER_TYPE_ANTLR.
|
||||
*/
|
||||
String SQL_PARSER_TYPE_ANTLR = "antlr";
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Where recognizer.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public interface WhereRecognizer extends SQLRecognizer {
|
||||
|
||||
/**
|
||||
* Gets where condition.
|
||||
*
|
||||
* @param parametersHolder the parameters holder
|
||||
* @param paramAppenderList the param appender list
|
||||
* @return the where condition
|
||||
*/
|
||||
String getWhereCondition(ParametersHolder parametersHolder, ArrayList<List<Object>> paramAppenderList);
|
||||
|
||||
/**
|
||||
* Gets where condition.
|
||||
*
|
||||
* @return the where condition
|
||||
*/
|
||||
String getWhereCondition();
|
||||
|
||||
/**
|
||||
* Return the limit SQL
|
||||
*
|
||||
* @param parametersHolder the parameters holder
|
||||
* @param paramAppenderList the param appender list
|
||||
* @return The limit SQL.
|
||||
*/
|
||||
default String getLimit(ParametersHolder parametersHolder, ArrayList<List<Object>> paramAppenderList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order by SQL
|
||||
*
|
||||
* @return The order by SQL.
|
||||
*/
|
||||
default String getOrderBy() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The default expr able.
|
||||
*
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
public interface Defaultable {
|
||||
|
||||
/**
|
||||
* get primary key values by default keyword.
|
||||
*
|
||||
* @return pk values by default
|
||||
* @throws SQLException the sql exception
|
||||
*/
|
||||
List<Object> getPkValuesByDefault() throws SQLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
/**
|
||||
* The not placeholder expression.
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
public class NotPlaceholderExpr {
|
||||
|
||||
private static NotPlaceholderExpr instance = new NotPlaceholderExpr();
|
||||
|
||||
/**
|
||||
* Get NotPlaceholder.
|
||||
*
|
||||
* @return the NotPlaceholder
|
||||
*/
|
||||
public static NotPlaceholderExpr get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private NotPlaceholderExpr() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NOT_PLACEHOLDER";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
/**
|
||||
* The type Null.
|
||||
*
|
||||
* @author sharajava
|
||||
*/
|
||||
public class Null {
|
||||
private static Null instance = new Null();
|
||||
|
||||
/**
|
||||
* Get null.
|
||||
*
|
||||
* @return the null
|
||||
*/
|
||||
public static Null get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Null() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NULL";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
/**
|
||||
* The sequence able.
|
||||
*
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
public interface Sequenceable {
|
||||
|
||||
/**
|
||||
* get sequence sql.
|
||||
*
|
||||
* @param expr the expr
|
||||
* @return sequence sql
|
||||
*/
|
||||
String getSequenceSql(SqlSequenceExpr expr);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
/**
|
||||
* sql default expression
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
public class SqlDefaultExpr {
|
||||
|
||||
private static SqlDefaultExpr instance = new SqlDefaultExpr();
|
||||
|
||||
/**
|
||||
* Get SqlDefaultExpr.
|
||||
*
|
||||
* @return the SqlDefaultExpr
|
||||
*/
|
||||
public static SqlDefaultExpr get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private SqlDefaultExpr() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DEFAULT";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* sql method invoke expression
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
public class SqlMethodExpr {
|
||||
|
||||
private static SqlMethodExpr instance = new SqlMethodExpr();
|
||||
|
||||
/**
|
||||
* Get SqlMethodExpr.
|
||||
*
|
||||
* @return the SqlMethodExpr
|
||||
*/
|
||||
public static SqlMethodExpr get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private SqlMethodExpr() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SQL_METHOD";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.struct;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* sql sequence expression
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
public class SqlSequenceExpr {
|
||||
|
||||
private String sequence;
|
||||
private String function;
|
||||
|
||||
public SqlSequenceExpr() {}
|
||||
|
||||
public SqlSequenceExpr(String sequence, String function) {
|
||||
this.sequence = sequence;
|
||||
this.function = function;
|
||||
}
|
||||
|
||||
public String getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public void setSequence(String sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
public String getFunction() {
|
||||
return function;
|
||||
}
|
||||
|
||||
public void setFunction(String function) {
|
||||
this.function = function;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.util;
|
||||
|
||||
/**
|
||||
* @author ggndnn
|
||||
*/
|
||||
public interface DbTypeParser {
|
||||
String parseFromJdbcUrl(String jdbcUrl);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.sqlparser.util;
|
||||
|
||||
/**
|
||||
* @author ggndnn
|
||||
*/
|
||||
public interface JdbcConstants {
|
||||
String ORACLE = "oracle";
|
||||
|
||||
String MYSQL = "mysql";
|
||||
|
||||
String DB2 = "db2";
|
||||
|
||||
String H2 = "h2";
|
||||
|
||||
String MARIADB = "mariadb";
|
||||
|
||||
String POSTGRESQL = "postgresql";
|
||||
}
|
||||
Reference in New Issue
Block a user