View | Details | Raw Unified | Return to bug 57322
Collapse All | Expand All

(-)docs/usermanual/component_reference.html (+15 lines)
Lines 1988-1993 Link Here
1988
No
1988
No
1989
</td>
1989
</td>
1990
</tr>
1990
</tr>
1991
<td>Handle ResultSet</td>
1992
<td>
1993
Defines how ResultSet returned from callable statements be handled:
1994
<ul>
1995
  <li> Store As String (default) - All variables on Variable Names list are stored as strings, will not iterate through a ResultSets when present on the list.</li>
1996
  <li> Store As Object - Variables of ResultSet type on Variables Names list will be stored as Object and can be accessed in subsequent tests/scripts and iterated, will not iterate through the ResultSet </li>
1997
  <li> Count Records - Variables of ResultSet types will be iterated through showing the count of records as result. Variables will be stored as Strings.</li>
1998
1999
</ul>
2000
</td>
2001
<td>
2002
No
2003
</td>
2004
</tr>
2005
1991
</table>
2006
</table>
1992
</p>
2007
</p>
1993
<p><b>See Also:</b>
2008
<p><b>See Also:</b>
(-)src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java (-1 / +34 lines)
Lines 108-113 Link Here
108
    static final String AUTOCOMMIT_FALSE = "AutoCommit(false)"; // $NON-NLS-1$
108
    static final String AUTOCOMMIT_FALSE = "AutoCommit(false)"; // $NON-NLS-1$
109
    static final String AUTOCOMMIT_TRUE  = "AutoCommit(true)"; // $NON-NLS-1$
109
    static final String AUTOCOMMIT_TRUE  = "AutoCommit(true)"; // $NON-NLS-1$
110
110
111
    static final String RS_STORE_AS_STRING = "Store as String"; // $NON-NLS-1$
112
    static final String RS_STORE_AS_OBJECT = "Store as Object"; // $NON-NLS-1$
113
    static final String RS_COUNT_RECORDS = "Count Records"; // $NON-NLS-1$
114
111
    private String query = ""; // $NON-NLS-1$
115
    private String query = ""; // $NON-NLS-1$
112
116
113
    private String dataSource = ""; // $NON-NLS-1$
117
    private String dataSource = ""; // $NON-NLS-1$
Lines 116-121 Link Here
116
    private String queryArguments = ""; // $NON-NLS-1$
120
    private String queryArguments = ""; // $NON-NLS-1$
117
    private String queryArgumentsTypes = ""; // $NON-NLS-1$
121
    private String queryArgumentsTypes = ""; // $NON-NLS-1$
118
    private String variableNames = ""; // $NON-NLS-1$
122
    private String variableNames = ""; // $NON-NLS-1$
123
    private String resultSetHandler = RS_STORE_AS_STRING; 
119
    private String resultVariable = ""; // $NON-NLS-1$
124
    private String resultVariable = ""; // $NON-NLS-1$
120
    private String queryTimeout = ""; // $NON-NLS-1$
125
    private String queryTimeout = ""; // $NON-NLS-1$
121
126
Lines 242-247 Link Here
242
                    sb.append(i+1);
247
                    sb.append(i+1);
243
                    sb.append("] ");
248
                    sb.append("] ");
244
                    sb.append(o);
249
                    sb.append(o);
250
                    if( o instanceof java.sql.ResultSet && RS_COUNT_RECORDS.equals(resultSetHandler)) {
251
                        int j=0;
252
                        while(((java.sql.ResultSet)o).next())
253
                            j++;
254
                        sb.append(" "+j+" rows");
255
                    }
245
                    sb.append("\n");
256
                    sb.append("\n");
246
                }
257
                }
247
            }
258
            }
Lines 252-258 Link Here
252
                    String name = varnames[i].trim();
263
                    String name = varnames[i].trim();
253
                    if (name.length()>0){ // Save the value in the variable if present
264
                    if (name.length()>0){ // Save the value in the variable if present
254
                        Object o = outputValues.get(i);
265
                        Object o = outputValues.get(i);
255
                        jmvars.put(name, o == null ? null : o.toString());
266
                        if( o instanceof java.sql.ResultSet ) 
267
                            if(  RS_STORE_AS_OBJECT.equals(resultSetHandler))
268
                                jmvars.putObject(name, o);
269
                            else if( RS_COUNT_RECORDS.equals(resultSetHandler))
270
                                jmvars.put(name,o.toString()+" "+((java.sql.ResultSet)o).getRow()+" rows");
271
                            else
272
                                jmvars.put(name, o.toString());
273
                        else
274
                            jmvars.put(name, o == null ? null : o.toString());
256
                    }
275
                    }
257
                }
276
                }
258
            }
277
            }
Lines 596-601 Link Here
596
    }
615
    }
597
616
598
    /**
617
    /**
618
     * @return the resultSetHandler
619
     */
620
    public String getResultSetHandler() {
621
        return resultSetHandler;
622
    }
623
624
    /**
625
     * @param resultSetHandler the resultSetHandler to set
626
     */
627
    public void setResultSetHandler(String resultSetHandler) {
628
        this.resultSetHandler = resultSetHandler;
629
    }
630
631
    /**
599
     * @return the resultVariable
632
     * @return the resultVariable
600
     */
633
     */
