longzenvo / log4jdbc

Automatically exported from code.google.com/p/log4jdbc
0 stars 0 forks source link

OracleRdmsSpecifics needs to be public for connection wrapping within code #59

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Directly wrapping connection using ConnectionSpy(Connection conn, RdmsSpecifics 
specifics) is not possible because OracleRdmsSpecifics is package scoped. 

What is the expected output? What do you see instead?
proper logging of time and dates for Oracle utilizing to_date/timestamp.

What version of the product are you using? On what operating system?
log4jdbc4-1.2

Original issue reported on code.google.com by johnrive...@gmail.com on 14 Dec 2012 at 6:29

GoogleCodeExporter commented 9 years ago
Good find. RdbmsSpecifics and all it's subclasses should probably be public, 
huh?

Original comment by arthur.b...@gmail.com on 14 Dec 2012 at 7:56

GoogleCodeExporter commented 9 years ago
Or... possibly have the appropriate RdbmsSpecifics configured based on the 
driver within the Connection instance passed into the one arg constructor. 

// Something like this... not tested ;)

  public ConnectionSpy(Connection realConnection)
  {
    this(realConnection, findRdmsSpecifics(realConnection));
  }

   ... 

  private static RdbmsSpecifics findRdmsSpecifics(Connection realConnection){
        RdbmsSpecifics rdbmsSpecifics = DriverSpy.defaultRdbmsSpecifics;
        try {
            String driver = realConnection.getMetaData().getDriverName();
            if(DriverSpy.rdbmsSpecifics.containsKey(driver)){
                rdbmsSpecifics = (RdbmsSpecifics) DriverSpy.rdbmsSpecifics.get(driver);
            }
        } catch (SQLException e) {
            // Log something useful here
        }
        return rdbmsSpecifics;
  }

Original comment by johnrive...@gmail.com on 14 Dec 2012 at 8:25

GoogleCodeExporter commented 9 years ago
I like that idea.

Original comment by arthur.b...@gmail.com on 14 Dec 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Let me know if you are interested in adding any contributors. I'd be more than 
happy to make the change and also work on getting this into maven.

Original comment by johnrive...@gmail.com on 14 Dec 2012 at 8:41

GoogleCodeExporter commented 9 years ago
Why don't you work out a patch for your idea, test it and we'll see?

Original comment by arthur.b...@gmail.com on 15 Dec 2012 at 9:48

GoogleCodeExporter commented 9 years ago
Sure

Original comment by johnrive...@gmail.com on 16 Dec 2012 at 3:51

GoogleCodeExporter commented 9 years ago
I worked out the patch and converted the build to maven. Not sure if you
want to switch to maven or not though. Let me know. I'd have to send you
the zip because i would need to be able to commit in order to modify the
directory structure. The maven build is a multimodule build that will build
the jars for both JDBC3 and 4 as well as generate a site, javadoc and
changeset report.

Original comment by johnrive...@gmail.com on 27 Dec 2012 at 3:40