com.uwyn.rife.database.queries
Class Insert

java.lang.Object
  extended by com.uwyn.rife.database.queries.Insert
All Implemented Interfaces:
Query, Cloneable

public class Insert
extends Object
implements Cloneable

Object representation of a SQL "INSERT" query.

This object may be used to dynamically construct a SQL statement in a database-independent fashion. After it is finished, it may be executed using DbQueryManager.executeUpdate().

Since:
1.0
Version:
$Revision: 3648 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com), Steven Grimm (koreth[remove] at midwinter dot com)

Field Summary
protected  Datasource mDatasource
           
protected  boolean mExcludeUnsupportedCapabilities
           
protected  String mSql
           
 
Constructor Summary
Insert(Datasource datasource)
           
 
Method Summary
protected  Insert _field(String field, Object value)
           
protected  void _fieldSubselect(Select query)
           
protected  void _tableSubselect(Select query)
           
protected  void _unionSubselect(Select query)
           
protected  void _whereSubselect(Select query)
           
protected  void addFieldParameter(String field)
           
protected  void addWhereParameter(String field)
           
 void addWhereParameters(List<String> parameters)
           
 void clear()
           
protected  void clearGenerated()
           
protected  void clearWhereParameters()
           
 Insert clone()
           
 Insert field(String field, boolean value)
           
 Insert field(String field, byte value)
           
 Insert field(String field, char value)
           
 Insert field(String field, double value)
           
 Insert field(String field, float value)
           
 Insert field(String field, int value)
           
 Insert field(String field, long value)
           
 Insert field(String field, Object value)
           
 Insert field(String field, Select query)
           
 Insert field(String field, short value)
           
 Insert fieldCustom(String field, String expression)
           
 Insert fieldParameter(String field)
           
 Insert fieldParameter(String field, String alias)
           
 Insert fields(Object bean)
           
 Insert fields(Object[] keyValues)
           
 Insert fieldsExcluded(Object bean, String[] excludedFields)
           
 Insert fieldsFiltered(Object bean, String[] includedFields, String[] excludedFields)
           
 Insert fieldsIncluded(Object bean, String[] includedFields)
           
 Insert fieldsParameters(Class beanClass)
           
 Insert fieldsParametersExcluded(Class beanClass, String[] excludedFields)
           
 Insert fieldSubselect(Select query)
           
 com.uwyn.rife.database.capabilities.Capabilities getCapabilities()
           
 Datasource getDatasource()
           
 Map<String,List<Object>> getFields()
           
 String getHint()
           
 String getInto()
           
 String getLimitParameter()
           
 String getOffsetParameter()
           
 QueryParameters getParameters()
           
 String getSql()
           
protected  List<String> getWhereParameters()
           
 Insert hint(String hint)
           
 Insert into(String into)
           
protected  boolean isLimitBeforeOffset()
           
 void setExcludeUnsupportedCapabilities(boolean flag)
           
protected  void setLimitParameter(String limitParameter)
           
protected  void setOffsetParameter(String offsetParameter)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.uwyn.rife.database.queries.Query
setExcludeUnsupportedCapabilities
 

Field Detail

mDatasource

protected Datasource mDatasource

mSql

protected String mSql

mExcludeUnsupportedCapabilities

protected boolean mExcludeUnsupportedCapabilities
Constructor Detail

Insert

public Insert(Datasource datasource)
Method Detail

clear

public void clear()
Specified by:
clear in interface Query

getHint

public String getHint()

getInto

public String getInto()

getFields

public Map<String,List<Object>> getFields()

getCapabilities

public com.uwyn.rife.database.capabilities.Capabilities getCapabilities()
Specified by:
getCapabilities in interface Query

getSql

public String getSql()
              throws DbQueryException
Specified by:
getSql in interface Query
Throws:
DbQueryException

hint

public Insert hint(String hint)

into

public Insert into(String into)

fieldSubselect

public Insert fieldSubselect(Select query)

_field

protected Insert _field(String field,
                        Object value)

fieldParameter

public Insert fieldParameter(String field)

fieldParameter

public Insert fieldParameter(String field,
                             String alias)

field

public Insert field(String field,
                    char value)

field

public Insert field(String field,
                    boolean value)

field

public Insert field(String field,
                    byte value)

field

public Insert field(String field,
                    double value)

field

public Insert field(String field,
                    float value)

field

public Insert field(String field,
                    int value)

field

public Insert field(String field,
                    long value)

field

public Insert field(String field,
                    short value)

field

public Insert field(String field,
                    Select query)

field

public Insert field(String field,
                    Object value)

fieldCustom

public Insert fieldCustom(String field,
                          String expression)

fields

public Insert fields(Object[] keyValues)

fields

public Insert fields(Object bean)
              throws DbQueryException
Throws:
DbQueryException

fieldsIncluded

public Insert fieldsIncluded(Object bean,
                             String[] includedFields)
                      throws DbQueryException
Throws:
DbQueryException

fieldsExcluded

public Insert fieldsExcluded(Object bean,
                             String[] excludedFields)
                      throws DbQueryException
Throws:
DbQueryException

fieldsFiltered

public Insert fieldsFiltered(Object bean,
                             String[] includedFields,
                             String[] excludedFields)
                      throws DbQueryException
Throws:
DbQueryException

fieldsParameters

public Insert fieldsParameters(Class beanClass)
                        throws DbQueryException
Throws:
DbQueryException

fieldsParametersExcluded

public Insert fieldsParametersExcluded(Class beanClass,
                                       String[] excludedFields)
                                throws DbQueryException
Throws:
DbQueryException

clone

public Insert clone()

_fieldSubselect

protected void _fieldSubselect(Select query)

_tableSubselect

protected void _tableSubselect(Select query)

_whereSubselect

protected void _whereSubselect(Select query)

_unionSubselect

protected void _unionSubselect(Select query)

getParameters

public QueryParameters getParameters()
Specified by:
getParameters in interface Query

addFieldParameter

protected void addFieldParameter(String field)

clearWhereParameters

protected void clearWhereParameters()

addWhereParameter

protected void addWhereParameter(String field)

getWhereParameters

protected List<String> getWhereParameters()

addWhereParameters

public void addWhereParameters(List<String> parameters)

setLimitParameter

protected void setLimitParameter(String limitParameter)

getLimitParameter

public String getLimitParameter()

setOffsetParameter

protected void setOffsetParameter(String offsetParameter)

getOffsetParameter

public String getOffsetParameter()

isLimitBeforeOffset

protected boolean isLimitBeforeOffset()

getDatasource

public Datasource getDatasource()

setExcludeUnsupportedCapabilities

public void setExcludeUnsupportedCapabilities(boolean flag)
Specified by:
setExcludeUnsupportedCapabilities in interface Query

clearGenerated

protected void clearGenerated()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.