On Thu, Apr 28, 2011 at 6:35 PM, Justin Deoliveira <[email protected]> wrote:
> Hi all,
> I wanted to get some feedback on a problem i am trying to solve and a
> possible solution. First the problem.
> It comes out of working on the teradata datastore. The td database has a
> feature called "query banding". It is very simple in nature. It is basically
> just a statement that sets some key value pairs before another statement is
> executed, or set some key value pairs for the life of a connection. A common
> example is to set the name of the application. So one might do:
> SET QUERY_BAND = 'Application = geotools`;
> SELECT * FROM ...;
> I am not that familiar with how it is used but it generally gets used for BI
> type applications, and for workload management. So that the database can for
> instance prioritize queries for a particular application. The client funding
> the td datastore ask that the query banding feature be utilized.
> Anyways, that said the problem is basically that I need to be able to set
> certain query bands before statements executed by the jdbc datastore.
> And currently don't have a great mechanism to do so since it is really out
> of the dialect hands.
> The best solution I can come up with is to add some callback methods to the
> dialect that the datastore will call before it executes a statement. For
> example:
> BasicSQLDialect {
>   onSelect(Statement st, Connection cx, FeatureType);
>   onDelete(Statement st, Connection cx, FeatureType);
>   onInsert(Statement st, Connection cx, FeatureType);
>   onUpdate(Statement st, Connection cx, FeatureType);
> }
> PreparedSQLDialect {
>   onSelect(PreparedStatement st, Connection cx, FeatureType);
>   onDelete(PreparedStatement st, Connection cx, FeatureType);
>   onInsert(PreparedStatement st, Connection cx, FeatureType);
>   onUpdate(PreparedStatement st, Connection cx, FeatureType);
> }

I am wondering if we could extend the following method instead:

/**
     * Initializes a newly created database connection.
     * <p>
     * Subclasses should override this method if there is some
additional action
     * that needs to be taken when a new connection to the database is
created. The
     * default implementation does nothing.
     * </p>
     * @param cx The new database connection.
     */
    public void initializeConnection( Connection cx ) throws SQLException {

    }


Another question is, how do you plan to send down the kvp to be
set in the connection?
Right now the store understands view params, but conceivably one might
want to use query banding and view params at the same time.

Cheers
Andrea


-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to