public class DataSet
extends java.lang.Object
| Constructor and Description |
|---|
DataSet()
Initializes a new instance of the
DataSet class. |
DataSet(java.sql.Connection connection)
Initializes a new instance of the DataSet class with data taken from Connection.
|
DataSet(java.sql.Connection connection,
java.lang.String schemaName)
Initializes a new instance of the DataSet class with data taken from Connection.
|
DataSet(java.lang.String dataSetName)
Initializes a new instance of a
DataSet class with the given name. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the
DataSet of any data by removing all rows in all tables. |
void |
close() |
java.lang.String |
getDataSetName()
Gets the name of the current
DataSet. |
boolean |
getEnforceConstraints()
Gets a value indicating whether constraint rules are followed when attempting any update operation.
|
java.lang.String |
getNamespace()
Gets the namespace of the
DataSet. |
DataRelationCollection |
getRelations()
Get the collection of relations that link tables and allow navigation from parent tables to child tables.
|
DataTableCollection |
getTables()
Gets the collection of tables contained in the
DataSet. |
boolean |
isLocaleSpecified() |
boolean |
IsSchemaWasRead() |
XmlReadMode |
readXml(java.io.InputStream stream)
Reads XML schema and data into the
DataSet using the specified InputStream. |
XmlReadMode |
readXml(java.io.InputStream xmlStream,
XmlReadMode mode)
Reads XML schema and data into the DataSet using the specified
InputStream and XmlReadMode. |
XmlReadMode |
readXml(java.lang.String fileName)
Reads XML schema and data into the
DataSet using the specified file. |
XmlReadMode |
readXml(java.lang.String xmlPath,
XmlReadMode readMode)
Reads XML schema and data into the DataSet using the specified file and
XmlReadMode. |
void |
readXmlSchema(java.io.InputStream stream)
Reads the XML schema from the specified
InputStream into the DataSet. |
void |
readXmlSchema(java.lang.String fileName)
Reads the XML schema from the specified file into the
DataSet. |
void |
reset()
Resets the
DataSet to its original state. |
void |
setDataSetName(java.lang.String value)
Sets the name of the current
DataSet. |
void |
setEnforceConstraints(boolean value)
Sets a value indicating whether constraint rules are followed when attempting any update operation.
|
void |
setLocale(java.util.Locale locale)
Sets the locale information used to compare strings within the table.
|
public DataSet()
DataSet class.public DataSet(java.sql.Connection connection)
throws java.lang.Exception
By default no schema name will be used.
connection - which contains DB data.java.lang.Exception - if any errors occur while copying data from Connection.public DataSet(java.sql.Connection connection,
java.lang.String schemaName)
throws java.lang.Exception
DataSet dataSet = new DataSet(conn, "PUBLIC"); // HSQLDB
or
DataSet dataSet = new DataSet(conn); // MYSQL's default schema name.
connection - which contains DB data.schemaName - which contains the tables to be imported.java.lang.Exception - if any errors occur while copying data from Connection.public java.lang.String getDataSetName()
DataSet.DataSet.public void setDataSetName(java.lang.String value)
DataSet.value - The name of the DataSet.public java.lang.String getNamespace()
DataSet.DataSet.public DataTableCollection getTables()
DataSet.DataTableCollection contained by this DataSet. An empty collection is returned if no DataTable objects exist.public DataRelationCollection getRelations()
DataRelationCollection that contains a collection of DataRelation objects. An empty collection is returned if no DataRelation objects exist.public void close()
throws java.lang.Exception
java.lang.Exceptionpublic void clear()
DataSet of any data by removing all rows in all tables.public void reset()
public XmlReadMode readXml(java.io.InputStream xmlStream, XmlReadMode mode) throws DataException
InputStream and XmlReadMode.xmlStream - The Stream from which to read.mode - One of the XmlReadMode values.DataException - if any errors occur while reading or adding data into tablepublic XmlReadMode readXml(java.io.InputStream stream) throws DataException
DataSet using the specified InputStream.stream - An object that derives from InputStream.XmlReadMode used to read the data. The returned value is one of XmlReadMode constants.DataExceptionpublic XmlReadMode readXml(java.lang.String fileName) throws DataException
DataSet using the specified file.fileName - The filename (including the path) from which to read.XmlReadMode constants.DataExceptionpublic XmlReadMode readXml(java.lang.String xmlPath, XmlReadMode readMode) throws DataException
XmlReadMode.xmlPath - the specified filereadMode - XmlReadModeDataException - if any errors occur while reading or adding data into tablepublic void readXmlSchema(java.io.InputStream stream)
throws DataException
InputStream into the DataSet.stream - The InputStream from which to read.DataExceptionpublic void readXmlSchema(java.lang.String fileName)
throws DataException
DataSet.fileName - The file name (including the path) from which to read.DataExceptionpublic void setLocale(java.util.Locale locale)
locale - of this data setpublic boolean isLocaleSpecified()
public boolean getEnforceConstraints()
public void setEnforceConstraints(boolean value)
value - true if rules are enforced; otherwise false. The default is true.public boolean IsSchemaWasRead()