Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fa3cbed

Browse files
CodeSmellmp911de
authored andcommitted
DATACASS-555 - Use CqlTemplate.newPreparedStatementCreator for creation of PreparedStatementCreator.
Original pull request: #133.
1 parent 8c071e7 commit fa3cbed

File tree

1 file changed

+3
-22
lines changed
  • spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql

1 file changed

+3
-22
lines changed

‎spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/CqlTemplate.java‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
* @author Antoine Toulme
7070
* @author John Blum
7171
* @author Mark Paluch
72+
* @author Mike Barlotta (CodeSmell)
73+
*
7274
* @see PreparedStatementCreator
7375
* @see PreparedStatementBinder
7476
* @see PreparedStatementCallback
@@ -404,7 +406,7 @@ public boolean execute(String cql, Object... args) throws DataAccessException {
404406
@Override
405407
public boolean execute(String cql, @Nullable PreparedStatementBinder psb) throws DataAccessException {
406408
// noinspection ConstantConditions
407-
return query(newSimplePreparedStatementCreator(cql), psb, ResultSet::wasApplied);
409+
return query(newPreparedStatementCreator(cql), psb, ResultSet::wasApplied);
408410
}
409411

410412
/*
@@ -734,25 +736,4 @@ private Session getCurrentSession() {
734736
return sessionFactory.getSession();
735737
}
736738

737-
private class SimplePreparedStatementCreator implements PreparedStatementCreator, CqlProvider {
738-
739-
private final String cql;
740-
741-
SimplePreparedStatementCreator(String cql) {
742-
743-
Assert.notNull(cql, "CQL must not be null");
744-
745-
this.cql = cql;
746-
}
747-
748-
@Override
749-
public PreparedStatement createPreparedStatement(Session session) throws DriverException {
750-
return session.prepare(cql);
751-
}
752-
753-
@Override
754-
public String getCql() {
755-
return cql;
756-
}
757-
}
758739
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /