public class DataTable extends java.lang.Object implements DataTableEventListener
| Constructor and Description |
|---|
DataTable()
Initializes a new instance of the
DataTable class with no arguments. |
DataTable(java.sql.ResultSet resultSet)
Creates an object by wrapping the specified ResultSet.
|
DataTable(java.sql.ResultSet resultSet,
java.lang.String tableName)
Creates an object by wrapping the specified ResultSet.
|
DataTable(java.lang.String tableName)
Initializes a new instance of the
DataTable class with the specified table name. |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptChanges()
Commits all the changes made to this table since the last time
acceptChanges() was called. |
void |
addEventListener(DataTableEventListener listener) |
void |
clearEventListneers() |
void |
close() |
boolean |
containsColumn(java.lang.String columnName)
Deprecated.
Please use
getColumns().contains(String) method. |
DataRelationCollection |
getChildRelations()
Gets the collection of child relations for this
DataTable. |
java.lang.String |
getColumnName(int index)
Analog for .Net DataTable.Columns[i].ColumnName
|
DataColumnCollection |
getColumns()
Gets the collection of columns that belong to this table.
|
int |
getColumnsCount() |
ConstraintCollection |
getConstraints()
Gets the collection of constraints maintained by this table.
|
DataSet |
getDataSet()
Gets the
DataSet to which this table belongs. |
boolean |
getEnforceConstraints() |
java.lang.String |
getNamespace()
Gets the namespace for the XML representation of the data stored in the
DataTable. |
DataRelationCollection |
getParentRelations()
Gets the collection of parent relations for this
DataTable. |
DataColumn[] |
getPrimaryKey()
Gets an array of columns that function as primary keys for the data table.
|
java.sql.ResultSet |
getResultSet()
Returns the underlying Java ResultSet object.
|
DataRowCollection |
getRows()
Gets the collection of rows that belong to this table.
|
java.lang.String |
getTableName()
Gets the name of the
DataTable. |
DataRow |
newRow()
Creates a new
DataRow with the same schema as the table. |
void |
onDataColumnDeleted(DataColumn column)
Update listener when DataColumn Deleted
|
void |
onDataColumnInserted(DataColumn column)
Update listener when DataColumn Inserted
|
void |
onDataRowChanged(DataRow row)
Update listener when DataRow Changed
|
void |
onDataRowDeleted(DataRow row)
Update listener when DataRow Deleted
|
void |
onDataRowInserted(DataRow row)
Update listener when DataRow Inserted
|
void |
refresh()
Reloads all the data from ResultSet if it is present.
|
void |
setEnforceConstraints(boolean enforceConstraints) |
void |
setNamespace(java.lang.String value)
Sets the namespace for the XML representation of the data stored in the
DataTable. |
void |
setPrimaryKey(DataColumn[] value)
Sets an array of columns that function as primary keys for the data table.
|
void |
setTableName(java.lang.String value)
Sets the name of the
DataTable. |
public DataTable()
DataTable class with no arguments.public DataTable(java.lang.String tableName)
DataTable class with the specified table name.tableName - The name to give the table. If tableName is null or an empty string, a default name is given when added to the DataTableCollection.public DataTable(java.sql.ResultSet resultSet)
throws java.sql.SQLException
resultSet - data setSQLException - if a database access error occurs or this method ispublic DataTable(java.sql.ResultSet resultSet,
java.lang.String tableName)
throws java.sql.SQLException
resultSet - data settableName - name of the tableSQLException - if a database access error occurs or this method ispublic void close()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getTableName()
DataTable.DataTable.public void setTableName(java.lang.String value)
DataTable.value - The name of the DataTable.public boolean containsColumn(java.lang.String columnName)
getColumns().contains(String) method.columnName - name of the columntrue is column can be found by the given columnNamepublic int getColumnsCount()
public java.lang.String getColumnName(int index)
index - - column's indexpublic java.sql.ResultSet getResultSet()
ResultSetpublic DataSet getDataSet()
DataSet to which this table belongs.DataSet to which this table belongs.public DataRelationCollection getChildRelations()
DataTable.DataRelationCollection that contains the child relations for the table. An empty collection is returned if no DataRelation objects exist.public DataRelationCollection getParentRelations()
DataTable.DataRelationCollection that contains the parent relations for the table. An empty collection is returned if no DataRelation objects exist.public DataRowCollection getRows()
DataRowCollection that contains DataRow objects; otherwise a null value if no DataRow objects exist.public DataColumnCollection getColumns()
DataColumnCollection that contains the collection of DataColumn objects for the table. An empty collection is returned if no DataColumn objects exist.public ConstraintCollection getConstraints()
ConstraintCollection that contains the collection of Constraint objects for the table. An empty collection is returned if no Constraint objects exist.public DataColumn[] getPrimaryKey()
DataColumn objects.public void setPrimaryKey(DataColumn[] value) throws DataException, InvalidConstraintException
value - An array of DataColumn objects.DataExceptionInvalidConstraintExceptionpublic java.lang.String getNamespace()
DataTable.DataTable.public void setNamespace(java.lang.String value)
DataTable.value - The namespace of the DataTable.public boolean getEnforceConstraints()
public void setEnforceConstraints(boolean enforceConstraints)
enforceConstraints - is the flag which indicates whether check constraint violation or notpublic void refresh()
public void acceptChanges()
throws java.sql.SQLException
acceptChanges() was called.java.sql.SQLExceptionpublic void addEventListener(DataTableEventListener listener)
public void clearEventListneers()
public void onDataRowChanged(DataRow row)
DataTableEventListeneronDataRowChanged in interface DataTableEventListenerpublic void onDataRowInserted(DataRow row)
DataTableEventListeneronDataRowInserted in interface DataTableEventListenerpublic void onDataRowDeleted(DataRow row)
DataTableEventListeneronDataRowDeleted in interface DataTableEventListenerpublic void onDataColumnInserted(DataColumn column)
DataTableEventListeneronDataColumnInserted in interface DataTableEventListenerpublic void onDataColumnDeleted(DataColumn column)
DataTableEventListeneronDataColumnDeleted in interface DataTableEventListener