I for one regard inline parameter maps as something of a neccessary evil (for dynamic SQL) and would NOT like to see the same thing introduced for result maps. It is the absence of funny escape sequences and other complications in the iBatis SQL that makes it such a pleasure to work with. Unfortunately, if I hand my users a gun they will indeed shoot themselves in the foot.
I believe that parsing the SQL in the statement elements is really a Bad Thing*. I think a version of inline parameter maps that uses and XML syntax would be great, and a good basis for a inline result map syntax, something like:
select <result name="f.A" property="a" javaType="long"/>
from foo f
where f.BAR = <param property="fooParam" jdbcType="VARCHAR"/>

What I guess we really need for those who do not find joy in authoring sqlmap files by hand is a GUI editor, then it wouldn't matter what format the stuff was in and support for different ways of expressing the same thing would not be needed. Perhaps the effort would be best applied in that direction, it would keep the core smaller and the whole community would be better for having it.

-J

* I think I also expressed this when using a ";" to separate multiple statements in a tag was suggested, if we're going to use XML, lets use XML and then we can genuinely program against it instead of parsing it in a dozen funny, bug-inducing ways. And who hasn't it the "NodeletException" when your #'s are not balanced? ..took a long time to figure that one out the first time it happened. At my office we've got code that parses and generates sqlmap xml files to get query and update metadata for the application, the more info that is in real XML the easier it is to work with.


On 12/20/05, Jozef Hribik <[EMAIL PROTECTED]> wrote:
Hi Clinton,

+1 abd I would like to have one more option ;-)
#COLUMN:KEY:TYPE#

<select id="elions.uw.selectInfoProductInsured" resultClass="map">
SELECT #p.T01_NAME:name:String#, #p.T01_AGE:age:Integer#
  FROM T01_PERSON p
</select>

Cheers
Jozef

Clinton Begin wrote:

>
> I would love to add inline result map support.  :-)
>
> Unfortunately you and I are the minority.  But that doesn't mean we
> cannot do it.  So, my question to you is:  how would you like to see
> the syntax?
>
> Here are some options:
>
> $NAME:VARCHAR$
> !NAME:VARCHAR!
> @NAME:VARCHAR@
> "NAME:VARCHAR"
> |NAME:VARCHAR|   << I like the pipes, but does anyone know of any
> potential issues with using it?
>
> In hindsight, I wish I had used @@ for inline parameters and ## for
> inline result maps (because it looks like a little row set!).
>
> Cheers,
> Clinton
>
>
>
> On 12/19/05, *Yusuf* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED] >> wrote:
>
>     Dear All,
>     I've been using ibatis for about 1 year now, and i'm very
>     satisfied with
>     it!
>     I wanted to ask if i can do this:
>
>     <select id=" elions.uw.selectInfoProductInsured" resultClass="map">
>     SELECT name, age, address, income
>       FROM person
>     </select>
>
>     but I wanted the default datatype for NAME is String, AGE is
>     Integer, and INCOME is Double, not the default BigDecimal..
>     without specifying resultMaps or resultClasses (because i have so
>     many
>     queries like this and it would be very verbose to declare them one by
>     one)
>
>     I know we can declare something like this in insert statements like
>
>     <insert id="..">
>     INSERT INTO person (name, age) VALUES (#name:VARCHAR:-#,
>     #age:NUMBER:0#)
>     </insert>
>
>     but can it be done in select statements to in ibatis? for example like
>     this maybe:
>
>     <select id="elions.uw.selectInfoProductInsured " resultClass="map">
>     SELECT name:String, age:Integer, address:String, income:Double
>       FROM person
>     </select>
>
>     Thank you...
>
>


Reply via email to