[CONJ-365] I want to retrieve the original affected rows (server returned) instead of rewritten affected rows when rewriteBatchedStatements=true. Created: 2016-10-10  Updated: 2017-12-12  Resolved: 2017-12-12

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.5.2, 1.5.3
Fix Version/s: 2.2.1, 1.7.1

Type: Task Priority: Minor
Reporter: Seonmi Anderson Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

AWS RDS Aurora 5.6.10a
mariadb-java-client 1.5.3



 Description   

When rewriteBatchedStatement=true is set, INSERT SQL is rewritten the values in a single query and only single value of affected rows is returned. I am trying to get the ORIGINAL affected rows that server sent before the affected rows are rewritten by 1, SUCCESS_WITH_NO_INFO, or -3.

It seems if the insert statement is re-written as multiple queries instead of re-written values in one query, I am able to get the accurate update counts (correct me if I am wrong) but it won't allow under the current implementation. If insert statement doesn't contain 'insert .... select' as sub query or followed by another statement (create, update, ...), it won't set the reWritablePrepare=false in ClientPrepareResult constructor. Please inform me if I can have other way to get the affected rows (before updating them) for the bulk insert.



 Comments   
Comment by Diego Dupin [ 2017-12-12 ]

non JDBC method getServerUpdateCounts() has been added
available from snapshot :

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>
 
<dependencies>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>2.2.1-SNAPSHOT</version>
    </dependency>
</dependencies>

Generated at Thu Feb 08 03:15:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.