ClientPreparedStatement had a public method in the mysql-connector-java library called asSql() that I found to be quite helpful, however it was deleted in April of this year, and the code passed over to the mysql-connector-j project. I used it in a QueryInterceptor so that I could give AWS X-ray subsegments a name that made sense. I can immediately identify any lengthy searches in my AWS lambda function by looking at the X-ray trace and labelling each subsegment with the start of each query. As I attempted to update my programme today to mysql-connector-j, or at the very least the most recent version of mysql-connector-java, I discovered that the asSql() function on ClientPreparedStatement no longer existed.
I went back through the mysql-connector-java releases and discovered that the function was included in the 8.0.28 jar (Jan. 17, 2022) but eliminated in the 8.0.29 version (Apr 25, 2022). To my knowledge, it was never marked as deprecated.
I discovered that by using ClientPreparedStatement.toString(), I was able to retrieve the same query with the addition of "com.mysql.cj.jdbc.ClientPreparedStatement: ". Of course, I could have removed this, but doing so would have resulted in a tight coupling of my app to a feature that might change in a later release. So, I'd prefer not take this on.
Is there any way to use a ClientPreparedStatement's asSql() functionality?