Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bound values to simple statements are not logged #129

Open
etedpet opened this issue Oct 10, 2019 · 0 comments
Open

Bound values to simple statements are not logged #129

etedpet opened this issue Oct 10, 2019 · 0 comments

Comments

@etedpet
Copy link
Contributor

etedpet commented Oct 10, 2019

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.

@RhoderickGalero RhoderickGalero moved this to Todo issue in C2T Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant