ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Collin Peters" <cadio...@gmail.com>
Subject Support for database specific SQL config
Date Thu, 15 Mar 2007 23:13:36 GMT
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:
SET TIME ZONE 'PST8PDT;
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

Mime
View raw message