virajjasani opened a new pull request, #2199:
URL: https://github.com/apache/phoenix/pull/2199
Jira: PHOENIX-7646
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 PR 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:
```
/**
* 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 {
```
--
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]