de.mguennewig.pobjects.metadata
Class SelectExpr

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.Declaration
      extended by de.mguennewig.pobjects.metadata.TableExpr
          extended by de.mguennewig.pobjects.metadata.SelectExpr
All Implemented Interfaces:
SqlEntity, SqlStatement
Direct Known Subclasses:
DynamicSelectExpr, ViewDecl

public class SelectExpr
extends TableExpr
implements SqlStatement

A select expression defines an SQL `SELECT' statement, together with meta information about the statement that enables pobjects to manipulate and execute it.

Author:
Michael Günnewig

Field Summary
 
Fields inherited from class de.mguennewig.pobjects.metadata.Declaration
ARGUMENT_CONSTRUCTOR, CLASS_NAME, DESCRIPTOR, GENERATED_CLASS_NAME, POINTER_TYPE, SQL_ARG_COLON, SQL_ARG_DOLLAR, SQL_ARG_NONE, SQL_ARG_QUESTION_MARK
 
Constructor Summary
SelectExpr(java.lang.String name, FormDecl form, Parameter[] output, boolean singleRow, java.lang.Object[] sql)
          Creates a new Select expression.
 
Method Summary
 Column getColumn(int index)
          
 Column getColumnByName(java.lang.String name)
          Return table column with name name.
 FormDecl getFormDecl()
          Returns the form declaration that specifies the input parameters.
 int getNumColumns()
          
 int getNumSqlStatementParts()
          Returns the number of SQL statement parts.
 Parameter[] getOutput()
          Returns the output columns.
 java.lang.String getSchemaName()
          Returns the name of the SQL entity used in the database schema.
 java.lang.String getSqlFromClause(int sqlArgVariant)
          
 java.lang.Object getSqlStatementPart(int n)
          Returns the nth part of the SQL statement.
 boolean isSingleRow()
          Tests whether this statement will return in at most one row.
 java.lang.String name(int variant)
          Returns different names depending on variant for the code generator.
 void setModule(Module module)
          Sets the owning module and resolves the type name.
 
Methods inherited from class de.mguennewig.pobjects.metadata.TableExpr
getClassName, isExtensionOf, isWritableClass
 
Methods inherited from class de.mguennewig.pobjects.metadata.Declaration
getDescription, getModule, getName, setDescription, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.mguennewig.pobjects.metadata.SqlEntity
getModule
 

Constructor Detail

SelectExpr

public SelectExpr(java.lang.String name,
                  FormDecl form,
                  Parameter[] output,
                  boolean singleRow,
                  java.lang.Object[] sql)
Creates a new Select expression.

Method Detail

getFormDecl

public final FormDecl getFormDecl()
Returns the form declaration that specifies the input parameters.


getOutput

public final Parameter[] getOutput()
Returns the output columns.


isSingleRow

public final boolean isSingleRow()
Tests whether this statement will return in at most one row.


getNumColumns

public int getNumColumns()

Specified by:
getNumColumns in class TableExpr

getColumn

public Column getColumn(int index)

Specified by:
getColumn in class TableExpr

getColumnByName

public Column getColumnByName(java.lang.String name)
Return table column with name name. If no such column exists, result is null.

Specified by:
getColumnByName in class TableExpr

getSqlFromClause

public java.lang.String getSqlFromClause(int sqlArgVariant)

Specified by:
getSqlFromClause in class TableExpr

setModule

public void setModule(Module module)
Sets the owning module and resolves the type name.

Specified by:
setModule in interface SqlEntity
Overrides:
setModule in class TableExpr
See Also:
Declaration.setModule(Module)

name

public java.lang.String name(int variant)
Returns different names depending on variant for the code generator.

Specified by:
name in interface SqlStatement
Overrides:
name in class TableExpr
Returns:
variant return value
Declaration.DESCRIPTOR sdecl<Name>
Declaration.ARGUMENT_CONSTRUCTOR <name>Args
other values see super class

getNumSqlStatementParts

public final int getNumSqlStatementParts()
Returns the number of SQL statement parts.

Specified by:
getNumSqlStatementParts in interface SqlStatement

getSqlStatementPart

public final java.lang.Object getSqlStatementPart(int n)
Returns the nth part of the SQL statement.

Specified by:
getSqlStatementPart in interface SqlStatement

getSchemaName

public java.lang.String getSchemaName()
Returns the name of the SQL entity used in the database schema.

Specified by:
getSchemaName in interface SqlEntity
Throws:
java.lang.UnsupportedOperationException - as not applicable