Bug 57322 - JDBC: add methods to deal with ResultSets(cursors) returned by callable statements
Summary: JDBC: add methods to deal with ResultSets(cursors) returned by callable state...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2014-12-07 00:51 UTC by Yngvi Þór Sigurjónsson
Modified: 2014-12-15 21:04 UTC (History)
1 user (show)



Attachments
Patch to add ResultSet returned from Callable Statements. (8.65 KB, patch)
2014-12-07 00:51 UTC, Yngvi Þór Sigurjónsson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yngvi Þór Sigurjónsson 2014-12-07 00:51:35 UTC
Created attachment 32265 [details]
Patch to add ResultSet returned from Callable Statements.

In Oracle it is a common practice to return queries from stored procedures as a construct called refcursor. Refcursors are then returned as ResultSets to Java and if you really want to do thorough load test you actually have to loop through the whole result set. The current code does not iterate through those ResultSet and stores the ResultSet as string so it is not possible to do any further processing on it. If the ResultSet is stored as a Object they can actually be iterated in JSR223 of BeanShell script. It would also be nice if the JDBC sampler would actually just iterate through the RS by itself.

Attached is a patch for your consideration, that adds the code and configuration options for dealing with ResultSets : Store as String, Store as Object, and Count Records. 

Regards 
Yngvi
Comment 1 Philippe Mouawad 2014-12-15 20:51:49 UTC
Date: Mon Dec 15 20:47:22 2014
New Revision: 1645746

URL: http://svn.apache.org/r1645746
Log:
Bug 57322 - JDBC: add methods to deal with ResultSets(cursors) returned by callable statements
Bugzilla Id: 57322

Modified:
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/JDBCTestElementBeanInfoSupport.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPostProcessorResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPreProcessorResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSamplerResources.properties
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml
Comment 2 Philippe Mouawad 2014-12-15 20:53:42 UTC
Hello,
Thanks for contribution.
I commited code with a fix to the count of rows as I think there was a bug in :
                            else if( RS_COUNT_RECORDS.equals(resultSetHandler))

270 	

                                jmvars.put(name,o.toString()+" "+((java.sql.ResultSet)o).getRow()+" rows");

It would be great to test nightly build and tell us if it works for you as you wanted it to .

Thanks
Regards
Philippe M.
@philmdot
Comment 3 Philippe Mouawad 2014-12-15 21:04:26 UTC
Date: Mon Dec 15 21:03:31 2014
New Revision: 1645749

URL: http://svn.apache.org/r1645749
Log:
Bug 57322 - JDBC: add methods to deal with ResultSets(cursors) returned by callable statements
Add missing FR translations
Bugzilla Id: 57322

Modified:
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPostProcessorResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPreProcessorResources_fr.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSamplerResources_fr.properties