This class contains default methods to construct SQL statements using method calls. Subclasses should specialize the methods to the SQL dialect of a specific database.
This class defines methods that construct String fragments of SQL statements. Chaining the methods allows the creation of arbitrarily complex statements.
getInsert --> insert into left (item1,...,itemN) getValues --> values (item1,...,itemN) getUpdate --> update left item1,...,itemN getSet --> set left=right getDelete --> delete from left getSelect --> select item1,...,itemN getSelectDistinct --> select distinct item1,...,itemN getFrom --> from item1,item2,...,itemN getWhere --> where tree getEquals --> (left = right) getNotEqual --> (left != right) getGreaterThan --> (left > right) getGreaterEqual --> (left >= right) getLessThan --> (left < right) getLessEqual --> (left <= right) getNull --> (item is null) getNotNull --> (item is not null) getIn --> (left in right) getNotIn --> (left not in right) getAnd --> (left and right) getOr --> (left or right) getNot --> (not item) getAscending --> item ASC getDescending --> item DESC getOrderBy --> order by item1...,itemN getGroupBy --> group by item1...,itemN getHaving --> having tree getCount --> count(item) getMin --> min(item) getMax --> max(item) getAvg --> avg(item) getSum --> sum(item) getUpper --> upper(item)
Stored procedures can also be implemented. Extend this class in your own custom database adaptor. Add methods to construct SQL fragments for your stored procedures. The implementations for functions (such as getCount(), getSum()...) would be useful models to follow for your stored procedures.
@version $Id: BaseSql.java,v 1.1.6.2 2004/05/20 04:34:17 seade Exp $