com.samskivert.jdbc.depot
Class BuildVisitor

java.lang.Object
  extended by com.samskivert.jdbc.depot.BuildVisitor
All Implemented Interfaces:
ExpressionVisitor
Direct Known Subclasses:
MySQLBuilder.MSBuildVisitor, PostgreSQLBuilder.PGBuildVisitor

public abstract class BuildVisitor
extends Object
implements ExpressionVisitor

Implements the base functionality of the SQL-building pass of SQLBuilder. Dialectal subclasses of this should be created and returned from SQLBuilder.getBuildVisitor(). This class is intimately paired with {#link BindVisitor}.


Field Summary
protected  StringBuilder _builder
          A StringBuilder to hold the constructed SQL.
protected  Map<Class<? extends PersistentRecord>,Map<String,FieldDefinition>> _definitions
          A mapping of field overrides per persistent record.
protected  boolean _enableAliasing
           
protected  boolean _enableOverrides
           
protected  boolean _innerClause
          A flag that's set to true for inner SELECT's
protected  DepotTypes _types
           
 
Constructor Summary
protected BuildVisitor(DepotTypes types)
           
 
Method Summary
protected abstract  void appendIdentifier(String field)
           
protected  void appendLhsColumn(Class<? extends PersistentRecord> type, String field)
           
protected  void appendRhsColumn(Class<? extends PersistentRecord> type, String field)
           
protected  void appendTableAbbreviation(Class<? extends PersistentRecord> type)
           
protected  void appendTableName(Class<? extends PersistentRecord> type)
           
 String getQuery()
           
 void visit(ColumnExp columnExp)
           
 void visit(Conditionals.Exists<? extends PersistentRecord> exists)
           
abstract  void visit(Conditionals.FullTextMatch match)
           
 void visit(Conditionals.In in)
           
 void visit(Conditionals.IsNull isNull)
           
 void visit(DeleteClause<? extends PersistentRecord> deleteClause)
           
 void visit(FieldDefinition definition)
           
 void visit(ForUpdate forUpdate)
           
 void visit(FromOverride override)
           
 void visit(FunctionExp functionExp)
           
 void visit(GroupBy groupBy)
           
 void visit(InsertClause<? extends PersistentRecord> insertClause)
           
 void visit(Join join)
           
 void visit(Key.WhereCondition<? extends PersistentRecord> whereCondition)
           
 void visit(Key<? extends PersistentRecord> key)
           
 void visit(Limit limit)
           
 void visit(LiteralExp literalExp)
           
 void visit(Logic.Not not)
           
 void visit(MultiKey<? extends PersistentRecord> key)
           
 void visit(OrderBy orderBy)
           
 void visit(SelectClause<? extends PersistentRecord> selectClause)
           
 void visit(SQLOperator.BinaryOperator binaryOperator)
           
 void visit(SQLOperator.MultiOperator multiOperator)
           
 void visit(UpdateClause<? extends PersistentRecord> updateClause)
           
 void visit(ValueExp valueExp)
           
 void visit(Where where)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.samskivert.jdbc.depot.expression.ExpressionVisitor
visit
 

Field Detail

_types

protected DepotTypes _types

_builder

protected StringBuilder _builder
A StringBuilder to hold the constructed SQL.


_definitions

protected Map<Class<? extends PersistentRecord>,Map<String,FieldDefinition>> _definitions
A mapping of field overrides per persistent record.


_innerClause

protected boolean _innerClause
A flag that's set to true for inner SELECT's


_enableOverrides

protected boolean _enableOverrides

_enableAliasing

protected boolean _enableAliasing
Constructor Detail

BuildVisitor

protected BuildVisitor(DepotTypes types)
Method Detail

getQuery

public String getQuery()

visit

public void visit(FromOverride override)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(FieldDefinition definition)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Key.WhereCondition<? extends PersistentRecord> whereCondition)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Key<? extends PersistentRecord> key)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(MultiKey<? extends PersistentRecord> key)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(FunctionExp functionExp)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(SQLOperator.MultiOperator multiOperator)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(SQLOperator.BinaryOperator binaryOperator)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Conditionals.IsNull isNull)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Conditionals.In in)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public abstract void visit(Conditionals.FullTextMatch match)
                    throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(ColumnExp columnExp)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Logic.Not not)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(GroupBy groupBy)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(ForUpdate forUpdate)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(OrderBy orderBy)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Where where)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Join join)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Limit limit)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(LiteralExp literalExp)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(ValueExp valueExp)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(Conditionals.Exists<? extends PersistentRecord> exists)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(SelectClause<? extends PersistentRecord> selectClause)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(UpdateClause<? extends PersistentRecord> updateClause)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(DeleteClause<? extends PersistentRecord> deleteClause)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

visit

public void visit(InsertClause<? extends PersistentRecord> insertClause)
           throws Exception
Specified by:
visit in interface ExpressionVisitor
Throws:
Exception

appendIdentifier

protected abstract void appendIdentifier(String field)

appendTableName

protected void appendTableName(Class<? extends PersistentRecord> type)

appendTableAbbreviation

protected void appendTableAbbreviation(Class<? extends PersistentRecord> type)

appendLhsColumn

protected void appendLhsColumn(Class<? extends PersistentRecord> type,
                               String field)
                        throws Exception
Throws:
Exception

appendRhsColumn

protected void appendRhsColumn(Class<? extends PersistentRecord> type,
                               String field)
                        throws Exception
Throws:
Exception


Copyright © 2000-2008 Michael Bayne. All Rights Reserved.