virajjasani commented on code in PR #1967:
URL: https://github.com/apache/phoenix/pull/1967#discussion_r1744372428
##########
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, i also agree with it, but what i meant is that the whole ResultSet
interface in Phoenix is built on top of RowProjector, ResultIterator and
StatementContext.
We do not have support for 1:1 HBase Result to Phoenix ResultSet conversion
support. It would be interesting to build one but i think it should not be
scope of this work.
--
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]