You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/05/11 11:53:38 UTC

[GitHub] [shardingsphere] tristaZero commented on a change in pull request #10305: support postgresql prepare, execute, deallocate statement

tristaZero commented on a change in pull request #10305:
URL: https://github.com/apache/shardingsphere/pull/10305#discussion_r630096693



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLPrepareStatement.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.dialect.statement.postgresql.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DeleteStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.UpdateStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
+
+import java.util.Optional;
+
+/**
+ * PostgreSQL prepare statement.
+ */
+@ToString
+@Getter
+@Setter
+public final class PostgreSQLPrepareStatement extends AbstractSQLStatement implements DDLStatement, PostgreSQLStatement {
+    
+    private SelectStatement select;

Review comment:
       Do you think it will be better if there is only one field, i.e., `private SQLStatement statement;`?
   Therefore, the following function will be,
   ```java
   public Optional<SelectStatement> getSelect() {
           return  SQLStatement instanceof `SelectStatement` ? Optional.ofNullable(select) : xxx;
       }
   ```
   Actually, I am unsure whether these functions will be used properly since you still need to judge the `optional.isPresent()` for each of them, don't you?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org