Class BindExpressionStatement

java.lang.Object
com.invirgance.convirgance.jdbc.sql.BindExpressionStatement
All Implemented Interfaces:
NamedSchema, ExpressionStatement, SQLStatement

public class BindExpressionStatement extends Object implements ExpressionStatement
This is used to create an expression with named bindings in a SQL query. Additionally the name can be modified and still point to the same underlying BindVariable.

 DatabaseSchemaLayout layout = getHSQLLayout();
 Table table = layout.getCurrentSchema().getTable("customer");

 BindVariable age = new BindVariable("customerAge");

 BindExpressionStatement period = new
 BindExpressionStatement(layout, age, "trialAccountPeriod");

 SQLStatement query = table.select()
  .column(table.getColumn("name"))
  .from(table)
  .where()
  .greaterThanOrEquals(table.getColumn("age"), period)
  .done();
 
Author:
jbanes
  • Constructor Details

    • BindExpressionStatement

      public BindExpressionStatement(DatabaseSchemaLayout layout, BindVariable bind)
      Creates a BindExpression from a BindVariable using the database metadata from DatabaseSchemaLayout.
      Parameters:
      layout - The layout.
      bind - The BindVariable.
    • BindExpressionStatement

      public BindExpressionStatement(DatabaseSchemaLayout layout, BindVariable bind, String name)
      Creates a BindExpression from a BindVariable using the database metadata from DatabaseSchemaLayout, you can provide an optional name to reuse the bind variable under another name.
      Parameters:
      layout - The DatabaseSchemaLayout.
      bind - The BindVariable.
      name - Another name to reference the same BindVariable.
  • Method Details

    • getBind

      public BindVariable getBind()
      Get the BindVariable for this expression.
      Returns:
      The bind variable.
    • getParent

      public SQLStatement getParent()
      Description copied from interface: SQLStatement
      If this statement is part of a larger statement, this returns the parent statement.
      Specified by:
      getParent in interface SQLStatement
      Returns:
      the parent statement
    • setParent

      public void setParent(SQLStatement parent)
      Specified by:
      setParent in interface SQLStatement
    • getName

      public String getName()
      Description copied from interface: NamedSchema
      Get the schema name of this database object
      Specified by:
      getName in interface NamedSchema
      Returns:
      name of the object with exact database capitalization
    • getQuotedName

      public String getQuotedName()
      Description copied from interface: NamedSchema
      Get the schema name of this database object quoted for use in a SQL statement
      Specified by:
      getQuotedName in interface NamedSchema
      Returns:
      name of the object quoted for use in a SQL statement
    • render

      public SQLRenderer render(SQLRenderer renderer)
      Specified by:
      render in interface SQLStatement