ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Schrader" <tschra...@gmail.com>
Subject Re: Appending strings to query
Date Mon, 19 Jun 2006 20:38:12 GMT
Hi Cristiano,

No, it's not too much to expect.  I've had to do something similar,
although probably not as complicated as your situation.

Here's an example:

  FROM $dbName$.ITEMS

My application spans multiple databases (actually, multiple iSeries
libraries) and this has worked out okay, since all of our ITEMS tables
have identical definitions (not my schema!).

Note that we have to use the $ symbol, not #.  Also, when using $, be
sure your values are SQL-escaped to avoid injection attacks.  In my
case, the dbName variable is managed internally by the application.

Also, I recommend you get familiar with the remapResults="true"
setting in case it applies to your situation:



On 19/06/06, Cristiano Monteiro dos Santos <csantos@polimed.com.br> wrote:
> Hi again, guys.
> I have another question: is it possible to append string snippets to the
> iBATIS's xml queries? I mean, I have several databases, each of then
> containing the same set of tables, following the schema
> #databasename#:tb#customerid#user (not telling if it's right or wrong, it's
> fact), and I want to execute the queries sometimes in one database,
> sometimes in the other. Like this:
> select f1, f2, f3
> #databasename#:tb#customerid#user
> Resulting in the following query:
> select f1, f2, f3
> custname:tb123user
> Where #databasename# and #customerid# are both attributes of the
> parameterClass. Am I expecting too much?
> Thanks!
> Cristiano

View raw message