You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/09 07:49:30 UTC

[shardingsphere] branch master updated: create custom sql statments (#6306)

This is an automated email from the ASF dual-hosted git repository.

zhangyonglun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 94e80f7  create custom sql statments (#6306)
94e80f7 is described below

commit 94e80f7c9d79438acaf4e04094cd5c91c28294fd
Author: Juan Pan(Trista) <pa...@apache.org>
AuthorDate: Thu Jul 9 15:47:47 2020 +0800

    create custom sql statments (#6306)
---
 .../ddl/CreateDataSourceStatementContext.java      | 58 ++++++++++++++++++
 .../ddl/CreateShardingRuleStatementContext.java    | 71 ++++++++++++++++++++++
 .../statement/ddl/CreateDataSourceStatement.java   | 24 ++++++++
 .../statement/ddl/CreateShardingRuleStatement.java | 24 ++++++++
 4 files changed, 177 insertions(+)

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/ddl/CreateDataSourceStatementContext.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/ddl/CreateDataSourceStatementContext.java
new file mode 100644
index 0000000..6950d0a
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/ddl/CreateDataSourceStatementContext.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.binder.statement.ddl;
+
+import org.apache.shardingsphere.sql.parser.binder.statement.CommonSQLStatementContext;
+import org.apache.shardingsphere.sql.parser.sql.statement.ddl.CreateDataSourceStatement;
+
+/**
+ * Create dataSource statement context.
+ */
+public class CreateDataSourceStatementContext extends CommonSQLStatementContext<CreateDataSourceStatement> {
+    
+    public CreateDataSourceStatementContext(final CreateDataSourceStatement sqlStatement) {
+        super(sqlStatement);
+    }
+    
+    /**
+     * Get url.
+     *
+     * @return datasource url
+     */
+    public String getUrl() {
+        return "";
+    }
+    
+    /**
+     * Get username.
+     *
+     * @return username
+     */
+    public String getUsername() {
+        return "";
+    }
+    
+    /**
+     * Get password.
+     *
+     * @return password
+     */
+    public String getPassword() {
+        return "";
+    }
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/ddl/CreateShardingRuleStatementContext.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/ddl/CreateShardingRuleStatementContext.java
new file mode 100644
index 0000000..c947a29
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/ddl/CreateShardingRuleStatementContext.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.binder.statement.ddl;
+
+import org.apache.shardingsphere.sql.parser.binder.statement.CommonSQLStatementContext;
+import org.apache.shardingsphere.sql.parser.sql.statement.ddl.CreateShardingRuleStatement;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Properties;
+
+/**
+ * Create sharding rule statement context.
+ */
+public class CreateShardingRuleStatementContext extends CommonSQLStatementContext<CreateShardingRuleStatement> {
+    
+    public CreateShardingRuleStatementContext(final CreateShardingRuleStatement sqlStatement) {
+        super(sqlStatement);
+    }
+    
+    /**
+     * Get logic table.
+     *
+     * @return logic table
+     */
+    public String getLogicTable() {
+        return "";
+    }
+    
+    /**
+     * Get data sources.
+     *
+     * @return data sources
+     */
+    public Collection<String> getDataSources() {
+        return new LinkedList<>();
+    }
+    
+    /**
+     * Get sharding algorithm.
+     *
+     * @return sharding algorithm
+     */
+    public String getShardingAlgorithm() {
+        return "";
+    }
+    
+    /**
+     * Get algorithm properties.
+     *
+     * @return algorithm properties
+     */
+    public Properties getAlgorithmProperties() {
+        return new Properties();
+    }
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/ddl/CreateDataSourceStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/ddl/CreateDataSourceStatement.java
new file mode 100644
index 0000000..6090ba5
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/ddl/CreateDataSourceStatement.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.sql.statement.ddl;
+
+/**
+ * Create dataSource statement.
+ */
+public class CreateDataSourceStatement extends DDLStatement {
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/ddl/CreateShardingRuleStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/ddl/CreateShardingRuleStatement.java
new file mode 100644
index 0000000..cf0ca41
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/ddl/CreateShardingRuleStatement.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.sql.statement.ddl;
+
+/**
+ * Create sharding rule statement.
+ */
+public class CreateShardingRuleStatement extends DDLStatement {
+}