Bug #39875 Primary key read on tuple that does not exists is not handled properly (Java)
Submitted: 6 Oct 2008 9:29 Modified: 18 Dec 2008 19:11
Reporter: Alexander Yu Email Updates:
Status: Closed Impact on me:
None 
Category:Connectors: NDB/Bindings Severity:S2 (Serious)
Version:0.70 OS:Linux (2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008 i686 GNU/Linux)
Assigned to: Jess Balint CPU Architecture:Any
Tags: java

[6 Oct 2008 9:29] Alexander Yu
Description:
Doing a  primary key read on a tuple that does not exists is not correctly handled by NdbResultSet.
NdbResultSet.next() returns true even though the row does not exist.

--
NDB: mysql-5.1.27 ndb-6.3.17
OS: Ubuntu 8.04, 2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008 i686 GNU/Linux
Java: "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

How to repeat:
NdbOperation operation = transaction.getSelectOperation(NDBJUtil.SIMPLE_TABLE_NAME,
					NdbOperation.LockMode.LM_CommittedRead);
int id = 30;
operation.equalInt("id", id);
operation.getValue("firstname");
operation.getValue("lastname");
transaction.execute(ExecType.Commit, AbortOption.AbortOnError, true);
NdbResultSet rs = operation.resultData();
if (rs.next()) {
  String firstName = rs.getString("firstname");
  String lastName = rs.getString("lastname");
  System.out.println("ID:" + id + ", FIRSTNAME: " + firstName + ", LASTNAME: " + lastName);
} else {
  System.out.println("No user found.");
}
[18 Dec 2008 19:11] Jess Balint
Fix pushed, will be released in 0.7.2.