com.partnersoft.sql
Class SqlInserter

java.lang.Object
  extended by com.partnersoft.sql.SqlInserter

public class SqlInserter
extends java.lang.Object

Tool to simplify insertions into an SqlTable. Creates and retains a prepared statement so you can hang onto it and use it over and over on the same connection for better performance.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
SqlInserter(SqlTable table)
           
SqlInserter(SqlTable table, java.util.List<java.lang.String> columnNameList)
           
SqlInserter(SqlTable table, java.lang.String... columnNames)
           
 
Method Summary
 SqlTable getTable()
           
 void insert(Cog record)
          Insert a record using the given Cog containing values.
 void insert(java.util.List<java.lang.Object> values)
          Inserts a record with the given list of values.
 void insert(Naming<java.lang.Object> record)
          Insert a record using the given Naming of values.
 void insert(java.lang.Object... values)
          Inserts a record with the given array of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlInserter

public SqlInserter(SqlTable table)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

SqlInserter

public SqlInserter(SqlTable table,
                   java.lang.String... columnNames)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

SqlInserter

public SqlInserter(SqlTable table,
                   java.util.List<java.lang.String> columnNameList)
            throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

insert

public void insert(Naming<java.lang.Object> record)
            throws java.sql.SQLException
Insert a record using the given Naming of values. These must have the same names as the column names given in the constructor.

Throws:
java.sql.SQLException

insert

public void insert(Cog record)
            throws java.sql.SQLException
Insert a record using the given Cog containing values. These must have the same names as the column names given in the constructor.

Throws:
java.sql.SQLException

insert

public void insert(java.lang.Object... values)
            throws java.sql.SQLException
Inserts a record with the given array of values. These must have the same number and order as the column names given in the constructor.

Parameters:
values -
Throws:
java.sql.SQLException

insert

public void insert(java.util.List<java.lang.Object> values)
            throws java.sql.SQLException
Inserts a record with the given list of values. These must have the same number and order as the column names given in the constructor.

Parameters:
values -
Throws:
java.sql.SQLException

getTable

public SqlTable getTable()