Created
December 18, 2016 01:47
-
-
Save bryder/3d119c84e4a5581eb620fc6be718eb39 to your computer and use it in GitHub Desktop.
Prepare a sql statement in java and print it as a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Object> params = Lists.newArrayList(); | |
if (logger.isDebugEnabled()){ | |
try { | |
PreparedStatement ps = this.getConnection().prepareStatement(q); | |
for (int i=0 ; i < params.size(); i++){ | |
ps.setObject(i+1, params.get(i)); | |
} | |
logger.debug("Build this {}", ps); | |
} catch (Exception e) { | |
logger.debug("Problem getting prepared statement{}", e); | |
} | |
} | |
// works in a standard dso. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment