org.deegree.commons.jdbc
Class InsertRow

java.lang.Object
  extended by org.deegree.commons.jdbc.TransactionRow
      extended by org.deegree.commons.jdbc.InsertRow

public class InsertRow
extends TransactionRow

Encapsulates columns and values for inserting one row into a database table.

Version:
$Revision: $, $Date: $
Author:
Markus Schneider, last edited by: $Author: markus $

Field Summary
protected  String autogenColumn
           
 
Fields inherited from class org.deegree.commons.jdbc.TransactionRow
columnToLiteral, columnToObject, table
 
Constructor Summary
InsertRow(QTableName table, String autoGenColumn)
          Creates a new InsertRow instance.
 
Method Summary
 Object get(String column)
           
 String getSql()
           
 Map<String,Object> performInsert(Connection conn)
          Performs the insertion and deals with autogenerated columns.
 String toString()
           
 
Methods inherited from class org.deegree.commons.jdbc.TransactionRow
addLiteralValue, addPreparedArgument, addPreparedArgument, addPreparedArgument, getColumns, getTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

autogenColumn

protected String autogenColumn
Constructor Detail

InsertRow

public InsertRow(QTableName table,
                 String autoGenColumn)
Creates a new InsertRow instance.

Parameters:
table - table targeted by the insert, must not be null
autoGenColumn - name of column with auto generation, can be null (no auto-generated columns)
Method Detail

get

public Object get(String column)
Overrides:
get in class TransactionRow
Parameters:
column - the name of the column, must not be null
Returns:
the value assigned to the column with the given name, null if there is not value assigned

getSql

public String getSql()
Specified by:
getSql in class TransactionRow
Returns:
the generated sl statement

performInsert

public Map<String,Object> performInsert(Connection conn)
                                 throws SQLException
Performs the insertion and deals with autogenerated columns.

Parameters:
conn - JDBC connection to use for the insertion, must not be null
Returns:
autogenerated keys, can be empty, but never null
Throws:
SQLException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.