601
    public String getResultVariable() {
634
    public String getResultVariable() {
(-)src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/JDBCTestElementBeanInfoSupport.java (-1 / +13 lines)
Lines 43-49 Link Here
43
                "queryArgumentsTypes", // $NON-NLS-1$
43
                "queryArgumentsTypes", // $NON-NLS-1$
44
                "variableNames", // $NON-NLS-1$
44
                "variableNames", // $NON-NLS-1$
45
                "resultVariable", // $NON-NLS-1$
45
                "resultVariable", // $NON-NLS-1$
46
                "queryTimeout" // $NON-NLS-1$
46
                "queryTimeout", // $NON-NLS-1$
47
                "resultSetHandler" // $NON-NLS-1$
47
                });
48
                });
48
49
49
        PropertyDescriptor p = property("dataSource"); // $NON-NLS-1$
50
        PropertyDescriptor p = property("dataSource"); // $NON-NLS-1$
Lines 62-67 Link Here
62
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
63
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
63
        p.setValue(DEFAULT, ""); // $NON-NLS-1$
64
        p.setValue(DEFAULT, ""); // $NON-NLS-1$
64
65
66
67
        p = property("resultSetHandler"); // $NON-NLS-1$
68
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
69
        p.setValue(DEFAULT, AbstractJDBCTestElement.RS_STORE_AS_STRING);
70
        p.setValue(NOT_OTHER, Boolean.TRUE);
71
        p.setValue(TAGS,new String[]{
72
                AbstractJDBCTestElement.RS_STORE_AS_STRING,
73
                AbstractJDBCTestElement.RS_STORE_AS_OBJECT,
74
                AbstractJDBCTestElement.RS_COUNT_RECORDS
75
                });       
76
65
        p = property("resultVariable"); // $NON-NLS-1$
77
        p = property("resultVariable"); // $NON-NLS-1$
66
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
78
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
67
        p.setValue(DEFAULT, ""); // $NON-NLS-1$
79
        p.setValue(DEFAULT, ""); // $NON-NLS-1$
(-)src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPostProcessorResources.properties (+2 lines)
Lines 28-33 Link Here
28
queryArgumentsTypes.shortDescription=JDBC Type names from java.sql.Types. VARCHAR, INTEGER, etc. (comma separated)
28
queryArgumentsTypes.shortDescription=JDBC Type names from java.sql.Types. VARCHAR, INTEGER, etc. (comma separated)
29
variableNames.displayName=Variable names
29
variableNames.displayName=Variable names
30
variableNames.shortDescription=Output variable names for each column  (comma separated)
30
variableNames.shortDescription=Output variable names for each column  (comma separated)
31
resultSetHandler.displayName=Handle ResultSet
32
resultSetHandler.shortDescription=How should return values of type ResultSet be handled
31
resultVariable.displayName=Result variable name
33
resultVariable.displayName=Result variable name
32
resultVariable.shortDescription=Name of the JMeter variable that stores the result set objects in a list of maps for looking up results by column name.
34
resultVariable.shortDescription=Name of the JMeter variable that stores the result set objects in a list of maps for looking up results by column name.
33
queryTimeout.displayName=Query timeout
35
queryTimeout.displayName=Query timeout
(-)src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPreProcessorResources.properties (+2 lines)
Lines 28-33 Link Here
28
queryArgumentsTypes.shortDescription=JDBC Type names from java.sql.Types. VARCHAR, INTEGER, etc. (comma separated)
28
queryArgumentsTypes.shortDescription=JDBC Type names from java.sql.Types. VARCHAR, INTEGER, etc. (comma separated)
29
variableNames.displayName=Variable names
29
variableNames.displayName=Variable names
30
variableNames.shortDescription=Output variable names for each column  (comma separated)
30
variableNames.shortDescription=Output variable names for each column  (comma separated)
31
resultSetHandler.displayName=Handle ResultSet
32
resultSetHandler.shortDescription=How should return values of type ResultSet be handled
31
resultVariable.displayName=Result variable name
33
resultVariable.displayName=Result variable name
32
resultVariable.shortDescription=Name of the JMeter variable that stores the result set objects in a list of maps for looking up results by column name.
34
resultVariable.shortDescription=Name of the JMeter variable that stores the result set objects in a list of maps for looking up results by column name.
33
queryTimeout.displayName=Query timeout
35
queryTimeout.displayName=Query timeout
(-)src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSamplerResources.properties (+2 lines)
Lines 28-33 Link Here
28
queryArgumentsTypes.shortDescription=JDBC Type names from java.sql.Types. VARCHAR, INTEGER, etc. (comma separated)
28
queryArgumentsTypes.shortDescription=JDBC Type names from java.sql.Types. VARCHAR, INTEGER, etc. (comma separated)
29
variableNames.displayName=Variable names
29
variableNames.displayName=Variable names
30
variableNames.shortDescription=Output variable names for each column  (comma separated)
30
variableNames.shortDescription=Output variable names for each column  (comma separated)
31
resultSetHandler.displayName=Handle ResultSet
32
resultSetHandler.shortDescription=How should return values of type ResultSet be handled
31
resultVariable.displayName=Result variable name
33
resultVariable.displayName=Result variable name
32
resultVariable.shortDescription=Name of the JMeter variable that stores the result set objects in a list of maps for looking up results by column name.
34
resultVariable.shortDescription=Name of the JMeter variable that stores the result set objects in a list of maps for looking up results by column name.
33
queryTimeout.displayName=Query timeout (s)
35
queryTimeout.displayName=Query timeout (s)

Return to bug 57322