com.espertech.esperio.db.core
Class MultiKeyMultiValueTable

java.lang.Object
  extended by com.espertech.esperio.db.core.MultiKeyMultiValueTable

public class MultiKeyMultiValueTable
extends java.lang.Object


Constructor Summary
MultiKeyMultiValueTable(java.lang.String tableName, java.lang.String[] keyFieldNames, int[] keyTypes, java.lang.String[] valueFieldNames, int[] valueTypes, StoreExceptionHandler storeExceptionHandler)
          Ctor.
 
Method Summary
 boolean deleteValue(java.sql.Connection connection, java.lang.Object[] keys)
          Delete row, returning true if deleted or false if no row found to delete.
 void deleteValueSubkeyed(java.sql.Connection connection, java.lang.Object[] keys)
          Delete all rows with the keys matching the subset of all keys, returning true if deleted or false if no row found to delete.
 void insertValue(java.sql.Connection connection, java.lang.Object[] keys, java.lang.Object[] values)
          Insert row, indicating a unique-key contraint violation via StoreExceptionDBDuplicateRow.
 void insertValueIgnoreDup(java.sql.Connection connection, java.lang.Object[] keys, java.lang.Object[] values)
          Insert row, ignoring a unique-key contraint violation via StoreExceptionDBDuplicateRow.
 boolean isExistsKey(java.sql.Connection connection, java.lang.Object[] keys)
          Determine if the key exists.
 java.util.List<java.lang.Object[]> readAll(java.sql.Connection connection)
          Read all rows in table.
 java.util.List<java.lang.Object[]> readAllSubkeyed(java.sql.Connection connection, java.lang.Object[] keys)
          Read all rows starting with the key values supplied, key value must start at the first and can between the 1st and last key.
 java.lang.Object[] readValue(java.sql.Connection connection, java.lang.Object[] keys)
          Read value returning null if not found or the value (which can also be null).
protected  void selectInsertUpdateValue(java.sql.Connection connection, java.lang.Object[] keys, java.lang.Object[] values)
          Select for the row, and if found update the row else insert a new row.
 void updateInsertValue(java.sql.Connection connection, java.lang.Object[] keys, java.lang.Object[] values)
          Update row, and if not found insert row.
 boolean updateValue(java.sql.Connection connection, java.lang.Object[] keys, java.lang.Object[] values)
          Update row, returning an indicator whether the row was found (true) or not (false).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiKeyMultiValueTable

public MultiKeyMultiValueTable(java.lang.String tableName,
                               java.lang.String[] keyFieldNames,
                               int[] keyTypes,
                               java.lang.String[] valueFieldNames,
                               int[] valueTypes,
                               StoreExceptionHandler storeExceptionHandler)
Ctor.

Parameters:
tableName - table name
keyFieldNames - names of key fields
keyTypes - types of key fields
valueFieldNames - names of value fields
valueTypes - types of value fields
storeExceptionHandler - handler for store exceptions
Method Detail

insertValue

public void insertValue(java.sql.Connection connection,
                        java.lang.Object[] keys,
                        java.lang.Object[] values)
Insert row, indicating a unique-key contraint violation via StoreExceptionDBDuplicateRow.

Parameters:
connection - db connection
keys - key values
values - column values
Throws:
StoreExceptionDBRel - when the insert failed, such as duplicate row

insertValueIgnoreDup

public void insertValueIgnoreDup(java.sql.Connection connection,
                                 java.lang.Object[] keys,
                                 java.lang.Object[] values)
Insert row, ignoring a unique-key contraint violation via StoreExceptionDBDuplicateRow.

Parameters:
connection - db connection
keys - key values
values - column values

updateValue

public boolean updateValue(java.sql.Connection connection,
                           java.lang.Object[] keys,
                           java.lang.Object[] values)
Update row, returning an indicator whether the row was found (true) or not (false).

Parameters:
connection - db connection
keys - key values
values - column values
Returns:
indicator whether row was found
Throws:
StoreExceptionDBRel - failed operation

deleteValueSubkeyed

public void deleteValueSubkeyed(java.sql.Connection connection,
                                java.lang.Object[] keys)
Delete all rows with the keys matching the subset of all keys, returning true if deleted or false if no row found to delete.

Parameters:
connection - db connection
keys - key values
Throws:
StoreExceptionDBRel - failed operation

deleteValue

public boolean deleteValue(java.sql.Connection connection,
                           java.lang.Object[] keys)
Delete row, returning true if deleted or false if no row found to delete.

Parameters:
connection - db connection
keys - key values
Returns:
indicator whether row was found and deleted (true) or not found (false)
Throws:
StoreExceptionDBRel - failed operation

selectInsertUpdateValue

protected void selectInsertUpdateValue(java.sql.Connection connection,
                                       java.lang.Object[] keys,
                                       java.lang.Object[] values)
Select for the row, and if found update the row else insert a new row.

Parameters:
connection - db connection
keys - key values
values - column values
Throws:
StoreExceptionDBRel - failed operation

readValue

public java.lang.Object[] readValue(java.sql.Connection connection,
                                    java.lang.Object[] keys)
Read value returning null if not found or the value (which can also be null).

Parameters:
connection - db connection
keys - to read
Returns:
value
Throws:
StoreExceptionDBRel - failed operation

isExistsKey

public boolean isExistsKey(java.sql.Connection connection,
                           java.lang.Object[] keys)
Determine if the key exists.

Parameters:
connection - db connection
keys - key values
Returns:
indicator whether row exists
Throws:
StoreExceptionDBRel - failed operation

updateInsertValue

public void updateInsertValue(java.sql.Connection connection,
                              java.lang.Object[] keys,
                              java.lang.Object[] values)
                       throws StoreExceptionDBRel
Update row, and if not found insert row.

Parameters:
connection - db connection
keys - key values
values - column values
Throws:
StoreExceptionDBRel - failed operation

readAll

public java.util.List<java.lang.Object[]> readAll(java.sql.Connection connection)
Read all rows in table.

Parameters:
connection - to use
Returns:
object array of columns

readAllSubkeyed

public java.util.List<java.lang.Object[]> readAllSubkeyed(java.sql.Connection connection,
                                                          java.lang.Object[] keys)
Read all rows starting with the key values supplied, key value must start at the first and can between the 1st and last key.

Parameters:
connection - to use
keys - to use
Returns:
list of objects

© 2006-2016 EsperTech Inc.
All rights reserved.
Visit us at espertech.com