Skip to content

Instantly share code, notes, and snippets.

@emmanuelbernard
Created May 15, 2015 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emmanuelbernard/13d22d15dc983a83a7e2 to your computer and use it in GitHub Desktop.
Save emmanuelbernard/13d22d15dc983a83a7e2 to your computer and use it in GitHub Desktop.
HEre is the output
*** For statementINSERT INTO "Bookmark"("id","isPrivate","isShared","stockCount","isRead") VALUES (?,?,?,?,?);
index: 0 data type: varchar columnValue: 2cb2b441-46a5-47af-aabe-e30a5b102ea6
*** For statementINSERT INTO "Bookmark"("id","isPrivate","isShared","stockCount","isRead") VALUES (?,?,?,?,?);
index: 1 data type: varchar columnValue: F
From the following code change
private ResultSet bindAndExecute(Object[] columnValues, RegularStatement statement) {
try {
PreparedStatement preparedStatement = session.prepare( statement );
BoundStatement boundStatement = new BoundStatement( preparedStatement );
for ( int i = 0; i < columnValues.length; i++ ) {
DataType dataType = preparedStatement.getVariables().getType( i );
// FIXME Code change here
System.out.println(
"*** For statement" + statement + " \n\tindex: " + i + " data type: " + preparedStatement.getVariables()
.getType( i ) + " columnValue: " + columnValues[i] );
boundStatement.setBytesUnsafe( i, dataType.serialize( columnValues[i], protocolVersion ) );
}
return session.execute( boundStatement );
}
catch (DriverException e) {
log.failToExecuteCQL( statement.getQueryString(), e );
throw e;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment