ModeShape Distribution 3.0.0.CR1

org.modeshape.jcr.value.binary
Class Database.SQLBuilder

java.lang.Object
  extended by org.modeshape.jcr.value.binary.Database.SQLBuilder
Enclosing class:
Database

public class Database.SQLBuilder
extends Object

Database specific SQL query builder.


Constructor Summary
Database.SQLBuilder()
           
 
Method Summary
 Database.SQLBuilder and()
          Appends 'and' keyword.
 PreparedStatement build()
          Generates prepared statement.
 Database.SQLBuilder columns(String... columns)
          Appends comma separated list of specified column names.
 Database.SQLBuilder condition(String column, String colType, String sign, String value)
          Builds database specific condition statement.
 Database.SQLBuilder delete()
          Appends 'delete' keyword to the statement.
 Database.SQLBuilder from(String tableName)
          Appends 'from' keyword.
 String getSQL()
          Shows built statement as text.
 Database.SQLBuilder insert()
          Appends 'insert' keyword to the statement.
 Database.SQLBuilder into(String tableName)
          Appends 'into 'keyword and open bracket to the statement.
 Database.SQLBuilder select()
          Appends 'select' keyword to the statement.
 Database.SQLBuilder set(String col, String val)
          Appends 'set' part.
 Database.SQLBuilder update(String tableName)
          Appends 'update' keyword with table name to the statement.
 Database.SQLBuilder values(String... columns)
          Appends closed bracket and 'value(...)' of sql statement.
 Database.SQLBuilder where()
          Appends 'where' keyword.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database.SQLBuilder

public Database.SQLBuilder()
Method Detail

build

public PreparedStatement build()
                        throws SQLException
Generates prepared statement.

Returns:
prepared statement
Throws:
SQLException

getSQL

public String getSQL()
Shows built statement as text.

Returns:
build statement as text.

insert

public Database.SQLBuilder insert()
Appends 'insert' keyword to the statement.

Returns:
this builder instance.

select

public Database.SQLBuilder select()
Appends 'select' keyword to the statement.

Returns:
this builder instance.

delete

public Database.SQLBuilder delete()
Appends 'delete' keyword to the statement.

Returns:
this builder instance.

update

public Database.SQLBuilder update(String tableName)
Appends 'update' keyword with table name to the statement.

Parameters:
tableName - the name of the table to update
Returns:
this builder instance.

set

public Database.SQLBuilder set(String col,
                               String val)
Appends 'set' part.

Parameters:
col - column name to update
val - new value
Returns:
this builder instance

into

public Database.SQLBuilder into(String tableName)
Appends 'into 'keyword and open bracket to the statement.

Parameters:
tableName - the name of the table; may not be null
Returns:
this builder instance.

columns

public Database.SQLBuilder columns(String... columns)
Appends comma separated list of specified column names.

Parameters:
columns - list of column names
Returns:
this builder instance.

values

public Database.SQLBuilder values(String... columns)
Appends closed bracket and 'value(...)' of sql statement.

Parameters:
columns - list of values
Returns:
this builder instance.

from

public Database.SQLBuilder from(String tableName)
Appends 'from' keyword.

Parameters:
tableName - the name of the table; may not be null
Returns:
this builder instance.

where

public Database.SQLBuilder where()
Appends 'where' keyword.

Returns:
this builder instance.

and

public Database.SQLBuilder and()
Appends 'and' keyword.

Returns:
this builder instance.

condition

public Database.SQLBuilder condition(String column,
                                     String colType,
                                     String sign,
                                     String value)
Builds database specific condition statement.

Parameters:
column - column name used in left hand side of condition
colType - type of the column
sign - sign between lhs and rhs
value - right hand side of the condition
Returns:
this builder instance.

ModeShape Distribution 3.0.0.CR1

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.