Dashboard > iBATIS DataMapper > Home > Improved Dynamic SQL Whiteboard > Information > Page Comparison
Improved Dynamic SQL Whiteboard
compared with
Current by Chadwick
on Jun 21, 2009 01:53.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

  h1. Improved Dynamic SQL Whiteboard
  
 This is a collaborative development space to discuss the future of dynamic SQL in iBATIS SQL Mapping files. This is a key feature of iBATIS that gives it great power. The current implementation has some limitations that we'd like to resolve by introducing a new and improved Dynamic SQL syntax. This page represents the current state of the decisions and future design.
  
 h2. What are the existing problems/limitations?
  
  * Inflexible iterators
  * Odd iterator syntax ([] vs. item definition)
  * More flexible variable definition and consistent access
  
 h2. Which new syntax do we want to support?
  
  * Old school proprietary XML
  * New/improved proprietary XML
  * 3rd Party XML
  * JSTL/EL
  * Groovy
  * Velocity
  * JavaScript
  
 h2. How do we ensure consistency accross the Java and .NET versions?
  
  * Ideas?
  
 h2. Brandon's Proposal
  
 Introducing pluggable scripting languages into the ibatis mix will not provide anything but needless complexity. My feeling is that we need to settle on a scoped EL implementation and make our xml simpler. Following is a recommendation i posted to the developer's list:
  
 I did a little more research on where we can take dyna sql and here is a short proposal.
  
 <isEqual>;<isNotEqual>;<isGreaterThan>;<isGreaterEqual>;<isLessThan>;<isLessEqual> <isPropertyAvailable>;<isNotPropertyAvailable>;<isNull>;<isNotNull>;<isEmpty>;<isNotEmpty> <isParameterPresent>;<isNotParameterPresent>
  
 These could be condensed down to a simpler set of tags:
  
  * <choose> - for mulitple conditionals. used in conjunction with when and otherwise.
  ** attributes: none
  
  * <when>
  ** attributes: prepend, test, append
  
  * <otherwise>
  ** attributes: prepend, append
  
  
  
  * <if> - for single conditionals
  ** Attributes: prepend, test, append
  
  
  
  * <foreach> - for iterating over arrays. Also, i was thinking we can place a test attribute on this to gain a for loop [for(x=0; x<y; x++)] effect.
  
  * attributes:
  ** test
  ** begin
  ** end
  ** item
  ** step
  ** open
  ** close
  ** conjuction
  ** prepend
  ** append
  
  
  
  * <while> - for looping a "do while" condition.
  * attributes:
  ** test
  ** open
  ** close
  ** conjuction
  ** prepend
  ** append
  
 In light of making this cross platform it may a good idea to use JEXL as a reference point and implement our own el with ANTLR.
  
 The EL should be simple and used for value extraction, boolean tests, and math. It should not have control structure syntax like for, if, while.
  
 ANTLR - http://www.antlr.org/ -- ANTLR looks to be the most popular and cross-language (for our C# friends). A quote from the ANTLR website - "ANTLR currently generates Java, C#, and C++. A prototype Python generator is almost ready."
Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators