Re: notification of query

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Dec 29 2009 - 03:16:38 EST

  • Next message: Aristedes Maniatis: "Re: notification of query"

    We started on an implementation of a flexible statistics gathering
    engine some time ago:

       https://issues.apache.org/jira/browse/CAY-1173

    I hope this gets finished in Cayenne 3.1. Until then you have 2 places
    where you may try intercepting query events:

    * DataSource. Since DataSource is an interface, you can implement your
    own wrapper around the current DataSource that you are using, set up
    via a custom DataSourceFactory. Then you'd have to also decorate
    Connection and PreparedStatement. PreparedStatement wrapper would
    gather needed statistics.

    * Log4J. You can create an appender that analyzes Cayenne QueryLogger
    log events gathering needed stats.

    Andrus

    On Dec 29, 2009, at 10:03 AM, Hans Pikkemaat wrote:
    > Hi,
    >
    > I'm doing some performance tests and want to see when the query is
    > actually run.
    > I'm running some test queries with different cache settings to see
    > what happens
    > performance and memory wise. For this reason I need to know when an
    > actual
    > sql statement is being executed at the database. So my question is:
    >
    > Is there a way (2.0.4) to get a notification or callback when a
    > query (or more generic: sql statement) is executed?
    >
    > I'm already using the log4j so I do see when the query runs but I
    > need a callback to be
    > able to store statistics about a query execution. Preferably
    > including result counts and execution timing.
    >
    > I saw the explanation about the DataContextDelegate but this one is
    > called even when a query is in the cache.
    >
    > tx
    >
    > Hans



    This archive was generated by hypermail 2.0.0 : Tue Dec 29 2009 - 03:17:09 EST