I think my idea is strange...I'd vote -1 for it :-/
Do you think a generic callBackTag would be helpful? You would pass in
a class that could do processing once ibatis has done its job:
<callBackTag type="MyCallBackTag">
<isNotNull prepend="and" property="attribute1">
FIELD1 $likeClause$ #attribute1#
</isNotNull>
</callBackTag>
In your case you would wrap the entire generated sql into a
callBackTag:
<select>
<callBackTag type="SpecialAppendCallBack">
...
</callBackTag>
</select>
--- Mathew Samuel <[EMAIL PROTECTED]> wrote:
>
>
> Problem 3 (Q3) is not for logging/debugging purposes.
> It's to actually modify (mostly append) the generated
> SQL text, say, to add additional SQL constructs before
> it is sent to the execution engine.
>
>
> Thanks
>
>
> --- Ron Grabowski <[EMAIL PROTECTED]> wrote:
>
> > Q1.
> > You could pass your parameters in as a Map and use a
> > literal:
> >
> > <isNotNull prepend="and" property="attribute1">
> > FIELD1 $likeClause$ #attribute1#
> > </isNotNull>
> >
> > Q2.
> > You could use a literal for this as well. Remember
> > that ibatis isn't a
> > sql parser, it doesn't know anything about your
> > column names. It sees
> > everything as text so there's nothing like this:
> >
> > // FAKE SYNTAX, DOES NOT EXIST
> > Statement statement =
> >
> >
> sqlMapper.getStatement("GetOne").addColumn("DateAdded");
> > List list = statement.select();
> >
> > Q3.
> > All sql statements to/from the database are logged.
> > You can capture
> > those and do whatever you want with them.
> >
> > --- Mathew Samuel <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > Q1. What's the best way to dynamically alter ('='
> > or
> > > 'like') to ('!=' or 'not like') in a
> > pre-constructed
> > > option ? e.g.
> > >
> > > <isNotNull prepend="and" property="attribute1">
> > > FIELD1 like #attribute1#
> > > </isNotNull>
> > >
> > > can become
> > >
> > > <isNotNull prepend="and" property="attribute1">
> > > FIELD1 not like #attribute1#
> > > </isNotNull>
> > >
> > > or vice-versa.
> > >
> > >
> > >
> > > Q2. Is there a way to dynamically add fields to an
> > SQL
> > > statement (select/update/insert/delete) ? e.g. A
> > UI
> > > customization that indirectly allows adding a
> > field to
> > > an existing table, could then have statements that
> > > operate on those new fields.
> > >
> > >
> > >
> > > Q3. Does Ibatis allow an API call to retrieve the
> > > constructed SQL right before the execution ?
> > (Perhaps
> > > for achieving the problem above)
> > >
> > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam? Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> >
> >
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>