Manu Chadha
Manu Chadha

Reputation: 16755

how do I find out if the update query was successful or not in Cassandra Datastax

I want to update a row. My code successfully updates the row but I found that the ResultSet doesn't give me useful information which I could use to conclude whether the update was successful or not.

I am creating the query as follows:

QueryBuilder.update(tableName).`with`(QueryBuilder.set("confirmed",model.profile.internalProfileDetails.get.confirmed))/*(QueryBuilder.set("authprovider",model.profile.internalProfileDetails.get.loginInfo.providerID)) 
      .and(QueryBuilder.set("id",model.id))
      .and(QueryBuilder.set("password",model.profile.internalProfileDetails.get.passwordInfo.get.password))
      .and(QueryBuilder.set("hasher",model.profile.internalProfileDetails.get.passwordInfo.get.hasher))
      .and(QueryBuilder.set("salt",""/*model.profile.internalProfileDetails.get.passwordInfo.get.salt.get*/)) 
      .where(QueryBuilder.eq("bucket", id.bucket)) 
      .and(QueryBuilder.eq("email", id.email))
      .and(QueryBuilder.eq("authprovider", id.authProvider))
      .and(QueryBuilder.eq("firstname",id.firstName))
      .and(QueryBuilder.eq("lastname",id.lastName))

I then use session.execute

println("update Query: "+updateQuery)
    val resultSet = session.execute(updateQuery)
    println("resultSet from update: "+resultSet)

But the ResultSet which gets printed is resultSet from update: ResultSet[ exhausted: true, Columns[]]. It really doesn't tell me whether the operation was successful or not. How can I find out if the operation was successful or not?

Upvotes: 2

Views: 1807

Answers (1)

Alex Ott
Alex Ott

Reputation: 87359

It's the same as with INSERT - if you didn't get exception back, the operation is performed, and confirmed with given consistency level (ONE by default).

Upvotes: 2

Related Questions