org.xorm.datastore.sql
Class SQLQuery

java.lang.Object
  |
  +--org.xorm.datastore.sql.SQLQuery

public class SQLQuery
extends Object

Converts a selector tree to a SQL statement.


Nested Class Summary
static class SQLQuery.Alias
           
 
Constructor Summary
SQLQuery(Selector selector)
           
 
Method Summary
static StringBuffer appendOperator(Operator operator, StringBuffer buffer)
          Appends the correct SQL for the given operator to the buffer.
static String escapeLike(String operand)
          Escapes a SQL string by replacing "%" literals with "~%".
static String escapeSQLString(String operand)
          Escapes an SQL String by quoting all single-quotes as two single-quotes.
 Set getAliases()
           
 List getParameters()
           
 Table getTargetTable()
           
 String toCountSQL()
          SQL needed to run the count() query.
 String toSQL()
          Returns the SQL generated by this query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLQuery

public SQLQuery(Selector selector)
Method Detail

getTargetTable

public Table getTargetTable()

getAliases

public Set getAliases()

getParameters

public List getParameters()

appendOperator

public static StringBuffer appendOperator(Operator operator,
                                          StringBuffer buffer)
Appends the correct SQL for the given operator to the buffer. Does not deal with the operand itself. Therefore all of STARTS_WITH, ENDS_WITH and STR_CONTAINS append the value " LIKE ". Returns the same buffer as passed in.


escapeSQLString

public static String escapeSQLString(String operand)
Escapes an SQL String by quoting all single-quotes as two single-quotes. Also appends leading and trailing single quotes. For example, "Bob" becomes "'Bob'" and "Bob's" becomes "'Bob''s'".


escapeLike

public static String escapeLike(String operand)
Escapes a SQL string by replacing "%" literals with "~%".


toCountSQL

public String toCountSQL()
SQL needed to run the count() query.


toSQL

public String toSQL()
Returns the SQL generated by this query.



$Header: /cvsroot/xorm/xorm/docs/api/org/xorm/datastore/sql/SQLQuery.html,v 1.9 2004/05/30 08:55:06 wbiggs Exp $