org.eclipse.datatools.sqltools.data.internal.core.editor
Class TableDataImpl

java.lang.Object
  extended by org.eclipse.datatools.sqltools.data.internal.core.editor.TableDataImpl
All Implemented Interfaces:
ITableData, ITableData2

public class TableDataImpl
extends java.lang.Object
implements ITableData2

Implementation of the ISqlTableData based on JDBC 1.0 API (should work with any driver). The table is queried through a 'select * from ...' statement and the data is stored in a bidimensional array of objects. Reading data is done by directly accessing the im-memory array. Modifying the data is done by issuing insert/update/delete statements, using one of the possible unique constraints of the table to uniquely identify the row. If no unique constraints is available, all the columns will be used, which doesn't garentee that a single column will be modified.

Author:
groux

Constructor Summary
TableDataImpl(Table sqlTable)
           
 
Method Summary
 void deleteRow(IRowData row)
           
 void dispose()
           
 int getColumnCount()
           
 IColumnDataAccessor getColumnDataAccessor(int col)
           
 java.lang.String getColumnHeader(int col)
           
 java.lang.String getColumnName(int col)
           
 int getColumnType(int col)
           
 java.lang.String getColumnTypeName(int col)
          Gets the name of the column data type as returned by the database
 java.sql.Connection getConnection()
           
static java.lang.String getFormattedTypeName(Column sqlCol)
           
 int[] getKeyColumns()
           
 java.lang.String getQualifiedTableName()
           
 java.lang.String getQuotedColumnName(int col)
           
 java.util.List getResultColumns()
           
 java.util.Vector getRows()
           
 Table getSQLTable()
          Gets the SQL Model table
 IRowData insertRow()
           
 boolean isReadonly()
           
 void revert()
           
 int save(Output output)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableDataImpl

public TableDataImpl(Table sqlTable)
              throws java.sql.SQLException,
                     java.io.IOException,
                     java.lang.Exception
Throws:
java.sql.SQLException
java.io.IOException
java.lang.Exception
Method Detail

dispose

public void dispose()
Specified by:
dispose in interface ITableData

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface ITableData

getColumnHeader

public java.lang.String getColumnHeader(int col)
Specified by:
getColumnHeader in interface ITableData

getFormattedTypeName

public static java.lang.String getFormattedTypeName(Column sqlCol)

getColumnName

public java.lang.String getColumnName(int col)
Specified by:
getColumnName in interface ITableData

getQuotedColumnName

public java.lang.String getQuotedColumnName(int col)
Specified by:
getQuotedColumnName in interface ITableData2

getColumnType

public int getColumnType(int col)
Specified by:
getColumnType in interface ITableData

getColumnTypeName

public java.lang.String getColumnTypeName(int col)
Gets the name of the column data type as returned by the database

Specified by:
getColumnTypeName in interface ITableData2
Returns:
the name of the column data type

getColumnDataAccessor

public IColumnDataAccessor getColumnDataAccessor(int col)
Specified by:
getColumnDataAccessor in interface ITableData

getRows

public java.util.Vector getRows()
Specified by:
getRows in interface ITableData

getKeyColumns

public int[] getKeyColumns()
Specified by:
getKeyColumns in interface ITableData2

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface ITableData2

save

public int save(Output output)
         throws java.sql.SQLException
Specified by:
save in interface ITableData
Throws:
java.sql.SQLException

revert

public void revert()
Specified by:
revert in interface ITableData

deleteRow

public void deleteRow(IRowData row)
Specified by:
deleteRow in interface ITableData

insertRow

public IRowData insertRow()
Specified by:
insertRow in interface ITableData

isReadonly

public boolean isReadonly()
Specified by:
isReadonly in interface ITableData

getQualifiedTableName

public java.lang.String getQualifiedTableName()
Specified by:
getQualifiedTableName in interface ITableData2

getSQLTable

public Table getSQLTable()
Gets the SQL Model table

Specified by:
getSQLTable in interface ITableData2
Returns:
the SQL Model table

getResultColumns

public java.util.List getResultColumns()
Specified by:
getResultColumns in interface ITableData2