You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/10/11 02:37:49 UTC
svn commit: r703617 - in /jakarta/jmeter/trunk:
src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
xdocs/changes.xml
Author: sebb
Date: Fri Oct 10 17:37:49 2008
New Revision: 703617
URL: http://svn.apache.org/viewvc?rev=703617&view=rev
Log:
Bug 45425 - JDBC Request does not support Unicode
- changed sampler to use UTF-8
- added parameter values and types to request data
- set content-type to text/plain
Modified:
jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified: jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java?rev=703617&r1=703616&r2=703617&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java Fri Oct 10 17:37:49 2008
@@ -66,6 +66,9 @@
private static final String OUT = "OUT"; // $NON-NLS-1$
+ // TODO - should the encoding be configurable?
+ private static final String ENCODING = "UTF-8"; // $NON-NLS-1$
+
private static final Map mapJdbcNameToInt;
static {
@@ -139,10 +142,8 @@
res.setSampleLabel(getName());
res.setSamplerData(toString());
res.setDataType(SampleResult.TEXT);
- // Bug 31184 - make sure encoding is specified
- // TODO - should the encoding be configurable?
- final String encoding = System.getProperty("file.encoding"); // $NON-NLS-1$
- res.setDataEncoding(encoding);
+ res.setContentType("text/plain"); // $NON-NLS-1$
+ res.setDataEncoding(ENCODING);
// Assume we will be successful
res.setSuccessful(true);
@@ -173,7 +174,7 @@
try {
rs = stmt.executeQuery(getQuery());
Data data = getDataFromResultSet(rs);
- res.setResponseData(data.toString().getBytes(encoding));
+ res.setResponseData(data.toString().getBytes(ENCODING));
} finally {
close(rs);
}
@@ -184,37 +185,37 @@
// plus a number of update counts.
boolean hasResultSet = cstmt.execute();
String sb = resultSetsToString(cstmt,hasResultSet, out);
- res.setResponseData(sb.getBytes(encoding));
+ res.setResponseData(sb.getBytes(ENCODING));
} else if (UPDATE.equals(_queryType)) {
stmt = conn.createStatement();
stmt.executeUpdate(getQuery());
int updateCount = stmt.getUpdateCount();
String results = updateCount + " updates";
- res.setResponseData(results.getBytes(encoding));
+ res.setResponseData(results.getBytes(ENCODING));
} else if (PREPARED_SELECT.equals(_queryType)) {
pstmt = getPreparedStatement(conn);
setArguments(pstmt);
pstmt.executeQuery();
String sb = resultSetsToString(pstmt,true,null);
- res.setResponseData(sb.getBytes(encoding));
+ res.setResponseData(sb.getBytes(ENCODING));
} else if (PREPARED_UPDATE.equals(_queryType)) {
pstmt = getPreparedStatement(conn);
setArguments(pstmt);
pstmt.executeUpdate();
String sb = resultSetsToString(pstmt,false,null);
- res.setResponseData(sb.getBytes(encoding));
+ res.setResponseData(sb.getBytes(ENCODING));
} else if (ROLLBACK.equals(_queryType)){
conn.rollback();
- res.setResponseData(ROLLBACK.getBytes(encoding));
+ res.setResponseData(ROLLBACK.getBytes(ENCODING));
} else if (COMMIT.equals(_queryType)){
conn.commit();
- res.setResponseData(COMMIT.getBytes(encoding));
+ res.setResponseData(COMMIT.getBytes(ENCODING));
} else if (AUTOCOMMIT_FALSE.equals(_queryType)){
conn.setAutoCommit(false);
- res.setResponseData(AUTOCOMMIT_FALSE.getBytes(encoding));
+ res.setResponseData(AUTOCOMMIT_FALSE.getBytes(ENCODING));
} else if (AUTOCOMMIT_TRUE.equals(_queryType)){
conn.setAutoCommit(true);
- res.setResponseData(AUTOCOMMIT_TRUE.getBytes(encoding));
+ res.setResponseData(AUTOCOMMIT_TRUE.getBytes(ENCODING));
} else { // User provided incorrect query type
String results="Unexpected query type: "+_queryType;
res.setResponseMessage(results);
@@ -457,6 +458,10 @@
sb.append(getQueryType());
sb.append("] "); // $NON-NLS-1$
sb.append(getQuery());
+ sb.append("\n");
+ sb.append(getQueryArguments());
+ sb.append("\n");
+ sb.append(getQueryArgumentsTypes());
return sb.toString();
}
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=703617&r1=703616&r2=703617&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Oct 10 17:37:49 2008
@@ -113,6 +113,7 @@
<li>Bug 45904 - Allow 'Not' Response Assertion to succeed with null sample</li>
<li>HTTP and SOAP sampler character encodings updated to be more consistent</li>
<li>Bug 45976 - incomplete result file when using remote testing with more than 1 server</li>
+<li>Bug 45425 - JDBC Request does not support Unicode (changed sampler to use UTF-8)</li>
</ul>
<h3>Improvements</h3>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org