|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.storage.jdbc.JDBCToDataTableAdapter
public class JDBCToDataTableAdapter
The JDBCToDataTableAdapter allows JDBC data sources to be
displayed in any viewer that requires a model of type
com.sas.table.DataTableInterface, such as the com.sas.table.TableView.
The adapter requires a java.sql.Connection object and a query statement.
They can be passed in on the constructor or set via methods.
The setConnection() method will apply the connection object. The
setQueryStatement() method will apply the SQL query statement. When
non-null values for both connection and query statement have been
applied, the adapter is initialized and ready to use.
The query statement must be a SQL query that is valid for the JDBC data source. This may include a blank statement, if valid.
If autoCommit is true when any setXXX method is used, an updateRow()
method will be called upon the ResultSet so that the value(s) passed
by the setXXX method are updated to the data source.
If autoCommit is false, it is necessary to call the commitRow() method
to commit changes to the data source.
This adapter works best with JDBC drivers that can create scrollable result sets. Table
viewers usually need to read backwards to support scrolling the viewer. However, this adapter
can support using scrolling viewers with forward-only result sets
(ResultSet.TYPE_FORWARD_ONLY). That is accomplished by requerying the result set
whenever there is a need to read a row before the current row. There is a performance
penalty for this because the server must be requeried and the adapter re-initializes. If
you want to turn off this feature, call setResultSetRequeryUsed(false).
Here an example of how the adapter can be created using the JdbcOdbc driver.
Connection conn = null;
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
conn = java.sql.DriverManager.getConnection("jdbc:odbc:Northwind");
//create the query statement.
String queryStatement ="select * from orders";
//create the Adapter
JDBCToDataTableAdapter adapter = new JDBCToDataTableAdapter(conn, queryStatement);
}
The adapter can be configured and used within a webAF project. Add a
com.sas.storage.jdbc.JDBCConnection component to your project. Open the customizer and
specify the values needed for your JDBC connection, including the driver name and URL.
Now open the customizer for the adapter.
Specify the value for JDBC Connection using the top combo box. The drop-down list
will show all JDBC Connection objects that exist in your project.
You can set the properties for query statement, column information used,
autoCommit, and read-only, as well.
| Field Summary | |
|---|---|
protected com.sas.collection.ContentsChangedListenerList |
allContentsChangedListeners
List of all the ContentsChangedListeners |
protected java.util.Hashtable |
defaultValues
A Hashtable used to obtain default values for a column. |
static int |
ERROR_CODE_END_OF_FILE
An error code, used to signal that the end of file was reached when reading rows. |
| Fields inherited from class com.sas.storage.jdbc.JDBCAdapter |
|---|
autoCommit, CLASS_NAME, columnInfoUsed, conn, designTime, displayTransform, forwardOnly, initialized, isRowCountKnown, LABEL, meta, NAME, printWarnings, queryRowCountDisabled, queryStatement, RB_KEY, readOnly, result, resultSetRequeryUsed, resultSetType, resultSetUsed, retrieveNumericTypesAsDouble, rowCount, rowCountQueryString, rowNumber, spcs, stmt, trimUsed |
| Fields inherited from interface com.sas.table.RowTemplateTableInterface |
|---|
DEFAULT_INDEX |
| Constructor Summary | |
|---|---|
JDBCToDataTableAdapter()
Default constructor called when the adapter is made in a webAF project. |
|
JDBCToDataTableAdapter(java.sql.Connection conn,
java.lang.String queryStatement)
Constructor used to create an initialized adapter. |
|
JDBCToDataTableAdapter(java.sql.ResultSet result)
Constructor used to connect an adapter directly to a previously created ResultSet. |
|
| Method Summary | |
|---|---|
protected boolean |
absolute(int index)
For scrollable result sets, the absolute() method is called on the result set. |
void |
addColumn(int p0,
java.lang.Class p1,
java.lang.Object p2)
This method is not supported. |
void |
addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
|
void |
addRow(int index)
This method requires a value of -1 for index. |
void |
addRow(int index,
java.lang.Object[] values)
This method requires a value of -1 for index. |
boolean |
attachView()
Required by com.sas.ModelInterface. |
void |
commitRow()
If autoCommit is false, this method calls updateRow
on the result set. |
int |
countColumns(int maxCount)
The maxCount parameter is ignored and the result of getColumnCount
is returned. |
int |
countRows(int maxCount)
Counts the number of rows when the underlying result set is not scrollable ( TYPE_FORWARD_ONLY) and resultSetRequeryUsed is true. |
void |
deleteColumn(int p0)
This method is not supported. |
void |
deleteRow(int row)
Deletes the row at the given row number. |
void |
detachView()
Required by com.sas.ModelInterface. |
void |
fireCellEvent(int row,
int column)
Fire a specific event for a model signaling that one cell has changed. |
protected void |
fireContentsChanged()
Fire a default contents changed event. |
protected void |
fireContentsChanged(com.sas.collection.ContentsChangedEvent event)
Send a ContentsChangedEvent to all the ContentsChangedListener objects in the listener list. |
void |
fireModelEvent()
Fire a default event for a model signaling the some aspect of the model has changed. |
void |
fireModelEvent(java.util.EventObject event)
Fire a specific event for a model signaling that some aspect of the model has changed. |
int |
getBufferBlocks()
This method always returns 1. |
int |
getBufferSize()
This returns the number of rows suggested to the JDBC driver as the number of rows to fetch from the database when more rows are needed for this result set object. |
java.lang.Object |
getCell(int row,
int col)
Returns value of a cell in the JDBC data type of the cell. |
java.lang.Class |
getCellClass(int row,
int col)
Returns the value of column class at the column identified by col. |
java.lang.Class[][] |
getCellClasses(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount)
Returns the classes for a block of cells. |
java.lang.Object[][] |
getCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount)
Returns values for a block of cells in the JDBC data types of the cells. |
java.lang.Object[] |
getColumn(int index)
Returns the values of all the cells in a column. |
java.lang.Class |
getColumnClass(int index)
Returns the class of a column. |
java.lang.Class[] |
getColumnClasses(int col,
int columnCount)
Returns the classes for a range of columns. |
int |
getColumnCount()
Returns the number of columns in the result set. |
java.lang.Object |
getColumnDefaultValue(int index)
Returns any default value set by setColumnDefaultValue. |
java.lang.Object[] |
getColumnDefaultValues(int index,
int count)
Returns any default values set by setColumnDefaultValues. |
int |
getColumnIndex(java.lang.String name)
Returns the column index for a column name. |
java.lang.Object |
getColumnInfo(int index,
java.lang.String columnInfoName)
Returns the named information for a column. |
java.lang.String[] |
getColumnInfoNames()
Returns NAME and LABEL in an array. |
java.lang.String |
getColumnInfoUsed()
Returns the column information that is currently being used as the column label. |
java.lang.Object |
getColumnLabel(int index)
If columnInfoUsed is "LABEL", gets the suggested column title provided by ResultSetMetaData object for the column at the given index. |
java.lang.Object[] |
getColumnLabels(int index,
int count)
If columnInfoUsed is "LABEL", gets the suggested column titles provided by ResultSetMetaData object for the column range. |
java.lang.String[] |
getDisplayedColumns()
This method is not supported. |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Manage properties in the webAF properties sheet. |
java.lang.String |
getFormattedCell(int rowIndex,
int colIndex)
Returns the formatted value of a cell. |
java.lang.String[][] |
getFormattedCells(int startRow,
int startColumn,
int rowCount,
int columnCount)
Returns the formatted values for a block of cells. |
java.lang.String[] |
getFormattedColumn(int col)
Returns the formatted values of all the cells in a column. |
java.lang.String[] |
getFormattedRow(int row)
Returns the formatted values of all the cells in a row. |
java.lang.Object[] |
getRow(int row)
Returns the values of all the cells in a row. |
int |
getRowCount()
Returns the number of rows in the result set. |
java.lang.Object |
getRowLabel(int row)
Returns the row number passed in as a statement. |
java.lang.Object[] |
getRowLabels(int startIndex,
int count)
Returns the row number range as statements in an Object array. |
java.lang.String |
getWhere()
Returns the queryStatement. |
protected void |
initDefaultValues()
Initialize a hashtable for 1) storing column default values from setColumnDefaultValue, 2) getting column default values for
getColumnDefaultValue. |
boolean |
isCellsModifiable()
Indicates whether cells can be modified. |
boolean |
isColumnLabelsSupported()
This method always returns true. |
boolean |
isColumnsDeletable()
This method always returns false. |
boolean |
isColumnsExtendable()
This method always returns false. |
boolean |
isColumnsInsertable()
This method always returns false. |
boolean |
isColumnsLabelSupported()
This method always returns false. |
boolean |
isColumnsRedefinable()
This method always returns false. |
boolean |
isMultipleColumnUpdateSupported()
This method always returns true. |
boolean |
isMultipleRowUpdateSupported()
This method always returns true. |
boolean |
isRowLabelsSupported()
This method always returns true. |
boolean |
isRowsDeletable()
Returns the same value as the isReadOnly method. |
boolean |
isRowsExtendable()
Returns the same value as the isReadOnly method. |
boolean |
isRowsInsertable()
This method always returns false. |
boolean |
isRowsLabelSupported()
This method always returns false. |
void |
refresh()
Sets the initialized field to false and calls the init method. |
void |
removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
|
void |
setBufferBlocks(int p0)
This method is not supported. |
void |
setBufferSize(int rows)
Gives the JDBC driver a hint as to the number of rows to fetch from the database when more rows are needed for this ResultSet object. |
void |
setCell(int rowIndex,
int columnIndex,
java.lang.Object value)
Updates value into the cell at rowIndex, columnIndex. |
void |
setCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount,
java.lang.Object[][] values)
Specifies the values for a block of cells. |
void |
setColumn(int columnIndex,
java.lang.Object[] values)
Specifies the values of all the cells in a column. |
void |
setColumnClass(int p0,
java.lang.Class p1)
This method is not supported. |
void |
setColumnDefaultValue(int index,
java.lang.Object newValue)
Sets the default value associated with a column. |
void |
setColumnInfoUsed(java.lang.String info)
Sets the column information that is currently being used as the column label. |
void |
setDisplayedColumns(java.lang.String[] p0)
This method is not supported. |
void |
setFormattedCell(int rowIndex,
int columnIndex,
java.lang.String value)
Specifies the formatted value of a cell. |
void |
setFormattedCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount,
java.lang.String[][] values)
Specifies the formatted values for a block of cells. |
void |
setFormattedColumn(int index,
java.lang.String[] values)
Specifies the formatted values of all the cells in a column. |
void |
setFormattedRow(int index,
java.lang.String[] values)
Specifies the formatted values of all the cells in a row. |
void |
setRow(int rowIndex,
java.lang.Object[] values)
Specifies the values of all the cells in a row. |
void |
setWhere(java.lang.String whereString)
Passes the whereString to setQueryStatement method. |
protected void |
updateCell(int col,
java.lang.Object value)
This method is called by public "setter" methods. |
void |
useBufferHints(com.sas.models.BufferHints p0)
This method is not supported. |
| Methods inherited from interface com.sas.table.DataTableInterface |
|---|
close, isReadOnly, setReadOnly |
| Field Detail |
|---|
public static final int ERROR_CODE_END_OF_FILE
protected java.util.Hashtable defaultValues
protected transient com.sas.collection.ContentsChangedListenerList allContentsChangedListeners
| Constructor Detail |
|---|
public JDBCToDataTableAdapter()
public JDBCToDataTableAdapter(java.sql.ResultSet result)
result - ResultSet to use.
public JDBCToDataTableAdapter(java.sql.Connection conn,
java.lang.String queryStatement)
conn - A java.sql.Connection object.queryStatement - A SQL query that is valid for the database
represented by conn.| Method Detail |
|---|
public boolean attachView()
attachView in interface ModelInterfaceModelInterface.detachView(),
ViewInterface.attachModel(com.sas.ModelInterface)public void detachView()
detachView in interface ModelInterfaceModelInterface.attachView(),
ViewInterface.detachModel(com.sas.ModelInterface)
protected boolean absolute(int index)
throws com.sas.table.TableException
absolute() method is called on the result set.
For result sets that are not scrollable (forward-only), this method can simulate scrolling
backwards. If isResultSetRequeryUsed()
returns true (the default), forward-only result sets will be requeried as needed to return
to prior row(s). If it returns false, an attempt to move past the last row will throw
a TableException and set its errorCode to ERROR_CODE_END_OF_FILE.
- Parameters:
index - The row number to move to.
- Returns:
- True if it was possible to move to the given row index or false if the cursor is
before the first row or after the last row.
- Throws:
com.sas.table.TableException - If trying to scroll backward in a forward-only ResultSet and
resultSetRequeryUsed = false, or if index is greater than
the number of rows.
protected void initDefaultValues()
setColumnDefaultValue, 2) getting column default values for
getColumnDefaultValue.
public void refresh()
initialized field to false and calls the init method.
refresh in interface DataTableInterfacerefresh in class JDBCAdapter
public int getColumnIndex(java.lang.String name)
throws java.lang.IllegalArgumentException,
com.sas.table.TableException
getColumnIndex in interface DataTableInterfacename - The column name.
com.sas.table.TableException - If column name is not found.
java.lang.IllegalArgumentException - if the column is not in the data set.public java.lang.String getColumnInfoUsed()
NAME or LABEL if the field has been set.
getColumnInfoUsed in interface DataTableInterfaceDataTableInterface.setColumnInfoUsed(java.lang.String)
public void setColumnInfoUsed(java.lang.String info)
throws com.sas.table.TableException
setColumnInfoUsed in interface DataTableInterfaceinfo - The type of information to use in column labels.
com.sas.table.TableException - If info is not a valid value.DataTableInterface.getColumnInfoUsed()public void setWhere(java.lang.String whereString)
whereString to setQueryStatement method.
Like the queryStatement, the whereString must a SQL query valid for
the JDBC data source.
setWhere in interface DataTableInterfacewhereString - The SQL query to applyDataTableInterface.getWhere()public java.lang.String getWhere()
getWhere in interface DataTableInterfaceDataTableInterface.getWhere()public java.lang.String[] getDisplayedColumns()
getDisplayedColumns in interface DataTableInterfacepublic void setDisplayedColumns(java.lang.String[] p0)
setDisplayedColumns in interface DataTableInterfacep0 - an array of column names to be displayed. The array should be in the order
in which the columns should be returned.public void setBufferSize(int rows)
setFetchSize on the result set.
setBufferSize in interface DataTableInterfacerows - The number of rows to fetch.DataTableInterface.setBufferBlocks(int),
DataTableInterface.getBufferSize(),
DataTableInterface.setBufferSize(int)public int getBufferSize()
getFetchSize on the result set.
getBufferSize in interface DataTableInterfaceDataTableInterface.setBufferSize(int),
DataTableInterface.setBufferBlocks(int),
DataTableInterface.getBufferBlocks()public void setBufferBlocks(int p0)
setBufferBlocks in interface DataTableInterfacep0 - Blocking factor. This number is multiplied by the bufferSize
to determine the cache size, the number of rows to store
locally in the client.DataTableInterface.getBufferBlocks(),
DataTableInterface.setBufferSize(int),
DataTableInterface.getBufferSize()public int getBufferBlocks()
getBufferBlocks in interface DataTableInterfaceDataTableInterface.setBufferBlocks(int),
DataTableInterface.setBufferSize(int),
DataTableInterface.getBufferSize()public void commitRow()
autoCommit is false, this method calls updateRow
on the result set.
commitRow in interface DataTableInterfacepublic void useBufferHints(com.sas.models.BufferHints p0)
useBufferHints in interface DataTableInterface
public void addColumn(int p0,
java.lang.Class p1,
java.lang.Object p2)
throws com.sas.table.TableException
addColumn in interface RowTemplateTableInterfacep0 - The one-based position at which to insert the column; columns already
at or above that position will be shifted-up.
If DEFAULT_INDEX is specified the position of the new column is
implementation defined, but should be at the end if possible.p1 - The class of the column's cells.p2 - The default value for the column's cells.
TableException - Provides a catch-all for all non-RuntimeExceptions.
public void addRow(int index)
throws com.sas.table.TableException
RowTemplateTableInterface.DEFAULT_INDEX.
If -1 is passed in, addRow will insert a new blank row in the
result set. Each cell in the row will have default values
appropriate for the column class.
addRow in interface RowTemplateTableInterfaceindex - Must be -1.
com.sas.table.TableException - Thrown if readOnly is true.
java.lang.IllegalStateException - Thrown if index is not -1.
public void addRow(int index,
java.lang.Object[] values)
throws com.sas.table.TableException
RowTemplateTableInterface.DEFAULT_INDEX.
If -1 is passed in, addRow will insert a new row in the
result set. The number of values in the array must equal the number
of columns in the result set.
addRow in interface RowTemplateTableInterfaceindex - Must be -1.values - An Object array containing a value for each column.
com.sas.table.TableException - Thrown if readOnly is true.
com.sas.table.TableException - Thrown if number of values in array is not
equal to number of columns.
java.lang.IllegalStateException - Thrown if index is not -1.
public void deleteColumn(int p0)
throws com.sas.table.TableException
deleteColumn in interface RowTemplateTableInterfacep0 - A one-based index that identifies the column.
TableException - Provides a catch-all for all non-RuntimeExceptions.
public void deleteRow(int row)
throws com.sas.table.TableException
deleteRow in interface RowTemplateTableInterfacerow - The row number to delete.
com.sas.table.TableException - Thrown if readOnly is true.
com.sas.table.TableException - Thrown if the result set's deleteRow
throws a SQLException.
public java.lang.Object getColumnDefaultValue(int index)
throws com.sas.table.TableException
setColumnDefaultValue.
Otherwise, the JDBC data type for the column at index is
determined, then a suitable default value is returned. The column is
identified by the given index. The default value is used as the value
for cells in the column which are not assigned values of their own.
getColumnDefaultValue in interface RowTemplateTableInterfaceindex - A one-based index that identifies the column.
com.sas.table.TableException - Provides a catch-all for all non-RuntimeExceptions.
public java.lang.Object[] getColumnDefaultValues(int index,
int count)
throws com.sas.table.TableException
setColumnDefaultValues.
Otherwise, the JDBC data types for the columns from index to
count are determined, then suitable default values
are returned.
getColumnDefaultValues in interface RowTemplateTableInterfaceindex - A one-based index that identifies the starting column.count - The number of columns in the column range.
com.sas.table.TableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isColumnsDeletable()
throws com.sas.table.TableException
isColumnsDeletable in interface RowTemplateTableInterfaceTableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isColumnsExtendable()
throws com.sas.table.TableException
isColumnsExtendable in interface RowTemplateTableInterfaceTableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isColumnsInsertable()
throws com.sas.table.TableException
isColumnsInsertable in interface RowTemplateTableInterfaceTableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isColumnsRedefinable()
throws com.sas.table.TableException
isColumnsRedefinable in interface RowTemplateTableInterfaceTableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isRowsDeletable()
throws com.sas.table.TableException
isReadOnly method.
isRowsDeletable in interface RowTemplateTableInterfaceisReadOnly returns true.
TableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isRowsExtendable()
throws com.sas.table.TableException
isReadOnly method.
isRowsExtendable in interface RowTemplateTableInterfaceisReadOnly returns true.
TableException - Provides a catch-all for all non-RuntimeExceptions.
public boolean isRowsInsertable()
throws com.sas.table.TableException
isRowsInsertable in interface RowTemplateTableInterfaceTableException - Provides a catch-all for all non-RuntimeExceptions.
public void setColumnDefaultValue(int index,
java.lang.Object newValue)
throws com.sas.table.TableException
setColumnDefaultValue in interface RowTemplateTableInterfaceindex - A one-based index that identifies the column.newValue - The new default value to associate with the column.
com.sas.table.TableException - Provides a catch-all for all non-RuntimeExceptions.
public void setColumnClass(int p0,
java.lang.Class p1)
throws com.sas.table.TableException
setColumnClass in interface RowTemplateTableInterfacep0 - A one-based index that identifies the column.
TableException - Provides a catch-all for all non-RuntimeExceptions.
public java.lang.Object getRowLabel(int row)
throws com.sas.table.TableException
getRowLabel in interface com.sas.table.StaticRowLabelInterfacerow - The row number as an int.
com.sas.table.TableException
public java.lang.Object[] getRowLabels(int startIndex,
int count)
throws com.sas.table.TableException
getRowLabels in interface com.sas.table.StaticRowLabelInterfacestartIndex - A one-based index that identifies the row.count - The number of rows in the row range.
com.sas.table.TableException
public boolean isRowLabelsSupported()
throws com.sas.table.TableException
isRowLabelsSupported in interface com.sas.table.StaticRowLabelInterfacecom.sas.table.TableException
public boolean isRowsLabelSupported()
throws com.sas.table.TableException
isRowsLabelSupported in interface com.sas.table.StaticRowLabelInterfacecom.sas.table.TableException
public java.lang.Object getColumnLabel(int index)
throws com.sas.table.TableException
getColumnLabel in interface StaticColumnLabelInterfaceindex - A one-based index that identifies the column.
com.sas.table.TableException - - Thrown if the ResultSetMetaData throws a SQLException.StaticColumnLabelInterface.isColumnLabelsSupported(),
StaticColumnLabelInterface.isColumnsLabelSupported()
public java.lang.Object[] getColumnLabels(int index,
int count)
throws com.sas.table.TableException
getColumnLabels in interface StaticColumnLabelInterfaceindex - A one-based index that identifies the column.count - The number of columns in the column range.
com.sas.table.TableException - - Thrown if the ResultSetMetaData throws a SQLException.StaticTableInterface.getColumnCount(),
StaticColumnLabelInterface.isColumnLabelsSupported()
public boolean isColumnLabelsSupported()
throws com.sas.table.TableException
isColumnLabelsSupported in interface StaticColumnLabelInterfacetrue if labels are available,
and false otherwise.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
public boolean isColumnsLabelSupported()
throws com.sas.table.TableException
isColumnsLabelSupported in interface StaticColumnLabelInterfacetrue if a column labels label is supported,
and false otherwise.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).StaticColumnLabelInterface.getColumnLabel(int)
public void setFormattedCell(int rowIndex,
int columnIndex,
java.lang.String value)
throws com.sas.table.TableException
setFormattedCell in interface FormattedDataInterfacerowIndex - A one-based index that identifies the cell's row.columnIndex - A one-based index that identifies the cell's column.value - The cell's new formatted value.
com.sas.table.TableException - Thrown if the operation can not be completed (e.g. i/o-failure).FormattedDataInterface.setFormattedCells(int, int, int, int, java.lang.String[][]),
FormattedDataInterface.setFormattedColumn(int, java.lang.String[]),
FormattedDataInterface.setFormattedRow(int, java.lang.String[])
public void setFormattedCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount,
java.lang.String[][] values)
throws com.sas.table.TableException
startRowIndex and rowCount define the start and extent of the
row range while startColumnIndex and columnCount define the column range.
The set of formatted values is specified as a two-dimensional array, new Object[rowCount][colCount],
with values[0][0] containing the value of the cell at (startRowIndex, startColumnIndex).
setFormattedCells in interface FormattedDataInterfacestartRowIndex - A one-based index that identifies the start of the row range.startColumnIndex - A one-based index that identifies the start of the column range.rowCount - The number of rows in the row range.columnCount - The number of columns in the column range.values - - The new formatted values for each cell in the block.
com.sas.table.TableException - Thrown if the operation can not be completed (e.g. i/o-failure).FormattedDataInterface.setFormattedCell(int, int, java.lang.String)
public void setFormattedColumn(int index,
java.lang.String[] values)
throws com.sas.table.TableException
autoCommit is true, this method updates the rows for the column
at index using the values in the String array.
If autoCommit is false, the updates will be lost. If commitRow
is called, only the value for the last row will be committed to the data source.
The set of formatted values is specified as an array with each element of the
array corresponding to a cell in the column.
setFormattedColumn in interface FormattedDataInterfaceindex - A one-based index that identifies the column.values - The new formatted values for each cell in the column.
com.sas.table.TableException - Thrown if the operation cannot be completed (e.g. i/o-failure).FormattedDataInterface.setFormattedCell(int, int, java.lang.String)
public void setFormattedRow(int index,
java.lang.String[] values)
throws com.sas.table.TableException
autoCommit is true, this method updates the rows for the column
at index using the values in the String array.
If autoCommit is false, the updates will be lost unless
commitRow is called.
The row is identified by the given index. The set of formatted values is specified as an array with each element of the array corresponding to a cell in the row.
setFormattedRow in interface FormattedDataInterfaceindex - A one-based index that identifies the row.values - The new formatted values for each cell in the row.
com.sas.table.TableException - Thrown if the operation cannot be completed (e.g. i/o-failure).FormattedDataInterface.setFormattedCell(int, int, java.lang.String)
public java.lang.String[] getColumnInfoNames()
throws com.sas.table.TableException
getColumnInfoNames in interface com.sas.table.StaticColumnInfoInterfacegetColumnInfoNames in class JDBCAdaptercom.sas.table.TableExceptionStaticColumnInfoInterface
public java.lang.Object getColumnInfo(int index,
java.lang.String columnInfoName)
throws com.sas.table.TableException
getColumnInfo in interface com.sas.table.StaticColumnInfoInterfacegetColumnInfo in class JDBCAdapterindex - A one-based index that identifies the column.columnInfoName - - The name of the information to return for the column.
com.sas.table.TableException - Provides a catch-all for all non-RuntimeExceptions.JDBCAdapter.getColumnInfoNames(),
StaticColumnInfoInterface
public java.lang.Class getColumnClass(int index)
throws com.sas.table.TableException
getColumnClass in interface StaticRowTemplateTableInterfaceindex - - A one-based index that identifies the column.
com.sas.table.TableException - Thrown if ResultSetMetaData throws a SQLException.
public java.lang.Class[] getColumnClasses(int col,
int columnCount)
throws com.sas.table.TableException
getColumnClasses in interface StaticRowTemplateTableInterfacestartIndex - A one-based index which identifies the start of the range.count - The number of classes to return; defines the extent of the range.
com.sas.table.TableException - Provides a catch-all for all non-RuntimeExceptions.public boolean isCellsModifiable()
isCellsModifiable in interface TableInterfacepublic boolean isMultipleRowUpdateSupported()
isMultipleRowUpdateSupported in interface TableInterfacetrue if multiple rows can be simultaneously updated,
and false otherwise.public boolean isMultipleColumnUpdateSupported()
isMultipleColumnUpdateSupported in interface TableInterfacetrue if multiple columns can be simultaneously updated,
and false otherwise.
public void setCell(int rowIndex,
int columnIndex,
java.lang.Object value)
throws com.sas.table.TableException
value into the cell at rowIndex, columnIndex.
If autoCommit is true, it also updates the row in the result set.
If autoCommit is false, use commitRow to update the row.
setCell in interface TableInterfacerowIndex - A one-based index that identifies the cell's row.columnIndex - A one-based index that identifies the cell's column.value - The cell's new value.
com.sas.table.TableException - Thrown if the operation cannot be completed (e.g. read-only).TableInterface.setCells(int, int, int, int, java.lang.Object[][]),
TableInterface.setColumn(int, java.lang.Object[]),
TableInterface.setRow(int, java.lang.Object[])
public void setCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount,
java.lang.Object[][] values)
throws com.sas.table.TableException
startRowIndex and rowCount
define the start and extent of the row range while startColumnIndex and
columnCount define the column range. The set of values is specified as a two-dimensional
array, new Object[rowCount][colCount], with values[0][0] containing the
value of the cell at (startRowIndex, startColumnIndex).
Usually, the implementation will require that the class of each new value match what's returned by
getCellClassfor the corresponding cell.
Because the range of cells may span multiple rows, autoCommit is ignored.
Even if autoCommit is false, all rows will be updated.
setCells in interface TableInterfacestartRowIndex - A one-based index that identifies the start of the row range.startColumnIndex - - A one-based index that identifies the start of the column range.rowCount - - The number of rows in the row range.columnCount - - The number of columns in the column range.values - - The new values for each cell in the block.
com.sas.table.TableException - Thrown if the operation cannot be completed (e.g. read-only).TableInterface.setCell(int, int, java.lang.Object)
public void setColumn(int columnIndex,
java.lang.Object[] values)
throws com.sas.table.TableException
getColumnClass.
Because a column may span multiple rows, autoCommit is ignored.
Even if autoCommit is false, all rows will be updated.
setColumn in interface TableInterfacecolumnIndex - A one-based index that identifies the column.values - The new values for each cell in the column.
com.sas.table.TableException - Thrown if any JDBC methods throw a SQLException
or if isReadOnly returns true.TableInterface.setCell(int, int, java.lang.Object)
public void setRow(int rowIndex,
java.lang.Object[] values)
throws com.sas.table.TableException
getColumnClass.
If autoCommit is true, the updateRow method is called
on the result set to commit changes to the data source.
Otherwise, it will be necessary to call commitRow.
setRow in interface TableInterfacerowIndex - A one-based index that identifies the row.values - The new values for each cell in the row.
com.sas.table.TableException - Thrown if any JDBC methods throw a SQLException
or if isReadOnly returns true.TableInterface.setCell(int, int, java.lang.Object)
public int countColumns(int maxCount)
throws com.sas.table.TableException
getColumnCount
is returned.
countColumns in interface StaticTableInterfacemaxCount - Maximum number of columns to read, or 0 to read indefinitely.
Implementations where the number of columns is always known should
ignore this parameter. In cases where the total number of columns
is unknown, but the number known so far is greater than maxCount
should return the larger known number. Thus maxCount is only
used as a limiting factor when the implementation has to actually do
computation (e.g. fetch observations).
com.sas.table.TableException - Thrown if any SQLExceptions are thrown.StaticTableInterface.getColumnCount(),
StaticTableInterfaceSupport.countColumns(com.sas.table.StaticTableInterface, int)
public int countRows(int maxCount)
throws com.sas.table.TableException
TYPE_FORWARD_ONLY) and resultSetRequeryUsed is true.
Otherwise, the result of getRowCount() is returned.
The maxCount parameter is ignored.
countRows in interface StaticTableInterfacemaxCount - Any integer.
com.sas.table.TableException - Thrown if any SQLExceptions are thrown.StaticTableInterface.getRowCount(),
StaticTableInterfaceSupport.countRows(com.sas.table.StaticTableInterface, int)
public java.lang.Object getCell(int row,
int col)
throws com.sas.table.TableException
getCell in interface StaticTableInterfacerow - A one-based index that identifies the cell's row.col - A one-based index that identifies the cell's column.
com.sas.table.TableException - Thrown if any SQLExceptions are thrown.StaticTableInterface.getCells(int, int, int, int),
StaticTableInterface.getColumn(int),
StaticTableInterface.getRow(int)
public java.lang.Object[][] getCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount)
throws com.sas.table.TableException
startRowIndex and rowCount define the start and extent
of the row range while startColumnIndex and columnCount define the
column range. The set of values is returned as a two-dimensional array,
new Object[rowCount][colCount], with values[0][0] containing the value
of the cell at (startRowIndex, startColumnIndex).
getCells in interface StaticTableInterfacestartRowIndex - A one-based index that identifies the start of the row range.startColumnIndex - A one-based index that identifies the start of the column range.rowCount - The number of rows in the row range.columnCount - The number of columns in the column range.
com.sas.table.TableException - Thrown if any SQLExceptions are thrown.StaticTableInterface.getCell(int, int),
StaticTableInterfaceSupport.getCells(com.sas.table.StaticTableInterface, int, int, int, int)
public java.lang.Class getCellClass(int row,
int col)
throws com.sas.table.TableException
col. The value for row is ignored.
getCellClass in interface StaticTableInterfacerow - Any integer.col - A one-based index that identifies the cell's column.
com.sas.table.TableException - Thrown if any SQLExceptions thrown.StaticTableInterface.getCellClasses(int, int, int, int)
public java.lang.Class[][] getCellClasses(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount)
throws com.sas.table.TableException
startRowIndex and rowCount define the start and extent of the row range while
startColumnIndex and columnCount define the column range.
The set of classes is returned as a two-dimensional array,
new Class[rowCount][colCount], with clases[0][0] containing the class of the cell
at (startRowIndex, startColumnIndex). The classes will be identical in all rows
of a column.
getCellClasses in interface StaticTableInterfacestartRowIndex - A one-based index that identifies the start of the row range.startColumnIndex - A one-based index that identifies the start of the column range.rowCount - The number of rows in the row range.columnCount - The number of columns in the column range.
com.sas.table.TableException - Thrown if any SQLExceptions thrown.StaticTableInterface.getCellClass(int, int),
StaticTableInterfaceSupport.getCellClasses(com.sas.table.StaticTableInterface, int, int, int, int)
public java.lang.Object[] getColumn(int index)
throws com.sas.table.TableException
getColumn in interface StaticTableInterfaceindex - - A one-based index that identifies the column.
com.sas.table.TableException - Thrown if any SQLExceptions thrown.StaticTableInterface.getCell(int, int),
StaticTableInterfaceSupport.getColumn(com.sas.table.StaticTableInterface, int)
public int getColumnCount()
throws com.sas.table.TableException
getColumnCount in interface StaticTableInterfacecom.sas.table.TableException - Thrown if any SQLExceptions are thrown.StaticTableInterface.countColumns(int)
public java.lang.Object[] getRow(int row)
throws com.sas.table.TableException
getRow in interface StaticTableInterfacerow - A one-based index that identifies the row.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).StaticTableInterface.getCell(int, int),
StaticTableInterfaceSupport.getRow(com.sas.table.StaticTableInterface, int)
public int getRowCount()
throws com.sas.table.TableException
ResultSet.TYPE_FORWARD_ONLY, this method returns -1.
getRowCount in interface StaticTableInterfacecom.sas.table.TableException - Thrown if any SQLExceptions are thrown.StaticTableInterface.countRows(int)
public java.lang.String getFormattedCell(int rowIndex,
int colIndex)
throws com.sas.table.TableException
StaticFormattedDataInterface
getFormattedCell in interface StaticFormattedDataInterfacerowIndex - A one-based index that identifies the cell's row.colIndex - A one-based index that identifies the cell's column.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).StaticFormattedDataInterface.getFormattedCell(int, int)
public java.lang.String[][] getFormattedCells(int startRow,
int startColumn,
int rowCount,
int columnCount)
throws com.sas.table.TableException
StaticFormattedDataInterfacenew Object[rowCount][colCount], with
values[0][0] containing the formatted value of the cell at
(startRowIndex, startColumnIndex).
getFormattedCells in interface StaticFormattedDataInterfacestartRow - A one-based index that identifies the start of the row range.startColumn - A one-based index that identifies the start of the column range.rowCount - The number of rows in the row range.columnCount - The number of columns in the column range.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).StaticFormattedDataInterface.getFormattedCells(int, int, int, int)
public java.lang.String[] getFormattedColumn(int col)
throws com.sas.table.TableException
StaticFormattedDataInterface
getFormattedColumn in interface StaticFormattedDataInterfacecol - A one-based index that identifies the column.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).StaticFormattedDataInterface.getFormattedColumn(int)
public java.lang.String[] getFormattedRow(int row)
throws com.sas.table.TableException
StaticFormattedDataInterface
getFormattedRow in interface StaticFormattedDataInterfacerow - A one-based index that identifies the row.
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).StaticFormattedDataInterface.getFormattedRow(int)
protected void updateCell(int col,
java.lang.Object value)
throws com.sas.table.TableException
setFormattedCell(), etc. It must be possible
to convert the Object into the correct type required by the updateXXX method.
the - one-based column numberthe - value to be updated into the cell
com.sas.table.TableException - if a JDBC method throws a SQLException.
java.lang.NumberFormatException - if numeric conversion failspublic static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
addContentsChangedListener in interface com.sas.collection.ContentsChangedSourceContentsChangedSource.addContentsChangedListener(com.sas.collection.ContentsChangedListener)public void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
removeContentsChangedListener in interface com.sas.collection.ContentsChangedSourceContentsChangedSource.removeContentsChangedListener(com.sas.collection.ContentsChangedListener)public void fireModelEvent(java.util.EventObject event)
fireModelEvent in class JDBCAdapterevent - Event that must be cast that should be firedprotected void fireContentsChanged(com.sas.collection.ContentsChangedEvent event)
the - event to sendaddContentsChangedListener(com.sas.collection.ContentsChangedListener),
removeContentsChangedListener(com.sas.collection.ContentsChangedListener)
public void fireCellEvent(int row,
int column)
fireCellEvent in class JDBCAdapterrow - row number of the cell that has been modifiedcolumn - column number of the cell that has been modifiedpublic void fireModelEvent()
fireModelEvent in class JDBCAdapterprotected void fireContentsChanged()
fireContentsChanged(com.sas.collection.ContentsChangedEvent)
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||