ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Support for database specific SQL config
Date Fri, 16 Mar 2007 09:17:35 GMT
You could accomplish this by writing your own implementation for the
<dataSource> element.  Your implementation could delegate to some existing
implementation, but set up the connection before returning it to iBATIS.

Jeff Butler

On 3/15/07, Collin Peters <cadiolis@gmail.com> wrote:
> Hello again,
> I am wondering if iBatis has any kind of support for database level
> SQL config.  I am using PostgreSQL as my dbms and it has the ability
> to set certain values to be used in the SQL 'session'.  For example,
> if I am in a different timezone than the server, the call to 'SELECT
> CURRENT_TIME' (or SELECT now()) should return my current time, not the
> servers current time.
> http://www.postgresql.org/docs/8.1/interactive/sql-set.html
> In an old PHP project I had, I included this SQL in an abstraction
> layer.  i.e. I would call db_query("SELECT ...")  instead of
> pg_query("SELECT ...").   In the db_query abstraction call I would
> prepend the following SQL "SET TIME ZONE 'PST8PDT;".  So the full SQL
> executed would be:
> SELECT ...
> PostgreSQL would then run that query as if it were in my timezone.
> Hopefully that is clear.  I am wondering if iBatis has any
> functionality built in for this.  I could not find anything in the
> docs about this and didn't know where to begin for searching for it
> either.  I am hoping there is some iBatis magic that makes this all
> easier.  It would be a nightmare to have to manually add that bit of
> SQL to every other piece of SQL I have.
> Regards,
> Collin

View raw message