db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-3676) Make the toString() method of Derby PreparedStatements print out SQL text with ? parameters replaced by the values that have been set so far
Date Tue, 16 Aug 2011 13:19:28 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085684#comment-13085684
] 

Kathey Marsden commented on DERBY-3676:
---------------------------------------

On The test
PreparedStatementTest is in the jdbc4 directory so that means it only runs with JDK 1.6 and
higher.
PrepareStatementTest is in the derbynet directiory and is a conversion of  a test that tested
some specific corner cases for client/server. The comment says.
/**
 * This Junit test class tests the JDBC PreparedStatement.  This test
 * is a Junit version of the old prepStmt.java test.  That test tested
 * prepared statements in client/server context, and many of the test
 * cases is specifically testing corner cases in client/server
 * communication.  However, this Junit test is set up to run as part
 * of both the embedded and client/server test suites.
 */

Since conversion the latter also runs with embedded so I guess it would make sense to move
it to jdbcapi although it is not a comprehensive test of PreparedStatement functionality.

Probably the best test if you want to see the behavior with all the parameter types might
be ParameterMappingTest.

On the functionality, I have lost sight of the final formatting solution.  It would seem to
make sense to match the output for derby.language.logStatementText=true plus include identifier
of the compiled plan. Also I still prefer using toString() rather than a different method
because a different method will require users to either use reflection or cast to the internal
Derby types.





> Make the toString() method of Derby PreparedStatements print out SQL text with ? parameters
replaced by the values that have been set so far
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3676
>                 URL: https://issues.apache.org/jira/browse/DERBY-3676
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>            Reporter: Rick Hillegas
>            Assignee: Siddharth Srivastava
>         Attachments: humanstringprepared.txt, humanstringprepared.txt, humanstringprepared.txt,
humanstringprepared.txt, humanstringprepared.txt, humanstringprepared.txt, humanstringprepared.txt,
ick.txt, ick.txt, prepared.diff, statementCacheVTI.sql
>
>
> This topic came up in the following email thread on the user list: http://www.nabble.com/PreparedStatement.toString%28%29---nice-formatting-td17250811.html#a17250811
Here's what the thread requests: 
> "In mysql, a toString() on a PreparedStatement will do this, eg "select x
> from foo where x.a = ?" will become "select x from foo where x.a = 1" with
> the appropriate setValue() call."
> At first blush, this seems like it might be a simple project for a newcomer.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message