You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Ron Grabowski <ro...@yahoo.com> on 2005/04/12 15:40:20 UTC

How does BaseLogProxy (and classes that extend it) get called?

I know what code proxies are but I'm not an expert on them. I was
looking through the com.ibatis.common.jdbc.logging package and came
across BaseLogProxy and all the classes that extend it:
StatementLogProxy, ResultSetLogProxy, etc. How/when are those classes'
invoke methods called? I don't see other classes creating instances of
ResultSetLogProxy. Other parts of Ibatis (SqlExecutor's executeQuery
for example) instanciate normal ResultSet objects. Do all ResultSet
instances automagically pass through the ResultSetLogProxy? If so, how
is that wired up?

Also, when I was looking at code inside of ResultSetProxy:

} else if ("next".equals(method.getName())) {
        String s = getValueString();
        if (!"[]".equals(s)) {
          if (first) {
            first = false;
            if (log.isDebugEnabled()) {
              log.debug("{rset-" + id + "} Header: " +
getColumnString());
            }
          }

It looks like even if all logging is turned off, getValueString() is
still being called. It seems like a single call to isDebugEnabled()
would be more effencient than generating a potentially large string
that may or may get used:

} else if ("next".equals(method.getName())) {
        if (log.isDebugEnabled()) {
        String s = getValueString();

Thanks,
Ron