public const string DefaultSourceTableName = "Table";
const string DefaultSourceColumnName = "Column";
+#if NET_2_0
+ IDbCommand _selectCommand;
+ internal IDbCommand _updateCommand;
+ internal IDbCommand _deleteCommand;
+ internal IDbCommand _insertCommand;
+#endif
+
#endregion // Fields
#region Constructors
{
}
- [MonoTODO]
protected DbDataAdapter(DbDataAdapter adapter) : base(adapter)
{
}
set { throw new NotImplementedException (); }
}
- [MonoTODO]
IDbCommand IDbDataAdapter.SelectCommand {
- get { return ((IDbDataAdapter) this).SelectCommand; }
- set { throw new NotImplementedException(); }
+ get { return _selectCommand; }
+ set { _selectCommand = value; }
}
- [MonoTODO]
IDbCommand IDbDataAdapter.UpdateCommand{
- get { return ((IDbDataAdapter) this).UpdateCommand; }
- set { throw new NotImplementedException(); }
+ get { return _updateCommand; }
+ set { _updateCommand = value; }
}
- [MonoTODO]
IDbCommand IDbDataAdapter.DeleteCommand{
- get { return ((IDbDataAdapter) this).DeleteCommand; }
- set { throw new NotImplementedException(); }
+ get { return _deleteCommand; }
+ set { _deleteCommand = value; }
}
- [MonoTODO]
IDbCommand IDbDataAdapter.InsertCommand{
- get { return ((IDbDataAdapter) this).InsertCommand; }
- set { throw new NotImplementedException(); }
+ get { return _insertCommand; }
+ set { _insertCommand = value; }
}
- [MonoTODO]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DbCommand SelectCommand {
get { return (DbCommand) ((IDbDataAdapter) this).SelectCommand; }
- set { throw new NotImplementedException(); }
+ set { ((IDbDataAdapter) this).SelectCommand = value; }
}
- [MonoTODO]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DbCommand DeleteCommand {
get { return (DbCommand) ((IDbDataAdapter) this).DeleteCommand; }
- set { throw new NotImplementedException(); }
+ set { ((IDbDataAdapter) this).DeleteCommand = value; }
}
- [MonoTODO]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DbCommand InsertCommand {
get { return (DbCommand) ((IDbDataAdapter) this).InsertCommand; }
- set { throw new NotImplementedException(); }
+ set { ((IDbDataAdapter) this).InsertCommand = value; }
}
- [MonoTODO]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DbCommand UpdateCommand {
get { return (DbCommand) ((IDbDataAdapter) this).UpdateCommand; }
- set { throw new NotImplementedException(); }
+ set { ((IDbDataAdapter) this).UpdateCommand = value; }
}
[MonoTODO]
[MonoTODO]
protected virtual void OnRowUpdated (RowUpdatedEventArgs value)
{
+ throw new NotImplementedException ();
}
[MonoTODO]
protected virtual void OnRowUpdating (RowUpdatingEventArgs value)
{
+ throw new NotImplementedException ();
}
#else
protected abstract RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command,
return counter;
}
+ internal static int FillFromReader (DataTable table,
+ IDataReader reader,
+ int start,
+ int length,
+ int [] mapping,
+ LoadOption loadOption,
+ FillErrorEventHandler errorHandler)
+ {
+ if (reader.FieldCount == 0)
+ return 0 ;
+
+ for (int i = 0; i < start; i++)
+ reader.Read ();
+
+ int counter = 0;
+ object [] values = new object [mapping.Length];
+ while (reader.Read () &&
+ (length == 0 || counter < length)) {
+
+ for (int i = 0 ; i < mapping.Length; i++)
+ values [i] = mapping [i] < 0 ? null : reader [mapping [i]];
+
+ table.BeginLoadData ();
+ try {
+ table.LoadDataRow (values, loadOption);
+ } catch (Exception e) {
+ FillErrorEventArgs args = new FillErrorEventArgs (table, values);
+ args.Errors = e;
+ args.Continue = false;
+ errorHandler (table, args);
+ // if args.Continue is not set to true or if a handler is not set, rethrow the error..
+ if(!args.Continue)
+ throw e;
+ }
+ table.EndLoadData ();
+ counter++;
+ }
+ return counter;
+ }
+
#endif // NET_2_0
public override DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType)
return FillSchema (dataSet, schemaType, ((IDbDataAdapter) this).SelectCommand, srcTable, CommandBehavior.Default);
}
- [MonoTODO ("Verify")]
protected virtual DataTable FillSchema (DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior)
{
if (dataTable == null)
return dataTable;
}
- [MonoTODO ("Verify")]
protected virtual DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType, IDbCommand command, string srcTable, CommandBehavior behavior)
{
if (dataSet == null)
// "array[ordinal of datatable column] == index of source column in data reader".
// each column in the datatable has a mapping to a specific column in the datareader,
// the int array represents this match.
- [MonoTODO ("Test")]
private int[] BuildSchema (IDataReader reader, DataTable table, SchemaType schemaType)
{
return BuildSchema (reader, table, schemaType, MissingSchemaAction,
throw new NotImplementedException ();
}
- [MonoTODO]
public int Update (DataRow[] dataRows)
{
if (dataRows == null)
return Update (rows, tableMapping);
}
- [MonoTODO]
protected virtual int Update (DataRow[] dataRows, DataTableMapping tableMapping)
{
int updateCount = 0;