You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Samoht-fr <gi...@git.apache.org> on 2015/08/24 23:21:17 UTC

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

GitHub user Samoht-fr opened a pull request:

    https://github.com/apache/jmeter/pull/27

    Use typed methods such as setInt, setDouble, setDate ... for prepared statement

    Use typed methods such as `setInt`, `setDouble`, `setDate` ... for prepared statement.
    
    It moves parsing from the driver to Jmeter, but it allows to compare more easily two drivers / databases. 
    Moreover it makes benchmark closer to reality, in fact for performance reasons we try to avoid calls to setObject as the driver as to cast/parse String parameters.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Samoht-fr/jmeter trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jmeter/pull/27.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #27
    
----
commit 4662aff8a395332f4f41d593c0e7bdaaf86d9b59
Author: tpeyrard <th...@gmail.com>
Date:   2015-08-24T21:18:24Z

    Use typed methods such as setInt, setDouble, setDate ... for prepared statements instead of calling every time setObject.
    
     It moves parsing from the driver to Jmeter, but it allows to compare more easily two drivers / databases.
     Moreover it makes benchmark closer to reality, in fact for performance reasons we try to avoid calls to setObject as the driver as to cast/parse String parameters.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by vlsi <gi...@git.apache.org>.
Github user vlsi commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/27#discussion_r38084911
  
    --- Diff: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java ---
    @@ -18,34 +18,44 @@
     
     package org.apache.jmeter.protocol.jdbc;
     
    +import org.apache.commons.collections.map.LRUMap;
    +import org.apache.jmeter.samplers.SampleResult;
    +import org.apache.jmeter.save.CSVSaveService;
    +import org.apache.jmeter.testelement.AbstractTestElement;
    +import org.apache.jmeter.testelement.TestStateListener;
    +import org.apache.jmeter.threads.JMeterVariables;
    +import org.apache.jmeter.util.JMeterUtils;
    +import org.apache.jorphan.logging.LoggingManager;
    +import org.apache.log.Logger;
    --- End diff --
    
    Please refrain from moving imports around. Can you please move `org.apache` imports back to the initial location?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by vlsi <gi...@git.apache.org>.
Github user vlsi commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/27#discussion_r37815468
  
    --- Diff: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java ---
    @@ -338,6 +328,44 @@ private static final int countRows(ResultSet resultSet) throws SQLException {
             return outputs;
         }
     
    +    private void setArgument(PreparedStatement pstmt, String argument, int targetSqlType, int index) throws SQLException {
    +        switch (targetSqlType) {
    +        case Types.INTEGER:
    +            pstmt.setInt(index, Integer.parseInt(argument));
    +            break;
    +        case Types.DOUBLE:
    +        case Types.DECIMAL:
    +            pstmt.setDouble(index, Double.parseDouble(argument));
    --- End diff --
    
    This is not valid.
    
    >https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html
    >The recommended Java mapping for the DECIMAL and NUMERIC types is java.math.BigDecimal


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by Samoht-fr <gi...@git.apache.org>.
Github user Samoht-fr commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/27#discussion_r38088733
  
    --- Diff: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java ---
    @@ -18,34 +18,44 @@
     
     package org.apache.jmeter.protocol.jdbc;
     
    +import org.apache.commons.collections.map.LRUMap;
    +import org.apache.jmeter.samplers.SampleResult;
    +import org.apache.jmeter.save.CSVSaveService;
    +import org.apache.jmeter.testelement.AbstractTestElement;
    +import org.apache.jmeter.testelement.TestStateListener;
    +import org.apache.jmeter.threads.JMeterVariables;
    +import org.apache.jmeter.util.JMeterUtils;
    +import org.apache.jorphan.logging.LoggingManager;
    +import org.apache.log.Logger;
    --- End diff --
    
    That's my IntelliJ ... I'll fix it :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by milamberspace <gi...@git.apache.org>.
Github user milamberspace commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/27#discussion_r37808539
  
    --- Diff: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java ---
    @@ -46,6 +28,14 @@
     import org.apache.jorphan.logging.LoggingManager;
     import org.apache.log.Logger;
     
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.lang.reflect.Field;
    +import java.sql.*;
    +import java.sql.Date;
    +import java.util.*;
    +import java.util.concurrent.ConcurrentHashMap;
    +
    --- End diff --
    
    
    Please use explicit import, don't use wildcard import.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by Samoht-fr <gi...@git.apache.org>.
Github user Samoht-fr commented on the pull request:

    https://github.com/apache/jmeter/pull/27#issuecomment-135363113
  
    I fixed patch according to your remarks. I also added new conversions according to the [Oracle doc] (https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by milamberspace <gi...@git.apache.org>.
Github user milamberspace commented on the pull request:

    https://github.com/apache/jmeter/pull/27#issuecomment-136009350
  
    Thanks. In the trunk.
    
    URL: http://svn.apache.org/r1700060
    Log:
    Use typed methods such as setInt, setDouble, setDate ... for prepared statement #27
    
    Bugzilla Id: 58301
    
    This closes #27
    
    
    Modified:
        jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java
        jmeter/trunk/xdocs/changes.xml


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by vlsi <gi...@git.apache.org>.
Github user vlsi commented on the pull request:

    https://github.com/apache/jmeter/pull/27#issuecomment-135393177
  
    Looks good except from a glitch with imports moved around.
    I'm not sure if additional tests are expected in this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by Samoht-fr <gi...@git.apache.org>.
Github user Samoht-fr commented on the pull request:

    https://github.com/apache/jmeter/pull/27#issuecomment-136155462
  
    Thanks too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jmeter pull request: Use typed methods such as setInt, setDouble, ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jmeter/pull/27


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---