edu.jhu.tmaj.client.importer.specimens.data
Class ImportDBUtil

java.lang.Object
  extended by edu.jhu.tmaj.client.importer.specimens.data.ImportDBUtil

public final class ImportDBUtil
extends java.lang.Object

Database utility functions used in the import program. Maps are converted into SQL statements.


Method Summary
static int insertHash(java.lang.String tableName, java.lang.String primaryKeyName, java.util.Map<java.lang.String,java.lang.String> fieldName_value, int userID)
          Inserts a record into a database tables based on values given in a Map.
static void updateHash(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.String> fieldName_value, java.lang.String primaryKey, int id, int userID)
          Updates a record in a table based on values from a Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

updateHash

public static void updateHash(java.lang.String tableName,
                              java.util.Map<java.lang.String,java.lang.String> fieldName_value,
                              java.lang.String primaryKey,
                              int id,
                              int userID)
                       throws java.sql.SQLException
Updates a record in a table based on values from a Map.

Parameters:
tableName - the name of the table to update
fieldName_value - a Map containing column-names as keys, and their values as the hash's values
primaryKey - the name of the primary key of the table (example: SpecimenID)
id - the id of the primary key of the record that is being updated
userID - the UserID of the user updating this record.
Throws:
java.sql.SQLException

insertHash

public static int insertHash(java.lang.String tableName,
                             java.lang.String primaryKeyName,
                             java.util.Map<java.lang.String,java.lang.String> fieldName_value,
                             int userID)
                      throws java.sql.SQLException
Inserts a record into a database tables based on values given in a Map.

Throws:
java.sql.SQLException