You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/11/17 09:27:58 UTC

[GitHub] [ignite-3] ascherbakoff commented on a change in pull request #326: IGNITE-15212 Add SQL API

ascherbakoff commented on a change in pull request #326:
URL: https://github.com/apache/ignite-3/pull/326#discussion_r751051613



##########
File path: modules/api/src/main/java/org/apache/ignite/sql/Statement.java
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.ignite.sql;
+
+import java.util.concurrent.TimeUnit;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * The object represents parameterized SQL query statement that supports batched query, and provides methods for managing it`s state.
+ */
+public interface Statement {
+    /**
+     * Returns SQL statement string representation.
+     *
+     * @return SQL statement string.
+     */
+    String query();
+    
+    /**
+     * Returns SQL statement parameters.
+     *
+     * @return SQL statement parameters.
+     */
+    Object[] parameters();
+    
+    /**
+     * Sets SQL statement parameters.
+     *
+     * @param parameters SQL statement parameters.
+     * @return {@code this} for chaining.
+     */
+    Statement parameters(Object... parameters);
+    
+    /**
+     * Sets a SQL statement parameter value by the parameter index.
+     *
+     * @param parameterIndex Parameter index.
+     * @param parameterValue Parameter value.
+     * @return {@code this} for chaining.
+     */
+    Statement parameter(int parameterIndex, Object parameterValue);
+    
+    /**
+     * Resets batch state and clears query parameters.
+     *
+     * @return {@code this} for chaining.
+     */
+    Statement resetState();
+    
+    /**
+     * Adds a set of parameters to this statement object's batch of commands.
+     *
+     * @return {@code this} for chaining.
+     */
+    Statement addBatch() throws SqlException;

Review comment:
       Need an example

##########
File path: modules/api/src/main/java/org/apache/ignite/sql/SqlException.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.ignite.sql;
+
+import org.apache.ignite.lang.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * SQL exception base class.
+ */
+//TODO: Do we want to use this instead of java.sql.SQLException ?

Review comment:
       Most likely we don't want.

##########
File path: modules/api/src/main/java/org/apache/ignite/sql/IgniteSql.java
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.ignite.sql;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Ignite SQL query facade.
+ */
+public interface IgniteSql {
+    /**
+     * Creates SQL session.
+     *
+     * @return Session.
+     */
+    Session newSession();

Review comment:
       Do we really need a session entity ? IgniteSql can be used instead

##########
File path: modules/api/src/main/java/org/apache/ignite/sql/async/AsyncSession.java
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.ignite.sql.async;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.sql.SqlException;
+import org.apache.ignite.sql.Statement;
+
+/**
+ * Async Session provides methods for asynchronous query execution.
+ */
+public interface AsyncSession {

Review comment:
       Why just not use R2DBC for async API  and JDBC for sync API ?




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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