com.exponto.jstock
Class InitDB

java.lang.Object
  extended bycom.exponto.jstock.InitDB

public class InitDB
extends java.lang.Object

Author:
kaare Initialize certain tables in the database. For now all tables must be created before theese methods are called

Constructor Summary
InitDB()
           
 
Method Summary
static boolean verifyIndexMap(java.util.HashMap map, java.lang.String table, java.lang.String field, java.lang.String[] reference)
          Verifies that the database contains all values for certain type of data that is known by the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitDB

public InitDB()
Method Detail

verifyIndexMap

public static boolean verifyIndexMap(java.util.HashMap map,
                                     java.lang.String table,
                                     java.lang.String field,
                                     java.lang.String[] reference)
Verifies that the database contains all values for certain type of data that is known by the application. If new ones are found, they are added to the database, and false is returned. If the update to the database failed, an error is logged. The data that can be verified by this method must contain only of a string field (varchar) and must have a autoincrementing index. This methode ensure that the database will be automatically updated if e.g. new indicators are added in later versions.

Parameters:
map - - A hashmap with data loaded from the database
table - - Name of the database table
reference - - String [] with the correct values/names
Returns:
true if no new ones are found, false otherwise.


Copyright © 2004 Kaare Ranum