You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Tegan Clark <te...@yahoo.com> on 2007/03/02 23:58:52 UTC

Adding a sql map at run time

Hi all,
   
  Does anyone have any pointers for how I would add a sql map to the SqlMapClient at runtime.  I'm writing a GUI that lets a use enter a piece of SQL and I'm using iBATIS to do the heavy lifting of mapping my java parameters to the sql and executing it and doing the return mapping.  
   
  My only problem is getting the sql map to add dynamically.
   
  All help appreciated.
   
  Tegan

 
---------------------------------
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.

Re: Adding a sql map at run time

Posted by Ted Schrader <te...@gmail.com>.
Hi Tegan,

There may be other ways to solve your problem.

How much SQL are the users allowed to enter?  Perhaps it can be done
by using $value$ instead of #value# in critical places in an existing
sql map (This is how WHERE clauses in Abator-generated sql maps work
for the query-by-example bits).

Also, check if remapResults="true" would be applicable to your case.
Finally, if you do end up using $value$, be sure to escape the SQL
contained in the parameter [I use StringEscapeUtils.escapeSQL() in the
Apache Jakarta Commons Lang package].

Give us an example if you need more ideas.

Ted


On 02/03/07, Tegan Clark <te...@yahoo.com> wrote:
> Hi all,
>
> Does anyone have any pointers for how I would add a sql map to the
> SqlMapClient at runtime.  I'm writing a GUI that lets a use enter a piece of
> SQL and I'm using iBATIS to do the heavy lifting of mapping my java
> parameters to the sql and executing it and doing the return mapping.
>
> My only problem is getting the sql map to add dynamically.
>
> All help appreciated.
>
> Tegan
>
>  ________________________________
> Bored stiff? Loosen up...
> Download and play hundreds of games for free on Yahoo! Games.
>
>