|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.mssm.crover.tables.AddToTable
Adds to columns (and creates them if necessary) from an input file.
| Field Summary | |
protected java.sql.Connection |
conn
|
| Constructor Summary | |
protected |
AddToTable(java.lang.String filename,
java.lang.String tablename,
java.lang.String[] heading,
java.lang.String index)
|
| Method Summary | |
void |
addColumns(java.lang.String tablename,
java.lang.String[] newHeadings,
java.util.HashSet oldHeadings)
Checks whether the columns to be added to already exist in the table. |
void |
addData(java.lang.String filename,
java.lang.String tablename,
java.lang.String[] newHeadings,
java.lang.String index)
Reads the input file (which should contain the same number of tab-delimited fields per line as columns you want to add to), and adds the information from each field in each line to the corresponding column. |
void |
begin()
Notifies this class that a batch of interaction now begin. |
java.util.HashSet |
describeTable(java.lang.String tablename)
Uses SQL to describe the table, and puts the column headings into a HashSet. |
void |
end()
Notifies this class that a batch of interaction now ends. |
static java.lang.String[] |
getHeading(java.lang.String[] args)
Returns the name of the table to which the data is to be added. |
static java.lang.String |
getIndexColumn(java.lang.String[] args)
Returns the name of the column to be used as an identifier. |
static java.lang.String |
getInputFile(java.lang.String[] args)
Returns the name of the input file. |
static AddToTable |
getInstance(java.lang.String filename,
java.lang.String tablename,
java.lang.String[] heading,
java.lang.String index)
|
static java.lang.String |
getTableName(java.lang.String[] args)
Returns the name of the table to which the data is to be added. |
protected void |
initConnection()
Makes sure a connection is available. |
static void |
main(java.lang.String[] args)
|
static void |
printHelp()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.sql.Connection conn
| Constructor Detail |
protected AddToTable(java.lang.String filename,
java.lang.String tablename,
java.lang.String[] heading,
java.lang.String index)
throws DatabaseErrorException
| Method Detail |
public static java.lang.String getInputFile(java.lang.String[] args)
public static java.lang.String getTableName(java.lang.String[] args)
public static java.lang.String[] getHeading(java.lang.String[] args)
public static java.lang.String getIndexColumn(java.lang.String[] args)
public static void printHelp()
public java.util.HashSet describeTable(java.lang.String tablename)
throws java.sql.SQLException
java.sql.SQLException
public void addColumns(java.lang.String tablename,
java.lang.String[] newHeadings,
java.util.HashSet oldHeadings)
throws java.sql.SQLException
java.sql.SQLException
public void addData(java.lang.String filename,
java.lang.String tablename,
java.lang.String[] newHeadings,
java.lang.String index)
throws java.sql.SQLException,
java.io.FileNotFoundException,
java.io.IOException,
DatabaseErrorException
java.sql.SQLException
java.io.FileNotFoundException
java.io.IOException
DatabaseErrorException
public void begin()
throws DatabaseErrorException
DatabaseErrorException
public void end()
throws DatabaseErrorException
DatabaseErrorException
protected void initConnection()
throws DatabaseErrorException
DatabaseErrorException
public static AddToTable getInstance(java.lang.String filename,
java.lang.String tablename,
java.lang.String[] heading,
java.lang.String index)
throws DatabaseErrorException
DatabaseErrorExceptionpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||