-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Bound values to prepared statements are nicely logged by ecAudit.
For example:
PreparedStatement preparedStatement = session.prepare("INSERT INTO dataks.tbl (key, value) VALUES (?, ?)");
testSession.execute(preparedStatement.bind("myKey", 42));
Will log:
"INSERT INTO dataks.tbl (key, value) VALUES (?, ?)['myKey', 42]"
But it is also possible to provide bound values to simple statements, see:
https://docs.datastax.com/en/developer/java-driver/3.7/manual/statements/simple/#using-values
Example:
session.execute("SELECT * FROM dataks.tbl WHERE key = ?", 42)
Will "only" log the statement, not the bound value:
"SELECT * FROM dataks.tbl WHERE key = ?"
In AuditQueryHandler (the plugin-pint for ecAudit) the process(...) method is called for simple statements. The problem here is that the QueryOptions object does not have a ColumnSpecification which is needed to convert the bound values into strings.
Investigate if this can be accomplished in a "simple way", to be able to reuse the code for stringifying bound values for prepared statements.