I am wondering what is the advantage of using BoundStatementover PreparedStatement?
PreparedStatement statement = session.prepare(
"INSERT INTO simplex.songs " +
"(id, title, album, artist) " +
"VALUES (?, ?, ?, ?);");
BoundStatement boundStatement = new BoundStatement(statement);
session.execute(boundStatement.bind(
UUID.fromString("756716f7-2e54-4715-9f00-91debea6cf50"),
"La Petite Tonkinoise",
"Bye Bye Blackbird",
"Joséphine Baker");
The easiest way:
PreparedStatement ps = session.prepare(
"INSERT INTO simplex.songs " +
"(id, title, album, artist, tags) " +
"VALUES (?, ?, ?, ?, ?);");
ps.bind(UUID.fromString("756716f7-2e54-4715-9f00-91debea6cf50"),
"La Petite Tonkinoise",
"Bye Bye Blackbird",
"Joséphine Baker");
As you can see, I can bind data to PreparedStatementwithout boundStatements. Where BoundStatementis useful?
source
share