You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Haonan Hou (Jira)" <ji...@apache.org> on 2020/11/30 07:43:00 UTC

[jira] [Commented] (IOTDB-1031) insert a record use jdbc execute method , get a wrong status.

    [ https://issues.apache.org/jira/browse/IOTDB-1031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240528#comment-17240528 ] 

Haonan Hou commented on IOTDB-1031:
-----------------------------------

Hi, I don't think this is a bug.

According to the javadoc of java.sql.Statement, it should return false if there is no results. Therefore I don't think insert statement should get true from this method.
{code:java}
    /**
     * Executes the given SQL statement, which may return multiple results.
     * In some (uncommon) situations, a single SQL statement may return
     * multiple result sets and/or update counts.  Normally you can ignore
     * this unless you are (1) executing a stored procedure that you know may
     * return multiple results or (2) you are dynamically executing an
     * unknown SQL string.
     * <P>
     * The <code>execute</code> method executes an SQL statement and indicates the
     * form of the first result.  You must then use the methods
     * <code>getResultSet</code> or <code>getUpdateCount</code>
     * to retrieve the result, and <code>getMoreResults</code> to
     * move to any subsequent result(s).
     * <p>
     *<strong>Note:</strong>This method cannot be called on a
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
     * @param sql any SQL statement
     * @return <code>true</code> if the first result is a <code>ResultSet</code>
     *         object; <code>false</code> if it is an update count or there are
     *         no results
     * @exception SQLException if a database access error occurs,
     * this method is called on a closed <code>Statement</code>,
     * the method is called on a
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
     * @throws SQLTimeoutException when the driver has determined that the
     * timeout value that was specified by the {@code setQueryTimeout}
     * method has been exceeded and has at least attempted to cancel
     * the currently running {@code Statement}
     * @see #getResultSet
     * @see #getUpdateCount
     * @see #getMoreResults
     */
    boolean execute(String sql) throws SQLException;
{code}

> insert a record use jdbc execute method , get a wrong status.
> -------------------------------------------------------------
>
>                 Key: IOTDB-1031
>                 URL: https://issues.apache.org/jira/browse/IOTDB-1031
>             Project: Apache IoTDB
>          Issue Type: Bug
>          Components: JDBC
>            Reporter: lming
>            Priority: Major
>
> insert a record use jdbc execute method , the insertion is correct infact,but the status get back a false.
> stmt.execute("SQL") 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)