Hey again, Ted. I believe now I got the point. I have to set my statements with the remapResults="true" and then the $$ "magic" should work transparently, right? But as I see in the documentation and in the XML's DTD, this property is only available to <statement>, <select> and <procedure> attributes, right? The problem is that I have to use this in all of my queries.
Am I missing something? Thanks, CMS -----Mensagem original----- De: Ted Schrader [mailto:[EMAIL PROTECTED] Enviada em: segunda-feira, 19 de junho de 2006 17:57 Para: [email protected] Assunto: Re: Appending strings to query I have a JavaBean property named dbName; in other words I have a getDbName() and a setDbName() method. The application sets the database name into the bean based on what the user does, then hands the bean over to iBATIS. On 19/06/06, Cristiano Monteiro dos Santos <[EMAIL PROTECTED]> wrote: > Hi, Ted! > > Thanks for your tip. How do you deal with the $dbName$ variable? You > substitude by yourself this string for another thing? How do you do this? I > was cheking the link you sent me, and it has something to do with it, as I > see on that page the same kind of usage. How do I pass the value of that > variable to iBATIS? > > Thanks, man! > CMS > > -----Mensagem original----- > De: Ted Schrader [mailto:[EMAIL PROTECTED] > Enviada em: segunda-feira, 19 de junho de 2006 17:38 > Para: [email protected] > Assunto: Re: Appending strings to query > > > 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: > > SELECT NUMBER, DESCRIPTION > 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: > http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId= > 3057 > > Cheers! > > Ted > > > On 19/06/06, Cristiano Monteiro dos Santos <[EMAIL PROTECTED]> 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 > > >
