virajjasani commented on code in PR #2199:
URL: https://github.com/apache/phoenix/pull/2199#discussion_r2163097892


##########
phoenix-core-client/src/main/java/org/apache/phoenix/execute/MutationState.java:
##########
@@ -2393,7 +2402,8 @@ public boolean isEmpty() {
     }
 
     public enum ReturnResult {
-        ROW
+        ROW,
+        OLD_ROW

Review Comment:
   Sounds good, let me update them.



##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java:
##########
@@ -2501,6 +2503,33 @@ public Pair<Integer, ResultSet> 
executeAtomicUpdateReturnRow(String sql) throws
         return result;
     }
 
+    /**
+     * Executes the given SQL statement similar to JDBC API executeUpdate() 
but also returns the
+     * old row (before update) as Result object back to the client. This must 
be used with
+     * auto-commit Connection. This makes the operation atomic.
+     * Return the old row (state before update) regardless of whether the 
update is
+     * successful or not.
+     *
+     * @param sql The SQL DML statement, UPSERT or DELETE for Phoenix.
+     * @return The pair of int and ResultSet, where int represents value 1 for 
successful row
+     * update and 0 for non-successful row update, and ResultSet represents 
the old state of the
+     * row.
+     * @throws SQLException If the statement cannot be executed.
+     */
+    // Note: Do Not remove this, it is expected to be used by downstream 
applications
+    public Pair<Integer, ResultSet> executeAtomicUpdateReturnOldRow(String sql)

Review Comment:
   That's right, however, the only part that Phoenix clients usually take thick 
client dependency (for imports) of is `PhoenixConnection` or `PhoenixStatement` 
or `PhoenixPreparedStatement`. Everything else comes from standard JDBC classes 
only, starting from `DriverManager`.



-- 
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: issues-unsubscr...@phoenix.apache.org

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

Reply via email to