virajjasani commented on code in PR #1967:
URL: https://github.com/apache/phoenix/pull/1967#discussion_r1744640862
##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java:
##########
@@ -2376,17 +2393,42 @@ public ResultSet executeQuery(String sql) throws
SQLException {
@Override
public int executeUpdate(String sql) throws SQLException {
+ CompilableStatement stmt = preExecuteUpdate(sql);
+ int updateCount = executeMutation(stmt, createAuditQueryLogger(stmt,
sql));
+ flushIfNecessary();
+ return updateCount;
+ }
+
+ /**
+ * Executes the given SQL statement similar to JDBC API executeUpdate()
but also returns the
+ * updated or non-updated row as Result object back to the client. This
must be used with
+ * auto-commit Connection. This makes the operation atomic.
+ * If the row is successfully updated, return the updated row, otherwise
if the row
+ * cannot be updated, return non-updated row.
+ *
+ * @param sql The SQL DML statement, UPSERT or DELETE for Phoenix.
+ * @return The pair of int and Result, where int represents value 1 for
successful row update
+ * and 0 for non-successful row update, and Result represents the state of
the row.
+ * @throws SQLException If the statement cannot be executed.
+ */
+ public Pair<Integer, Result> executeUpdateReturnRow(String sql) throws
SQLException {
Review Comment:
Yes, used `Tuple` interface in the latest revision.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]