diff options
author | Daniel Morgan <monodanmorg@yahoo.com> | 2002-04-28 07:59:01 +0400 |
---|---|---|
committer | Daniel Morgan <monodanmorg@yahoo.com> | 2002-04-28 07:59:01 +0400 |
commit | 2744f2972e4c4f4bda65c02b1b50ddc0862d2fdb (patch) | |
tree | cb5fe728e696367b61ab7001de7893c888400e09 /mcs/class | |
parent | c853e1750ff6cf103c40d48c216fe71148a2887f (diff) |
2002-04-28 Daniel Morgan <danmorg@sc.rr.com>
* System.Data/DataRelation.cs
* System.Data/ForeignKeyConstraint.cs
* System.Data/UniqueConstraint.cs: added more stubs
* System.Data/DataTableRelationCollection.cs: added back to cvs
and modified for compile errors. DataRelationCollection is an
abstract class and there must be a class that implements for
DataTable/DataSet. DataTableRelationCollection was changed
to an internal class.
* System.Data.build: modified - new files added
also wanted to include files/classes in the build
so we can get a compilable forward read only result set.
It compiles now using csc/nant with warnings, but this
is a start for adding functionality for the result set.
Classes associated with/and DataSet are still excluded.
* TODO: modified - updated to do list for System.Data
* System.Data/Constraint.cs
* System.Data/ConstraintCollection.cs
* System.Data/DataRelationCollection.cs
* System.Data/DataRow.cs
* System.Data/DataRowChangeEventArgs.cs
* System.Data/DataRowCollection.cs
* System.Data/DataTable.cs
* System.Data/DataTableCollection.cs
* System.Data/InternalDataCollectionBase.cs
* System.Data/PropertyCollection.cs: modified -
changes to compile SqlDataReader/DataTable and
dependencies
* System.Data/IDbCommand.cs
* System.Data.SqlClient/SqlCommand.cs: modified -
un-commented overloaded methods ExecuteReader
which returns a SqlDataReader
svn path=/trunk/mcs/; revision=4098
Diffstat (limited to 'mcs/class')
25 files changed, 1100 insertions, 181 deletions
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs index 02151854f49..51fdc2d93e4 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs @@ -163,14 +163,10 @@ namespace System.Data.SqlClient return rowsAffected; } - // FIXME: temporarily commmented out, so I could get a simple working - // SqlConnection and SqlCommand. I had to temporarily - // comment it out the ExecuteReader in IDbCommand as well. - /* [MonoTODO] IDataReader IDbCommand.ExecuteReader () { - throw new NotImplementedException (); + return ExecuteReader (); } [MonoTODO] @@ -183,7 +179,7 @@ namespace System.Data.SqlClient IDataReader IDbCommand.ExecuteReader ( CommandBehavior behavior) { - throw new NotImplementedException (); + return ExecuteReader (behavior); } [MonoTODO] @@ -191,7 +187,6 @@ namespace System.Data.SqlClient { throw new NotImplementedException (); } - */ [MonoTODO] public object ExecuteScalar () diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs index ca2409cd39b..5e3fb572db6 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs @@ -211,7 +211,6 @@ namespace System.Data.SqlClient #endregion // Destructors - #region Properties public int Depth { diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs index 02151854f49..51fdc2d93e4 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs @@ -163,14 +163,10 @@ namespace System.Data.SqlClient return rowsAffected; } - // FIXME: temporarily commmented out, so I could get a simple working - // SqlConnection and SqlCommand. I had to temporarily - // comment it out the ExecuteReader in IDbCommand as well. - /* [MonoTODO] IDataReader IDbCommand.ExecuteReader () { - throw new NotImplementedException (); + return ExecuteReader (); } [MonoTODO] @@ -183,7 +179,7 @@ namespace System.Data.SqlClient IDataReader IDbCommand.ExecuteReader ( CommandBehavior behavior) { - throw new NotImplementedException (); + return ExecuteReader (behavior); } [MonoTODO] @@ -191,7 +187,6 @@ namespace System.Data.SqlClient { throw new NotImplementedException (); } - */ [MonoTODO] public object ExecuteScalar () diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs index ca2409cd39b..5e3fb572db6 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs @@ -211,7 +211,6 @@ namespace System.Data.SqlClient #endregion // Destructors - #region Properties public int Depth { diff --git a/mcs/class/System.Data/ChangeLog b/mcs/class/System.Data/ChangeLog index 59dc5342a03..3d9f79b9667 100644 --- a/mcs/class/System.Data/ChangeLog +++ b/mcs/class/System.Data/ChangeLog @@ -1,3 +1,42 @@ +2002-04-28 Daniel Morgan <danmorg@sc.rr.com> + + * System.Data/DataRelation.cs + * System.Data/ForeignKeyConstraint.cs + * System.Data/UniqueConstraint.cs: added more stubs + + * System.Data/DataTableRelationCollection.cs: added back to cvs + and modified for compile errors. DataRelationCollection is an + abstract class and there must be a class that implements for + DataTable/DataSet. DataTableRelationCollection was changed + to an internal class. + + * System.Data.build: modified - new files added + also wanted to include files/classes in the build + so we can get a compilable forward read only result set. + It compiles now using csc/nant with warnings, but this + is a start for adding functionality for the result set. + Classes associated with/and DataSet are still excluded. + + * TODO: modified - updated to do list for System.Data + + * System.Data/Constraint.cs + * System.Data/ConstraintCollection.cs + * System.Data/DataRelationCollection.cs + * System.Data/DataRow.cs + * System.Data/DataRowChangeEventArgs.cs + * System.Data/DataRowCollection.cs + * System.Data/DataTable.cs + * System.Data/DataTableCollection.cs + * System.Data/InternalDataCollectionBase.cs + * System.Data/PropertyCollection.cs: modified - + changes to compile SqlDataReader/DataTable and + dependencies + + * System.Data/IDbCommand.cs + * System.Data.SqlClient/SqlCommand.cs: modified - + un-commented overloaded methods ExecuteReader + which returns a SqlDataReader + 2002-04-28 Rodrigo Moya <rodrigo@ximian.com> * System.Data/DataTableCollection.cs: more implementation. diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index 02151854f49..51fdc2d93e4 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -163,14 +163,10 @@ namespace System.Data.SqlClient return rowsAffected; } - // FIXME: temporarily commmented out, so I could get a simple working - // SqlConnection and SqlCommand. I had to temporarily - // comment it out the ExecuteReader in IDbCommand as well. - /* [MonoTODO] IDataReader IDbCommand.ExecuteReader () { - throw new NotImplementedException (); + return ExecuteReader (); } [MonoTODO] @@ -183,7 +179,7 @@ namespace System.Data.SqlClient IDataReader IDbCommand.ExecuteReader ( CommandBehavior behavior) { - throw new NotImplementedException (); + return ExecuteReader (behavior); } [MonoTODO] @@ -191,7 +187,6 @@ namespace System.Data.SqlClient { throw new NotImplementedException (); } - */ [MonoTODO] public object ExecuteScalar () diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs index ca2409cd39b..5e3fb572db6 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs @@ -211,7 +211,6 @@ namespace System.Data.SqlClient #endregion // Destructors - #region Properties public int Depth { diff --git a/mcs/class/System.Data/System.Data.build b/mcs/class/System.Data/System.Data.build index 091dc7ce643..f94f161baad 100644 --- a/mcs/class/System.Data/System.Data.build +++ b/mcs/class/System.Data/System.Data.build @@ -11,6 +11,7 @@ <arg value="/unsafe"/>
<sources>
<includes name="**/*.cs"/>
+ <!--
<excludes name="System.Data/Constraint.cs"/>
<excludes name="System.Data/ConstraintCollection.cs"/>
<excludes name="System.Data/InternalDataCollectionBase.cs"/>
@@ -19,16 +20,17 @@ <excludes name="System.Data/DataRow.cs"/>
<excludes name="System.Data/DataRowCollection.cs"/>
<excludes name="System.Data/DataRowChangeEventArgs.cs"/>
- <excludes name="System.Data/DataTableCollection.cs"/>
<excludes name="System.Data/DataRelationCollection.cs"/>
<excludes name="System.Data/DataTable.cs"/>
+ <excludes name="System.Data/PropertyCollection.cs"/>
+ -->
+ <excludes name="System.Data/DataTableRelationCollection.cs"/>
<excludes name="System.Data/DataView.cs"/>
<excludes name="System.Data/DataSet.cs"/>
- <excludes name="System.Data/PropertyCollection.cs"/>
<excludes name="Test/**"/>
<excludes name="System.Data.Common/*"/>
<excludes name="System.Data.SqlClient/SqlDataAdapter.cs"/>
- <excludes name="System.Data.SqlClient/SqlDataReader.cs"/>
+ <!--<excludes name="System.Data.SqlClient/SqlDataReader.cs"/>-->
<excludes name="System.Data.SqlClient/SqlInfoMessageEventArgs.cs"/>
<excludes name="System.Data.SqlClient/SqlRowUpdatingEventArgs.cs"/>
<excludes name="System.Data.SqlClient/SqlRowUpdatedEventArgs.cs"/>
diff --git a/mcs/class/System.Data/System.Data/AcceptRejectRule.cs b/mcs/class/System.Data/System.Data/AcceptRejectRule.cs index bb98d27cf03..c4481175a6c 100644 --- a/mcs/class/System.Data/System.Data/AcceptRejectRule.cs +++ b/mcs/class/System.Data/System.Data/AcceptRejectRule.cs @@ -11,7 +11,9 @@ namespace System.Data { /// <summary> - /// Determines the action that occurs when the AcceptChanges or RejectChanges method is invoked on a DataTable with a ForeignKeyConstraint. + /// Determines the action that occurs when + /// the AcceptChanges or RejectChanges method + /// is invoked on a DataTable with a ForeignKeyConstraint. /// </summary> [Serializable] public enum AcceptRejectRule @@ -20,4 +22,4 @@ namespace System.Data None = 0 } -}
\ No newline at end of file +} diff --git a/mcs/class/System.Data/System.Data/Constraint.cs b/mcs/class/System.Data/System.Data/Constraint.cs index 80d0a78c5ac..d6ce3b24307 100644 --- a/mcs/class/System.Data/System.Data/Constraint.cs +++ b/mcs/class/System.Data/System.Data/Constraint.cs @@ -11,49 +11,52 @@ using System; using System.Collections; using System.ComponentModel; using System.Runtime.InteropServices; +using System.Runtime.Serialization; namespace System.Data { [Serializable] public abstract class Constraint { + protected string name = null; + protected PropertyCollection properties = null; + [MonoTODO] - [Serializable] protected Constraint() { + properties = new PropertyCollection(); } - [Serializable] public virtual string ConstraintName { - [MonoTODO] + [MonoTODO] get{ + return name; } [MonoTODO] set{ + name = value; } } - [Serializable] public PropertyCollection ExtendedProperties { [MonoTODO] get { + return properties; } } - [Serializable] public abstract DataTable Table { get; } [MonoTODO] - [Serializable] public override string ToString() { + return name; } - [MonoTODO] - [Serializable] - [ClassInterface(ClassInterfaceType.AutoDual)] - ~Constraint() { - } + //[MonoTODO] + //[ClassInterface(ClassInterfaceType.AutoDual)] + //~Constraint() { + //} } } diff --git a/mcs/class/System.Data/System.Data/ConstraintCollection.cs b/mcs/class/System.Data/System.Data/ConstraintCollection.cs index 97eca9c56b6..7e9385e7e6b 100644 --- a/mcs/class/System.Data/System.Data/ConstraintCollection.cs +++ b/mcs/class/System.Data/System.Data/ConstraintCollection.cs @@ -5,6 +5,7 @@ // Daniel Morgan // // (C) Ximian, Inc. 2002 +// (C) 2002 Daniel Morgan // using System; @@ -18,120 +19,123 @@ namespace System.Data /// </summary> public class ConstraintCollection : InternalDataCollectionBase { - [MonoTODO] - [Serializable] public virtual Constraint this[string name] { [MonoTODO] get { + throw new NotImplementedException (); } } - - [MonoTODO] - [Serializable] + public virtual Constraint this[int index] { [MonoTODO] get { + throw new NotImplementedException (); } } // Overloaded Add method (5 of them) // to add Constraint object to the collection - [Serializable] [MonoTODO] public void Add(Constraint constraint) { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public virtual Constraint Add(string name, DataColumn column, bool primaryKey) { + + throw new NotImplementedException (); + } - [Serializable] [MonoTODO] public virtual Constraint Add(string name, DataColumn primaryKeyColumn, DataColumn foreignKeyColumn) { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public virtual Constraint Add(string name, DataColumn[] columns, bool primaryKey) { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public virtual Constraint Add(string name, DataColumn[] primaryKeyColumns, DataColumn[] foreignKeyColumns) { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public void AddRange(Constraint[] constraints) { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public bool CanRemove(Constraint constraint) { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public void Clear() { + + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public bool Contains(string name) { + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public int IndexOf(Constraint constraint) { + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public virtual int IndexOf(string constraintName) { + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public void Remove(Constraint constraint) { + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public void Remove(string name) { + throw new NotImplementedException (); } - [Serializable] [MonoTODO] public void RemoveAt(int index) { + throw new NotImplementedException (); } - /* - * FIXME: fix this event - [Serializable] [MonoTODO] public event CollectionChangeEventHandler CollectionChanged; - */ - [Serializable] protected override ArrayList List { [MonoTODO] get{ + throw new NotImplementedException (); } } - [Serializable] [MonoTODO] protected virtual void OnCollectionChanged( CollectionChangeEventArgs ccevent) { - } + throw new NotImplementedException (); + } } } diff --git a/mcs/class/System.Data/System.Data/DataRelation.cs b/mcs/class/System.Data/System.Data/DataRelation.cs new file mode 100644 index 00000000000..bbc1f2eae5a --- /dev/null +++ b/mcs/class/System.Data/System.Data/DataRelation.cs @@ -0,0 +1,165 @@ +// +// System.Data.DataRelation.cs +// +// Author: +// Daniel Morgan <danmorg@sc.rr.com> +// +// (C) 2002 Daniel Morgan +// (C) 2002 Ximian, Inc. +// + +using System; +using System.Runtime.Serialization; + +namespace System.Data +{ + /// <summary> + /// DataRelation is used for a parent/child relationship + /// between two DataTable objects + /// </summary> + [Serializable] + public class DataRelation { + + #region Constructors + + [MonoTODO] + public DataRelation(string relationName, + DataColumn parentColumn, DataColumn childColumn) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public DataRelation(string relationName, + DataColumn[] parentColumns, + DataColumn[] childColumns) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public DataRelation(string relationName, + DataColumn parentColumn, DataColumn childColumn, + bool createConstraints) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public DataRelation(string relationName, + DataColumn[] parentColumns, DataColumn[] childColumns, + bool createConstraints) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public DataRelation(string relationName, + string parentTableName, string childTableName, + string[] parentColumnNames, string[] childColumnNames, + bool nested) { + + throw new NotImplementedException (); + } + + #endregion // Constructors + + #region Properties + + public virtual DataColumn[] ChildColumns { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual ForeignKeyConstraint ChildKeyConstraint { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual DataTable ChildTable { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual DataSet DataSet { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public PropertyCollection ExtendedProperties { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual bool Nested { + [MonoTODO] + get { + throw new NotImplementedException (); + } + + [MonoTODO] + set { + throw new NotImplementedException (); + } + } + + public virtual DataColumn[] ParentColumns { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual UniqueConstraint ParentKeyConstraint { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual DataTable ParentTable { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual string RelationName { + [MonoTODO] + get { + throw new NotImplementedException (); + } + + [MonoTODO] + set { + throw new NotImplementedException (); + } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override string ToString() { + throw new NotImplementedException (); + } + + [MonoTODO] + protected void CheckStateForProperty() { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data/DataRelationCollection.cs b/mcs/class/System.Data/System.Data/DataRelationCollection.cs index aeff4beb1b5..fddb0d55022 100644 --- a/mcs/class/System.Data/System.Data/DataRelationCollection.cs +++ b/mcs/class/System.Data/System.Data/DataRelationCollection.cs @@ -3,8 +3,10 @@ // // Author: // Christopher Podurgiel (cpodurgiel@msn.com) +// Daniel Morgan <danmorg@sc.rr.com> // // (C) Chris Podurgiel +// (C) 2002 Daniel Morgan // using System; @@ -21,6 +23,7 @@ namespace System.Data { private bool inTransition; private int defaultNameIndex; + private ArrayList relations = null; /// <summary> /// Initializes a new instance of the DataRelationCollection class. @@ -29,6 +32,7 @@ namespace System.Data { defaultNameIndex = 1; inTransition = false; + relations = new ArrayList(); } /// <summary> @@ -47,6 +51,7 @@ namespace System.Data /// Adds a DataRelation to the DataRelationCollection. /// </summary> /// <param name="relation">The DataRelation to add to the collection.</param> + [MonoTODO] public void Add(DataRelation relation) { if(relation != null) @@ -67,6 +72,7 @@ namespace System.Data /// <param name="parentColumn">parent column of relation.</param> /// <param name="childColumn">child column of relation.</param> /// <returns>The created DataRelation.</returns> + [MonoTODO] public virtual DataRelation Add(DataColumn parentColumn, DataColumn childColumn) { @@ -79,10 +85,13 @@ namespace System.Data throw new ArgumentNullException("childColumn"); } + // FIXME: temporarily commented so we can compile + /* if(parentColumn.Table.DataSet != childColumn.Table.DataSet) { throw new InvalidConstraintException("my ex"); } + */ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumn, childColumn); //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this); @@ -101,6 +110,7 @@ namespace System.Data /// <param name="parentColumns">An array of parent DataColumn objects.</param> /// <param name="childColumns">An array of child DataColumn objects.</param> /// <returns>The created DataRelation.</returns> + [MonoTODO] public virtual DataRelation Add(DataColumn[] parentColumns, DataColumn[] childColumns) { DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumns, childColumns); @@ -120,6 +130,7 @@ namespace System.Data /// <param name="parentColumn">parent column of relation.</param> /// <returns>The created DataRelation.</returns> /// <returns></returns> + [MonoTODO] public virtual DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn) { //If no name was supplied, give it a default name. @@ -141,6 +152,7 @@ namespace System.Data /// <param name="parentColumns">An array of parent DataColumn objects.</param> /// <param name="childColumns">An array of child DataColumn objects.</param> /// <returns>The created DataRelation.</returns> + [MonoTODO] public virtual DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns) { //If no name was supplied, give it a default name. @@ -167,6 +179,7 @@ namespace System.Data /// <param name="childColumn">child column of relation.</param> /// <param name="createConstraints">true to create constraints; otherwise false. (default is true)</param> /// <returns>The created DataRelation.</returns> + [MonoTODO] public virtual DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn, bool createConstraints) { //If no name was supplied, give it a default name. @@ -190,6 +203,7 @@ namespace System.Data /// <param name="childColumns">An array of child DataColumn objects.</param> /// <param name="createConstraints">true to create a constraint; otherwise false.</param> /// <returns>The created DataRelation.</returns> + [MonoTODO] public virtual DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints) { //If no name was supplied, give it a default name. @@ -210,6 +224,7 @@ namespace System.Data /// Performs verification on the table. /// </summary> /// <param name="relation">The relation to check.</param> + [MonoTODO] protected virtual void AddCore(DataRelation relation) { if (relation == null) @@ -233,19 +248,25 @@ namespace System.Data /// Copies the elements of the specified DataRelation array to the end of the collection. /// </summary> /// <param name="relations">The array of DataRelation objects to add to the collection.</param> + [MonoTODO] public virtual void AddRange(DataRelation[] relations) { - //TODO: Implement. + //TODO: Implement DataSet dataSet = GetDataSet(); + throw new NotImplementedException (); + + /* foreach(DataRelation dataRelation in relations) { - + } + */ } + [MonoTODO] public virtual bool CanRemove(DataRelation relation) { //TODO: Implement. @@ -254,8 +275,10 @@ namespace System.Data public virtual void Clear() { + throw new NotImplementedException (); } + [MonoTODO] public virtual bool Contains(string name) { return false; @@ -273,33 +296,43 @@ namespace System.Data return relations.IndexOf(this[relationName]); } + [MonoTODO] protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent) { + throw new NotImplementedException (); } + [MonoTODO] protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent) { + throw new NotImplementedException (); } + [MonoTODO] public void Remove(DataRelation relation) { + throw new NotImplementedException (); } + [MonoTODO] public void Remove(string name) { + throw new NotImplementedException (); } + [MonoTODO] public void RemoveAt(int index) { + throw new NotImplementedException (); } + [MonoTODO] protected virtual void RemoveCore(DataRelation relation) { + throw new NotImplementedException (); } public event CollectionChangeEventHandler CollectionChanged; - - } } diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs index 077c91815d1..6a2814e606b 100644 --- a/mcs/class/System.Data/System.Data/DataRow.cs +++ b/mcs/class/System.Data/System.Data/DataRow.cs @@ -5,9 +5,13 @@ // Rodrigo Moya <rodrigo@ximian.com> // Daniel Morgan <danmorg@sc.rr.com> // -// (C) Ximian, Inc +// (C) Ximian, Inc 2002 +// (C) Daniel Morgan 2002 // +using System; +using System.Collections; + namespace System.Data { /// <summary> @@ -19,6 +23,7 @@ namespace System.Data private ArrayList columns = new ArrayList(); private ArrayList columnNames = new ArrayList(); + private DataTable table = null; #endregion @@ -198,64 +203,76 @@ namespace System.Data #region Properties - [MonoTODO] public bool HasErrors { + [MonoTODO] get { throw new NotImplementedException (); } } - [MonoTODO] public object this[string s] { + [MonoTODO] get { throw new NotImplementedException (); } + + [MonoTODO] set { throw new NotImplementedException (); } } - [MonoTODO] public object this[DataColumn dc] { + [MonoTODO] get { throw new NotImplementedException (); } + + [MonoTODO] set { throw new NotImplementedException (); } } - [MonoTODO] public object this[int i] { + [MonoTODO] get { throw new NotImplementedException (); } + + [MonoTODO] set { throw new NotImplementedException (); } } - [MonoTODO] public object this[string s, DataRowVersion version] { + [MonoTODO] get { throw new NotImplementedException (); } } - [MonoTODO] public object this[DataColumn dc, DataRowVersion version] { + [MonoTODO] get { throw new NotImplementedException (); } } - [MonoTODO] public object this[int i, DataRowVersion version] { + [MonoTODO] get { throw new NotImplementedException (); } } - [MonoTODO] public object[] ItemArray { + [MonoTODO] get { throw new NotImplementedException (); } + + [MonoTODO] set { throw new NotImplementedException (); } } - [MonoTODO] public string RowError { + [MonoTODO] get { throw new NotImplementedException (); } + + [MonoTODO] set { throw new NotImplementedException (); } } - [MonoTODO] public DataRowState RowState { + [MonoTODO] get { throw new NotImplementedException (); } } - [MonoTODO] public DataTable Table { - get { throw new NotImplementedException (); } + [MonoTODO] + get { + return table; + } } #endregion // Public Properties diff --git a/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs b/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs index a59068accbf..5466ec822bf 100644 --- a/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs +++ b/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs @@ -18,17 +18,21 @@ namespace System.Data [MonoTODO] public DataRowChangeEventArgs(DataRow row,
DataRowAction action) { + + throw new NotImplementedException (); } public DataRowAction Action { [MonoTODO] get { + throw new NotImplementedException (); } } public DataRow Row { [MonoTODO] get { + throw new NotImplementedException (); } } diff --git a/mcs/class/System.Data/System.Data/DataRowCollection.cs b/mcs/class/System.Data/System.Data/DataRowCollection.cs index 0ba172e84ba..d111d99aced 100644 --- a/mcs/class/System.Data/System.Data/DataRowCollection.cs +++ b/mcs/class/System.Data/System.Data/DataRowCollection.cs @@ -7,6 +7,10 @@ // (C) Ximian, Inc 2002 // +using System; +using System.Collections; +using System.ComponentModel; + namespace System.Data { /// <summary>
@@ -18,64 +22,64 @@ namespace System.Data private ArrayList rows = null; // Item indexer - [Serializable]
public DataRow this[int index] { [MonoTODO] get { + return (DataRow) rows[index]; } } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public void Add(DataRow row) { - row.Add(row); + rows.Add(row); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public virtual DataRow Add(object[] values) { + throw new NotImplementedException (); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public void Clear() { + throw new NotImplementedException (); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public bool Contains(object key) { + throw new NotImplementedException (); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public DataRow Find(object key) { + throw new NotImplementedException (); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public DataRow Find(object[] keys) { + throw new NotImplementedException (); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public void InsertAt(DataRow row, int pos) { + throw new NotImplementedException (); } - [MonoTODO] - [Serializable]
+ [MonoTODO]
public void Remove(DataRow row) { + throw new NotImplementedException (); } - - [Serializable]
+
+ [MonoTODO]
public void RemoveAt(int index) {
+ throw new NotImplementedException ();
}
- [Serializable]
+ [MonoTODO]
protected override ArrayList List {
[MonoTODO]
get {
+ return rows;
}
- }
- + } } } diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs index 35c61dcb160..4c9bc199090 100644 --- a/mcs/class/System.Data/System.Data/DataTable.cs +++ b/mcs/class/System.Data/System.Data/DataTable.cs @@ -28,16 +28,18 @@ namespace System.Data private bool _caseSensitive; private DataColumnCollection _columnCollection; private ConstraintCollection _constraintCollection; - // private DataSet _dataSet; // FIXME: temporarily commented - // private DataView _defaultView; // FIXME: temporarily commented + // FIXME: temporarily commented + // private DataSet _dataSet; + // private DataView _defaultView; private string _displayExpression; private PropertyCollection _extendedProperties; private bool _hasErrors; private CultureInfo _locale; private int _minimumCapacity; private string _nameSpace; - private DataTableRelationCollection _childRelations; - private DataTableRelationCollection _parentRelations; + // FIXME: temporarily commented + // private DataTableRelationCollection _childRelations; + // private DataTableRelationCollection _parentRelations; private string _prefix; private DataColumn[] _primaryKey; private DataRowCollection _rows; @@ -65,8 +67,10 @@ namespace System.Data _displayExpression = null; _primaryKey = null; - _childRelations = new DataTableRelationCollection(); - _parentRelations = new DataTableRelationCollection(); + // FIXME: temporaily commented DataTableRelationCollection + // _childRelations = new DataTableRelationCollection(); + // _parentRelations = new DataTableRelationCollection(); + //_nextRowID = 1; //_elementColumnCount = 0; //_caseSensitiveAmbient = true; @@ -90,7 +94,7 @@ namespace System.Data public DataTable(string tableName) { - // _dataSet = null; // FIXME: temporarily commented + // _dataSet = null; // FIXME: temporarily commented // _defaultView = null; // FIXME: temporarily commented _columnCollection = new DataColumnCollection(this); //_constraintCollection = new ConstraintCollection(); TODO: uncomment after ConstraintCollection is built. @@ -100,8 +104,11 @@ namespace System.Data _caseSensitive = false; _displayExpression = null; _primaryKey = null; - _childRelations = new DataTableRelationCollection(); - _parentRelations = new DataTableRelationCollection(); + + // FIXME: temporarily commented DataTableRelationCollection + // _childRelations = new DataTableRelationCollection(); + // _parentRelations = new DataTableRelationCollection(); + //_nextRowID = 1; //_elementColumnCount = 0; //_caseSensitiveAmbient = true; @@ -155,7 +162,9 @@ namespace System.Data { get { - return (DataRelationCollection)_childRelations; + // FIXME: temporarily commented to compile + // return (DataRelationCollection)_childRelations; + throw new NotImplementedException (); } } @@ -199,7 +208,8 @@ namespace System.Data } /// <summary> - /// Gets a customized view of the table which may include a filtered view, or a cursor position. + /// Gets a customized view of the table which may + /// include a filtered view, or a cursor position. /// </summary> public DataView DefaultView @@ -212,7 +222,8 @@ namespace System.Data */ /// <summary> - /// Gets or sets the expression that will return a value used to represent this table in the user interface. + /// Gets or sets the expression that will return + /// a value used to represent this table in the user interface. /// </summary> public string DisplayExpression @@ -239,7 +250,9 @@ namespace System.Data } /// <summary> - /// Gets a value indicating whether there are errors in any of the rows in any of the tables of the DataSet to which the table belongs. + /// Gets a value indicating whether there are errors in + /// any of the rows in any of the tables of the DataSet to + /// which the table belongs. /// </summary> public bool HasErrors { @@ -250,7 +263,8 @@ namespace System.Data } /// <summary> - /// Gets or sets the locale information used to compare strings within the table. + /// Gets or sets the locale information used to + /// compare strings within the table. /// </summary> public CultureInfo Locale { @@ -280,7 +294,8 @@ namespace System.Data } /// <summary> - /// Gets or sets the namespace for the XML represenation of the data stored in the DataTable. + /// Gets or sets the namespace for the XML represenation + /// of the data stored in the DataTable. /// </summary> public string Namespace { @@ -295,18 +310,22 @@ namespace System.Data } /// <summary> - /// Gets the collection of parent relations for this DataTable. + /// Gets the collection of parent relations for + /// this DataTable. /// </summary> public DataRelationCollection ParentRelations { get - { - return _parentRelations; + { + // FIXME: temporarily commented to compile + // return _parentRelations; + throw new NotImplementedException (); } } /// <summary> - /// Gets or sets the namespace for the XML represenation of the data stored in the DataTable. + /// Gets or sets the namespace for the XML represenation + /// of the data stored in the DataTable. /// </summary> public string Prefix { @@ -321,7 +340,8 @@ namespace System.Data } /// <summary> - /// Gets or sets an array of columns that function as primary keys for the data table. + /// Gets or sets an array of columns that function as + /// primary keys for the data table. /// </summary> public DataColumn[] PrimaryKey { @@ -348,10 +368,11 @@ namespace System.Data } /// <summary> - /// Gets or sets an System.ComponentModel.ISite for the DataTable. + /// Gets or sets an System.ComponentModel.ISite + /// for the DataTable. /// </summary> - public override ISite Site + public virtual ISite Site { get { @@ -379,17 +400,19 @@ namespace System.Data } } - bool IListSource.ContainsListCollection + /* FIXME: implement IListSource + public bool IListSource.ContainsListCollection { get { return _containsListCollection; } } - + */ /// <summary> - /// Commits all the changes made to this table since the last time AcceptChanges was called. + /// Commits all the changes made to this table since the + /// last time AcceptChanges was called. /// </summary> public void AcceptChanges() @@ -397,7 +420,9 @@ namespace System.Data } /// <summary> - /// Begins the initialization of a DataTable that is used on a form or used by another component. The initialization occurs at runtime. + /// Begins the initialization of a DataTable that is used + /// on a form or used by another component. The initialization + /// occurs at runtime. /// </summary> public void BeginInit() @@ -405,7 +430,8 @@ namespace System.Data } /// <summary> - /// Turns off notifications, index maintenance, and constraints while loading data. + /// Turns off notifications, index maintenance, and + /// constraints while loading data. /// </summary> public void BeginLoadData() @@ -421,7 +447,8 @@ namespace System.Data } /// <summary> - /// Clones the structure of the DataTable, including all DataTable schemas and constraints. + /// Clones the structure of the DataTable, including + /// all DataTable schemas and constraints. /// </summary> public virtual DataTable Clone() @@ -430,7 +457,8 @@ namespace System.Data } /// <summary> - /// Computes the given expression on the current rows that pass the filter criteria. + /// Computes the given expression on the current rows that + /// pass the filter criteria. /// </summary> public object Compute(string expression, string filter) @@ -449,7 +477,9 @@ namespace System.Data } /// <summary> - /// Ends the initialization of a DataTable that is used on a form or used by another component. The initialization occurs at runtime. + /// Ends the initialization of a DataTable that is used + /// on a form or used by another component. The + /// initialization occurs at runtime. /// </summary> public void EndInit() @@ -457,7 +487,8 @@ namespace System.Data } /// <summary> - /// Turns on notifications, index maintenance, and constraints after loading data. + /// Turns on notifications, index maintenance, and + /// constraints after loading data. /// </summary> public void EndLoadData() @@ -465,7 +496,9 @@ namespace System.Data } /// <summary> - /// Gets a copy of the DataTable that contains all changes made to it since it was loaded or AcceptChanges was last called. + /// Gets a copy of the DataTable that contains all + /// changes made to it since it was loaded or + /// AcceptChanges was last called. /// </summary> public DataTable GetChanges() @@ -474,7 +507,9 @@ namespace System.Data } /// <summary> - /// Gets a copy of the DataTable containing all changes made to it since it was last loaded, or since AcceptChanges was called, filtered by DataRowState. + /// Gets a copy of the DataTable containing all + /// changes made to it since it was last loaded, or + /// since AcceptChanges was called, filtered by DataRowState. /// </summary> public DataTable GetChanges(DataRowState rowStates) @@ -492,7 +527,8 @@ namespace System.Data //} /// <summary> - /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code. + /// This member supports the .NET Framework infrastructure + /// and is not intended to be used directly from your code. /// </summary> //protected virtual Type GetRowType() @@ -500,17 +536,21 @@ namespace System.Data //} /// <summary> - /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code. + /// This member supports the .NET Framework infrastructure + /// and is not intended to be used directly from your code. /// </summary> - IList IListSource.GetList() + /* FIXME: implement IListSource + public IList IListSource.GetList() { IList list = null; return list; } - + */ + /// <summary> - /// Copies a DataRow into a DataTable, preserving any property settings, as well as original and current values. + /// Copies a DataRow into a DataTable, preserving any + /// property settings, as well as original and current values. /// </summary> public void ImportRow(DataRow row) @@ -518,7 +558,8 @@ namespace System.Data } /// <summary> - /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code. + /// This member supports the .NET Framework infrastructure + /// and is not intended to be used directly from your code. /// </summary> void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) @@ -526,7 +567,8 @@ namespace System.Data } /// <summary> - /// Finds and updates a specific row. If no matching row is found, a new row is created using the given values. + /// Finds and updates a specific row. If no matching row + /// is found, a new row is created using the given values. /// </summary> public DataRow LoadDataRow(object[] values, bool fAcceptChanges) { @@ -544,7 +586,8 @@ namespace System.Data } /// <summary> - /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code. + /// This member supports the .NET Framework infrastructure + /// and is not intended to be used directly from your code. /// </summary> protected internal DataRow[] NewRowArray(int size) { @@ -627,7 +670,9 @@ namespace System.Data } /// <summary> - /// Rolls back all changes that have been made to the table since it was loaded, or the last time AcceptChanges was called. + /// Rolls back all changes that have been made to the + /// table since it was loaded, or the last time AcceptChanges + /// was called. /// </summary> public void RejectChanges() @@ -653,7 +698,9 @@ namespace System.Data } /// <summary> - /// Gets an array of all DataRow objects that match the filter criteria in order of primary key (or lacking one, order of addition.) + /// Gets an array of all DataRow objects that match + /// the filter criteria in order of primary key (or + /// lacking one, order of addition.) /// </summary> public DataRow[] Select(string filterExpression) @@ -663,7 +710,9 @@ namespace System.Data } /// <summary> - /// Gets an array of all DataRow objects that match the filter criteria, in the the specified sort order. + /// Gets an array of all DataRow objects that + /// match the filter criteria, in the the + /// specified sort order. /// </summary> public DataRow[] Select(string filterExpression, string sort) @@ -673,7 +722,9 @@ namespace System.Data } /// <summary> - /// Gets an array of all DataRow objects that match the filter in the order of the sort, that match the specified state. + /// Gets an array of all DataRow objects that match + /// the filter in the order of the sort, that match + /// the specified state. /// </summary> public DataRow[] Select(string filterExpression, string sort, DataViewRowState recordStates) @@ -683,7 +734,8 @@ namespace System.Data } /// <summary> - /// Gets the TableName and DisplayExpression, if there is one as a concatenated string. + /// Gets the TableName and DisplayExpression, if + /// there is one as a concatenated string. /// </summary> public override string ToString() @@ -694,13 +746,15 @@ namespace System.Data /* FIXME: temporarily commented - so we can get a * a simple forward read only result set /// <summary> - /// Occurs when after a value has been changed for the specified DataColumn in a DataRow. + /// Occurs when after a value has been changed for + /// the specified DataColumn in a DataRow. /// </summary> public event DataColumnChangeEventHandler ColumnChanged; /// <summary> - /// Occurs when a value is being changed for the specified DataColumn in a DataRow. + /// Occurs when a value is being changed for the specified + /// DataColumn in a DataRow. /// </summary> public event DataColumnChangeEventHandler ColumnChanging; diff --git a/mcs/class/System.Data/System.Data/DataTableCollection.cs b/mcs/class/System.Data/System.Data/DataTableCollection.cs index 35c4479e769..7dd35cd67ee 100644 --- a/mcs/class/System.Data/System.Data/DataTableCollection.cs +++ b/mcs/class/System.Data/System.Data/DataTableCollection.cs @@ -8,6 +8,8 @@ // using System; +using System.Collections; +using System.ComponentModel; namespace System.Data { @@ -55,7 +57,6 @@ namespace System.Data } [MonoTODO] - [Serializable] public bool CanRemove (DataTable table) { throw new NotImplementedException (); } @@ -75,10 +76,6 @@ namespace System.Data return false; } - public void CopyTo (Array ar, int index) { - Array.Copy (tables, ar, size); - } - public virtual int IndexOf (DataTable table) { for (int i = 0; i < size; i++) { if (tables[i] == table) @@ -135,26 +132,28 @@ namespace System.Data return null; } } - - [MonoTODO] +
protected override ArrayList List { - throw new NotImplementedException (); + [MonoTODO] + get{ + throw new NotImplementedException (); + } } - [Serializable] public event CollectionChangeEventHandler CollectionChanged; - [Serializable] public event CollectionChangeEventHandler CollectionChanging; - [Serializable] protected virtual void OnCollectionChanged ( CollectionChangeEventArgs ccevent) { + + throw new NotImplementedException (); } - [Serializable] protected internal virtual void OnCollectionChanging ( CollectionChangeEventArgs ccevent) { + + throw new NotImplementedException (); } } } diff --git a/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs b/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs new file mode 100644 index 00000000000..29e1847eff5 --- /dev/null +++ b/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs @@ -0,0 +1,351 @@ +// +// System.Data.DataTableRelationCollection.cs +// +// Author: +// Christopher Podurgiel (cpodurgiel@msn.com) +// +// (C) Chris Podurgiel +// + +using System; +using System.Collections; +using System.ComponentModel; + +namespace System.Data +{ + /// <summary> + /// Summary description for DataTableRelationCollection. + /// </summary> + internal class DataTableRelationCollection : DataRelationCollection + { + private ArrayList list = null; + private int defaultNameIndex; + private DataTable table; + + + /// <summary> + /// Initializes a new instance of the DataRelationCollection class. + /// </summary> + [MonoTODO] + internal DataTableRelationCollection():base() + { + //table = dataTable; + } + + /// <summary> + /// Gets the DataRelation object specified by name. + /// </summary> + [MonoTODO] + public override DataRelation this[string name] + { + get + { + foreach (DataRelation dataRelation in list) + { + if (dataRelation.RelationName == name) + { + return dataRelation; + } + } + + return null; + } + } + + /// <summary> + /// Gets the DataRelation object at the specified index. + /// </summary> + [MonoTODO] + public override DataRelation this[int index] + { + get + { + return (DataRelation)list[index]; + } + } + + /* + #region Add Methods + /// <summary> + /// Adds a DataRelation to the DataRelationCollection. + /// </summary> + /// <param name="relation">The DataRelation to add to the collection.</param> + public new void Add(DataRelation relation) + { + if(relation != null) + { + //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this); + list.Add(relation); + //OnCollectionChanged(e); + } + return; + } + + /// <summary> + /// Creates a relation given the parameters and adds it to the collection. The name is defaulted. + /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection. + /// An InvalidConstraintException is generated if the relation can't be created based on the parameters. + /// The CollectionChanged event is fired if it succeeds. + /// </summary> + /// <param name="parentColumn">parent column of relation.</param> + /// <param name="childColumn">child column of relation.</param> + /// <returns>The created DataRelation.</returns> + public override DataRelation Add(DataColumn parentColumn, DataColumn childColumn) + { + if(parentColumn == null) + { + throw new ArgumentNullException("parentColumn"); + } + else if( childColumn == null) + { + throw new ArgumentNullException("childColumn"); + } + + if(parentColumn.Table.DataSet != childColumn.Table.DataSet) + { + throw new InvalidConstraintException("my ex"); + } + + DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumn, childColumn); + list.Add(dataRelation); + defaultNameIndex++; + return dataRelation; + } + + /// <summary> + /// Creates a relation given the parameters and adds it to the collection. The name is defaulted. + /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection. + /// An InvalidConstraintException is generated if the relation can't be created based on the parameters. + /// The CollectionChanged event is raised if it succeeds. + /// </summary> + /// <param name="parentColumns">An array of parent DataColumn objects.</param> + /// <param name="childColumns">An array of child DataColumn objects.</param> + /// <returns>The created DataRelation.</returns> + public override DataRelation Add(DataColumn[] parentColumns, DataColumn[] childColumns) + { + DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumns, childColumns); + list.Add(dataRelation); + defaultNameIndex++; + return dataRelation; + } + + /// <summary> + /// Creates a relation given the parameters and adds it to the collection. + /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection. + /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive). + /// An InvalidConstraintException is generated if the relation can't be created based on the parameters. + /// The CollectionChanged event is raised if it succeeds. + /// </summary> + /// <param name="name">The name of the relation.</param> + /// <param name="parentColumn">parent column of relation.</param> + /// <returns>The created DataRelation.</returns> + /// <returns></returns> + public override DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn) + { + //If no name was supplied, give it a default name. + if ((name == null) || (name == "")) + { + name = "Relation" + defaultNameIndex.ToString(); + defaultNameIndex++; + } + + DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn); + list.Add(dataRelation); + return dataRelation; + } + + /// <summary> + /// Creates a DataRelation with the specified name, and arrays of parent and child columns, and adds it to the collection. + /// </summary> + /// <param name="name">The name of the DataRelation to create.</param> + /// <param name="parentColumns">An array of parent DataColumn objects.</param> + /// <param name="childColumns">An array of child DataColumn objects.</param> + /// <returns>The created DataRelation.</returns> + public override DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns) + { + //If no name was supplied, give it a default name. + if ((name == null) || (name == "")) + { + name = "Relation" + defaultNameIndex.ToString(); + defaultNameIndex++; + } + + DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns); + list.Add(dataRelation); + return dataRelation; + } + + /// <summary> + /// Creates a relation given the parameters and adds it to the collection. + /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection. + /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive). + /// An InvalidConstraintException is generated if the relation can't be created based on the parameters. + /// The CollectionChanged event is raised if it succeeds. + /// </summary> + /// <param name="name">The name of the relation.</param> + /// <param name="parentColumn">parent column of relation.</param> + /// <param name="childColumn">child column of relation.</param> + /// <param name="createConstraints">true to create constraints; otherwise false. (default is true)</param> + /// <returns>The created DataRelation.</returns> + public override DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn, bool createConstraints) + { + //If no name was supplied, give it a default name. + if ((name == null) || (name == "")) + { + name = "Relation" + defaultNameIndex.ToString(); + defaultNameIndex++; + } + + DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn, createConstraints); + list.Add(dataRelation); + return dataRelation; + } + + /// <summary> + /// Creates a DataRelation with the specified name, arrays of parent and child columns, + /// and value specifying whether to create a constraint, and adds it to the collection. + /// </summary> + /// <param name="name">The name of the DataRelation to create.</param> + /// <param name="parentColumns">An array of parent DataColumn objects.</param> + /// <param name="childColumns">An array of child DataColumn objects.</param> + /// <param name="createConstraints">true to create a constraint; otherwise false.</param> + /// <returns>The created DataRelation.</returns> + public override DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints) + { + //If no name was supplied, give it a default name. + if ((name == null) || (name == "")) + { + name = "Relation" + defaultNameIndex.ToString(); + defaultNameIndex++; + } + + DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns, createConstraints); + list.Add(dataRelation); + return dataRelation; + } + #endregion + + /// <summary> + /// Performs verification on the table. + /// </summary> + /// <param name="relation">The relation to check.</param> + protected virtual void AddCore(DataRelation relation) + { + if (relation == null) + { + //TODO: Issue a good exception message. + throw new ArgumentNullException(); + } + else if(list.IndexOf(relation) != -1) + { + //TODO: Issue a good exception message. + throw new ArgumentException(); + } + else if(list.Contains(relation.RelationName)) + { + throw new DuplicateNameException("A Relation named " + relation.RelationName + " already belongs to this DataSet."); + } + } + */ + + /// <summary> + /// Copies the elements of the specified DataRelation array to the end of the collection. + /// </summary> + /// <param name="relations">The array of DataRelation objects to add to the collection.</param> + [MonoTODO] + public virtual void AddRange(DataRelation[] relations) + { + //TODO: Implement. + + DataSet dataSet = GetDataSet(); + + throw new NotImplementedException (); + + /* + foreach(DataRelation dataRelation in relations) + { + + } + */ + } + + [MonoTODO] + public virtual bool CanRemove(DataRelation relation) + { + //TODO: Implement. + return false; + } + + [MonoTODO] + public virtual void Clear() + { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual bool Contains(string name) + { + return false; + } + + // FIXME: temporarily commented so we can compile + /* + [MonoTODO] + protected override DataSet GetDataSet() + { + return table.DataSet; + } + */ + + [MonoTODO] + public virtual int IndexOf(DataRelation relation) + { + return list.IndexOf(relation); + } + + [MonoTODO] + public virtual int IndexOf(string relationName) + { + return list.IndexOf(this[relationName]); + } + + [MonoTODO] + protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public void Remove(DataRelation relation) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public void Remove(string name) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public void RemoveAt(int index) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected virtual void RemoveCore(DataRelation relation) + { + throw new NotImplementedException (); + } + + public event CollectionChangeEventHandler CollectionChanged; + + } +} diff --git a/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs new file mode 100644 index 00000000000..591398afa9c --- /dev/null +++ b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs @@ -0,0 +1,137 @@ +// +// System.Data.ForeignKeyConstraint.cs +// +// Author: +// Daniel Morgan <danmorg@sc.rr.com> +// +// (C) 2002 Daniel Morgan +// + +using System; +using System.Collections; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace System.Data +{ + + [Serializable]
+ public class ForeignKeyConstraint : Constraint { + + #region Constructors + + [MonoTODO]
+ public ForeignKeyConstraint(DataColumn parentColumn,
+ DataColumn childColumn) { + } + + [MonoTODO]
+ public ForeignKeyConstraint(DataColumn[] parentColumns,
+ DataColumn[] childColumns) { + } + + [MonoTODO]
+ public ForeignKeyConstraint(string constraintName,
+ DataColumn parentColumn, DataColumn childColumn) { + } + + [MonoTODO]
+ public ForeignKeyConstraint(string constraintName,
+ DataColumn[] parentColumns,
+ DataColumn[] childColumns) { + } + + [MonoTODO]
+ public ForeignKeyConstraint(string constraintName,
+ string parentTableName, string[] parentColumnNames,
+ string[] childColumnNames,
+ AcceptRejectRule acceptRejectRule, Rule deleteRule,
+ Rule updateRule) { + } + + #endregion // Constructors + + #region Properites +
+ public virtual AcceptRejectRule AcceptRejectRule { + [MonoTODO] + get { + throw new NotImplementedException (); + } + + [MonoTODO] + set { + throw new NotImplementedException (); + } + } +
+ public virtual DataColumn[] Columns { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } +
+ public virtual Rule DeleteRule { + [MonoTODO] + get { + throw new NotImplementedException (); + } + + [MonoTODO] + set { + throw new NotImplementedException (); + } + } +
+ public virtual DataColumn[] RelatedColumns { + [MonoTODO] + get { + throw new NotImplementedException (); + } + }
+
+ public virtual DataTable RelatedTable { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } +
+ public override DataTable Table { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } +
+ public virtual Rule UpdateRule { + [MonoTODO] + get { + throw new NotImplementedException (); + } + + [MonoTODO] + set { + throw new NotImplementedException (); + } + } + + #endregion // Properties + + #region Methods + + [MonoTODO]
+ public override bool Equals(object key) { + throw new NotImplementedException (); + } + + [MonoTODO]
+ public override int GetHashCode() { + throw new NotImplementedException (); + } + + #endregion // Methods + } + +} diff --git a/mcs/class/System.Data/System.Data/IDbCommand.cs b/mcs/class/System.Data/System.Data/IDbCommand.cs index e079dd11ebc..547d702af67 100644 --- a/mcs/class/System.Data/System.Data/IDbCommand.cs +++ b/mcs/class/System.Data/System.Data/IDbCommand.cs @@ -22,18 +22,14 @@ namespace System.Data int ExecuteNonQuery(); - // FIXME: temporarily commented so i could - // compile SqlConnection and SqlCommand - /* IDataReader ExecuteReader(); IDataReader ExecuteReader(CommandBehavior behavior); - */ + object ExecuteScalar(); void Prepare(); - string CommandText{get; set;} int CommandTimeout{get; set;} diff --git a/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs index c400d5746b8..6de239f8cd0 100644 --- a/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs +++ b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs @@ -65,6 +65,7 @@ namespace System.Data [MonoTODO] get { // FIXME: how do we sync? + throw new NotImplementedException (); } } @@ -82,7 +83,7 @@ namespace System.Data [MonoTODO] public IEnumerator GetEnumerator() { - + throw new NotImplementedException (); } //[MonoTODO] diff --git a/mcs/class/System.Data/System.Data/PropertyCollection.cs b/mcs/class/System.Data/System.Data/PropertyCollection.cs index 011c4fd2cd9..ef720923387 100644 --- a/mcs/class/System.Data/System.Data/PropertyCollection.cs +++ b/mcs/class/System.Data/System.Data/PropertyCollection.cs @@ -9,6 +9,7 @@ using System; using System.Collections; +using System.ComponentModel; namespace System.Data { diff --git a/mcs/class/System.Data/System.Data/UniqueConstraint.cs b/mcs/class/System.Data/System.Data/UniqueConstraint.cs new file mode 100644 index 00000000000..60ec2e9c3a5 --- /dev/null +++ b/mcs/class/System.Data/System.Data/UniqueConstraint.cs @@ -0,0 +1,119 @@ +// +// System.Data.UniqueConstraint.cs +// +// Author: +// Daniel Morgan <danmorg@sc.rr.com> +// +// (C) 2002 Daniel Morgan +// + +using System; +using System.Collections; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace System.Data +{ + public class UniqueConstraint : Constraint { + + #region Constructors + + [MonoTODO]
+ public UniqueConstraint(DataColumn column) { + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(DataColumn[] columns) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(DataColumn column,
+ bool isPrimaryKey) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(DataColumn[] columns, bool isPrimaryKey) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(string name, DataColumn column) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(string name, DataColumn[] columns) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(string name, DataColumn column,
+ bool isPrimaryKey) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(string name,
+ DataColumn[] columns, bool isPrimaryKey) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public UniqueConstraint(string name,
+ string[] columnNames, bool isPrimaryKey) { + + throw new NotImplementedException (); + } + + #endregion // Constructors + + #region Properties + + public virtual DataColumn[] Columns { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public bool IsPrimaryKey { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public override DataTable Table { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override bool Equals(object key2) { + throw new NotImplementedException (); + } + + [MonoTODO] + public override int GetHashCode() { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/TODO b/mcs/class/System.Data/TODO index b2c94a8842e..fa02caba7cb 100644 --- a/mcs/class/System.Data/TODO +++ b/mcs/class/System.Data/TODO @@ -1,17 +1,21 @@ System.Data TODO List ===================== -This TODO list last updated on 2002-04-23 - Update this file as needed... * To get ExecuteReader() in a SqlCommand object to return a SqlDataReader object which can Read() data and get a String or Int32 from the database. Other types can be done later. - -In order to do this, we need to compile - SqlDataReader - DataTable + + A class (SqlDataReader) that implements IDataReader/IDataRecord + only has one row in memory at a time. + +In order to do this, we need to compile and edit these classes: + SqlDataReader DataTable DataRowCollection DataRow + DataColumnCollection DataColumn + DataConstraintCollection DataConstraint + DataRelationCollection DataRelation + DataTableCollection and dependencies... System.Data.Common classes that need to be implemented: @@ -30,9 +34,13 @@ The following classes implement InternalDataCollectionBase: * DataRowCollection * DataColumnCollection * DataTableCollection - * DataRelationCollection + * DataRelationCollection - an abstract class used by DataTable and DataSet * ConstraintCollection +DataTableRelationCollection is an internal class that implements DataRelationCollection +and is used by DataTable for parent/child relations. Don't know if it will/will not +be used by DataSet. + Other classes, structs, etc. that are missing: DataRowView DataSysDescriptionAttribute @@ -40,9 +48,7 @@ Other classes, structs, etc. that are missing: DataViewSetting DataViewSettingCollection FillErrorEventArgs - ForeignKeyConstraint MergeFailedEventArgs - UniqueConstraint TypedDataSetGenerator Exceptions that still need to be stubbed: |