cmu.survey.editor.data.sql
Class ImportTableToTableStorage

java.lang.Object
  extended by cmu.survey.editor.data.sql.ImportTableToTableStorage

public class ImportTableToTableStorage
extends java.lang.Object


Constructor Summary
ImportTableToTableStorage(TableStorage tableStorage)
          You can pass in null, but then you'll only be able to call appendToTable, and this won't be able to make any new tables.
 
Method Summary
 boolean appendToTable(DataTableModel appendTableModel, TripleTableModel tableModel)
           
 boolean appendToTable(DataTableModel tableToAppendTo, java.util.Vector<java.lang.String> columnNames, java.util.Vector<java.lang.Class> columnTypes, java.util.Vector<java.util.Vector<java.lang.Object>> rows)
          Warning: This will guess at a primary key column -- i.e. if there's only one possible primary key column.
 java.lang.String getLastError()
           
 java.util.Vector<java.lang.Integer> getPrimaryColumnIndexGuess(TripleTableModel tableModel)
          Returns all possible columns that could be the auto-incremented/primary key column -- i.e. columns that have integers that are all unique.
 DataTableModel importTable(java.lang.String tableName, java.util.List<java.lang.String> columnNames, java.util.List<java.lang.Class> columnTypes, java.util.List<? extends java.util.List<? extends java.lang.Object>> rows, java.lang.Integer primaryKeyColumn)
           
 DataTableModel importTable(java.lang.String tableName, TripleTableModel tableModel)
          Warning: This will guess at a primary key column -- i.e. if there's only one possible primary key column.
 DataTableModel importTable(java.lang.String tableName, TripleTableModel tableModel, java.lang.Integer primaryKeyColumn)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportTableToTableStorage

public ImportTableToTableStorage(TableStorage tableStorage)
You can pass in null, but then you'll only be able to call appendToTable, and this won't be able to make any new tables.

Parameters:
tableStorage -
Method Detail

importTable

public DataTableModel importTable(java.lang.String tableName,
                                  TripleTableModel tableModel)
Warning: This will guess at a primary key column -- i.e. if there's only one possible primary key column. If there's no possible primary key, or more than one, it won't select a primary key, but it'll create a table that's not yet editable (as a TableDataBodelSQL, through JDBC's MySQL connection).

Parameters:
tableName - The name of the table to import.
tableModel - The Triple containing the data of the table (column names, column types, and row data).
Returns:

importTable

public DataTableModel importTable(java.lang.String tableName,
                                  TripleTableModel tableModel,
                                  java.lang.Integer primaryKeyColumn)

appendToTable

public boolean appendToTable(DataTableModel appendTableModel,
                             TripleTableModel tableModel)

appendToTable

public boolean appendToTable(DataTableModel tableToAppendTo,
                             java.util.Vector<java.lang.String> columnNames,
                             java.util.Vector<java.lang.Class> columnTypes,
                             java.util.Vector<java.util.Vector<java.lang.Object>> rows)
Warning: This will guess at a primary key column -- i.e. if there's only one possible primary key column. If there's no possible primary key, or more than one, it won't select a primary key, but it'll create a table that's not yet editable (as a TableDataBodelSQL, through JDBC's MySQL connection).

Parameters:
tableName -
columnNames -
columnTypes -
rows -
Returns:

importTable

public DataTableModel importTable(java.lang.String tableName,
                                  java.util.List<java.lang.String> columnNames,
                                  java.util.List<java.lang.Class> columnTypes,
                                  java.util.List<? extends java.util.List<? extends java.lang.Object>> rows,
                                  java.lang.Integer primaryKeyColumn)

getPrimaryColumnIndexGuess

public java.util.Vector<java.lang.Integer> getPrimaryColumnIndexGuess(TripleTableModel tableModel)
Returns all possible columns that could be the auto-incremented/primary key column -- i.e. columns that have integers that are all unique.

Parameters:
rows -
Returns:
null if there is no possible column found that could be a primary id

main

public static final void main(java.lang.String[] args)

getLastError

public java.lang.String getLastError()