Skip to content

Commit

Permalink
Merge pull request #261 from Netflix/fix-bound-statement
Browse files Browse the repository at this point in the history
fix bound statement
  • Loading branch information
workeatsleep authored Jun 9, 2021
2 parents 0b88b07 + 39aea68 commit e22f93c
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ protected CassJavaDriverGeneric(
@Override public String readSingle(String key) throws Exception {
int nRows = 0;

BoundStatement bStmt = readPstmt.bind();
bStmt.setString("key", key);
bStmt.setConsistencyLevel(consistencyLevel(config.getReadConsistencyLevel()));
BoundStatement bStmt = readPstmt.bind()
.setString("key", key)
.setConsistencyLevel(consistencyLevel(config.getReadConsistencyLevel()));
ResultSet rs = session.execute(bStmt);
List<Row> result=rs.all();

Expand Down Expand Up @@ -130,12 +130,10 @@ private ConsistencyLevel consistencyLevel(String consistencyLevelConfig) {

private BoundStatement getWriteBStmt(String key, int col)
{
BoundStatement bStmt = writePstmt.bind();
bStmt.setString("key", key);
bStmt.setInt("column1", col);
BoundStatement bStmt = writePstmt.bind().setString("key", key).setInt("column1", col);
for (int i = 0; i < config.getColsPerRow(); i++)
{
bStmt.setString(getValueColumnName(i), this.dataGenerator.getRandomValue());
bStmt = bStmt.setString(getValueColumnName(i), this.dataGenerator.getRandomValue());
}
return bStmt;
}
Expand Down

0 comments on commit e22f93c

Please sign in to comment.