Viraj Jasani created PHOENIX-7646:
-------------------------------------
Summary: New PhoenixStatement API to return old row state in
Atomic Updates
Key: PHOENIX-7646
URL: https://issues.apache.org/jira/browse/PHOENIX-7646
Project: Phoenix
Issue Type: Improvement
Reporter: Viraj Jasani
PHOENIX-7462, PHOENIX-7398, PHOENIX-7434, PHOENIX-7411 and PHOENIX-7630 Jiras
have introduced support for PhoenixStatement to return ResultSet for updated
new row version.
The purpose of this Jira is to add support for returning the old row state
(before update) in atomic update operations. This enhancement allows
applications to retrieve the previous state of a row when performing
conditional updates, enabling better audit trails.
New API signature:
{code:java}
/**
* 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.
* If the row is successfully updated, return the old row (state before
update), otherwise
* if the row cannot be updated, return non-updated (old) row.
*
* @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.
*/
public Pair<Integer, ResultSet> executeAtomicUpdateReturnOldRow(String sql)
throws SQLException {{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)