DataAdapter.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. //
  2. // System.Data.Common.DataAdapter
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. // Tim Coleman ([email protected])
  7. //
  8. // (C) Ximian, Inc
  9. // Copyright (C) Tim Coleman, 2002-2003
  10. //
  11. //
  12. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  13. //
  14. // Permission is hereby granted, free of charge, to any person obtaining
  15. // a copy of this software and associated documentation files (the
  16. // "Software"), to deal in the Software without restriction, including
  17. // without limitation the rights to use, copy, modify, merge, publish,
  18. // distribute, sublicense, and/or sell copies of the Software, and to
  19. // permit persons to whom the Software is furnished to do so, subject to
  20. // the following conditions:
  21. //
  22. // The above copyright notice and this permission notice shall be
  23. // included in all copies or substantial portions of the Software.
  24. //
  25. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  29. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  30. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  31. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. //
  33. using System;
  34. using System.Data;
  35. using System.Collections;
  36. using System.ComponentModel;
  37. namespace System.Data.Common
  38. {
  39. /// <summary>
  40. /// Represents a set of data commands and a database connection that are used to fill the DataSet and update the data source.
  41. /// </summary>
  42. public
  43. #if ONLY_1_1
  44. abstract
  45. #endif
  46. class DataAdapter : Component, IDataAdapter
  47. {
  48. #region Fields
  49. private bool acceptChangesDuringFill;
  50. private bool continueUpdateOnError;
  51. private MissingMappingAction missingMappingAction;
  52. private MissingSchemaAction missingSchemaAction;
  53. private DataTableMappingCollection tableMappings;
  54. private const string DefaultSourceTableName = "Table";
  55. private const string DefaultSourceColumnName = "Column";
  56. #if NET_2_0
  57. private bool acceptChangesDuringUpdate;
  58. private LoadOption fillLoadOption;
  59. private bool returnProviderSpecificTypes;
  60. #endif
  61. #endregion
  62. #region Constructors
  63. protected DataAdapter ()
  64. {
  65. acceptChangesDuringFill = true;
  66. continueUpdateOnError = false;
  67. missingMappingAction = MissingMappingAction.Passthrough;
  68. missingSchemaAction = MissingSchemaAction.Add;
  69. tableMappings = new DataTableMappingCollection ();
  70. #if NET_2_0
  71. acceptChangesDuringUpdate = true;
  72. fillLoadOption = LoadOption.OverwriteChanges;
  73. returnProviderSpecificTypes = false;
  74. #endif
  75. }
  76. protected DataAdapter (DataAdapter from)
  77. {
  78. AcceptChangesDuringFill = from.AcceptChangesDuringFill;
  79. ContinueUpdateOnError = from.ContinueUpdateOnError;
  80. MissingMappingAction = from.MissingMappingAction;
  81. MissingSchemaAction = from.MissingSchemaAction;
  82. if (from.tableMappings != null)
  83. foreach (ICloneable cloneable in from.TableMappings)
  84. TableMappings.Add (cloneable.Clone ());
  85. #if NET_2_0
  86. acceptChangesDuringUpdate = from.AcceptChangesDuringUpdate;
  87. fillLoadOption = from.FillLoadOption;
  88. returnProviderSpecificTypes = from.ReturnProviderSpecificTypes;
  89. #endif
  90. }
  91. #endregion
  92. #region Properties
  93. [DataCategory ("Fill")]
  94. #if !NET_2_0
  95. [DataSysDescription ("Whether or not Fill will call DataRow.AcceptChanges.")]
  96. #endif
  97. [DefaultValue (true)]
  98. public bool AcceptChangesDuringFill {
  99. get { return acceptChangesDuringFill; }
  100. set { acceptChangesDuringFill = value; }
  101. }
  102. #if NET_2_0
  103. [DefaultValue (true)]
  104. public bool AcceptChangesDuringUpdate {
  105. get { return acceptChangesDuringUpdate; }
  106. set { acceptChangesDuringUpdate = value; }
  107. }
  108. #endif
  109. [DataCategory ("Update")]
  110. #if !NET_2_0
  111. [DataSysDescription ("Whether or not to continue to the next DataRow when the Update events, RowUpdating and RowUpdated, Status is UpdateStatus.ErrorsOccurred.")]
  112. #endif
  113. [DefaultValue (false)]
  114. public bool ContinueUpdateOnError {
  115. get { return continueUpdateOnError; }
  116. set { continueUpdateOnError = value; }
  117. }
  118. #if NET_2_0
  119. [RefreshProperties (RefreshProperties.All)]
  120. public LoadOption FillLoadOption {
  121. get { return fillLoadOption; }
  122. set {
  123. ExceptionHelper.CheckEnumValue (typeof (LoadOption), value);
  124. fillLoadOption = value;
  125. }
  126. }
  127. #endif
  128. ITableMappingCollection IDataAdapter.TableMappings {
  129. get { return TableMappings; }
  130. }
  131. [DataCategory ("Mapping")]
  132. #if !NET_2_0
  133. [DataSysDescription ("The action taken when a table or column in the TableMappings is missing.")]
  134. #endif
  135. [DefaultValue (MissingMappingAction.Passthrough)]
  136. public MissingMappingAction MissingMappingAction {
  137. get { return missingMappingAction; }
  138. set {
  139. ExceptionHelper.CheckEnumValue (typeof (MissingMappingAction), value);
  140. missingMappingAction = value;
  141. }
  142. }
  143. [DataCategory ("Mapping")]
  144. #if !NET_2_0
  145. [DataSysDescription ("The action taken when a table or column in the DataSet is missing.")]
  146. #endif
  147. [DefaultValue (MissingSchemaAction.Add)]
  148. public MissingSchemaAction MissingSchemaAction {
  149. get { return missingSchemaAction; }
  150. set {
  151. ExceptionHelper.CheckEnumValue (typeof (MissingSchemaAction), value);
  152. missingSchemaAction = value;
  153. }
  154. }
  155. #if NET_2_0
  156. [DefaultValue (false)]
  157. public virtual bool ReturnProviderSpecificTypes {
  158. get { return returnProviderSpecificTypes; }
  159. set { returnProviderSpecificTypes = value; }
  160. }
  161. #endif
  162. [DataCategory ("Mapping")]
  163. #if !NET_2_0
  164. [DataSysDescription ("How to map source table to DataSet table.")]
  165. #endif
  166. [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
  167. public DataTableMappingCollection TableMappings {
  168. get { return tableMappings; }
  169. }
  170. #endregion
  171. #region Events
  172. #if NET_2_0
  173. public event FillErrorEventHandler FillError;
  174. #endif
  175. #endregion
  176. #region Methods
  177. [Obsolete ("Use the protected constructor instead")]
  178. [MonoTODO]
  179. protected virtual DataAdapter CloneInternals ()
  180. {
  181. throw new NotImplementedException ();
  182. }
  183. protected virtual DataTableMappingCollection CreateTableMappings ()
  184. {
  185. return new DataTableMappingCollection ();
  186. }
  187. [MonoTODO]
  188. protected override void Dispose (bool disposing)
  189. {
  190. }
  191. protected virtual bool ShouldSerializeTableMappings ()
  192. {
  193. return true;
  194. }
  195. internal int FillInternal (DataTable dataTable, IDataReader dataReader)
  196. {
  197. if (dataReader.FieldCount == 0) {
  198. dataReader.Close ();
  199. return 0;
  200. }
  201. int count = 0;
  202. try {
  203. string tableName = SetupSchema (SchemaType.Mapped, dataTable.TableName);
  204. if (tableName != null) {
  205. dataTable.TableName = tableName;
  206. FillTable (dataTable, dataReader, 0, 0, ref count);
  207. }
  208. } finally {
  209. dataReader.Close ();
  210. }
  211. return count;
  212. }
  213. // this method builds the schema for a given datatable. it returns a int array with
  214. // "array[ordinal of datatable column] == index of source column in data reader".
  215. // each column in the datatable has a mapping to a specific column in the datareader,
  216. // the int array represents this match.
  217. internal int[] BuildSchema (IDataReader reader, DataTable table, SchemaType schemaType)
  218. {
  219. return BuildSchema (reader, table, schemaType, MissingSchemaAction,
  220. MissingMappingAction, TableMappings);
  221. }
  222. /// <summary>
  223. /// Creates or Modifies the schema of the given DataTable based on the schema of
  224. /// the reader and the arguments passed.
  225. /// </summary>
  226. internal static int[] BuildSchema (IDataReader reader, DataTable table,
  227. SchemaType schemaType,
  228. MissingSchemaAction missingSchAction,
  229. MissingMappingAction missingMapAction,
  230. DataTableMappingCollection dtMapping
  231. )
  232. {
  233. int readerIndex = 0;
  234. // FIXME : this fails if query has fewer columns than a table
  235. int[] mapping = new int[table.Columns.Count]; // mapping the reader indexes to the datatable indexes
  236. for(int i=0; i < mapping.Length; i++) {
  237. mapping[i] = -1;
  238. }
  239. ArrayList primaryKey = new ArrayList ();
  240. ArrayList sourceColumns = new ArrayList ();
  241. bool createPrimaryKey = true;
  242. DataTable schemaTable = reader.GetSchemaTable ();
  243. DataColumn ColumnNameCol = schemaTable.Columns["ColumnName"];
  244. DataColumn DataTypeCol = schemaTable.Columns["DataType"];
  245. DataColumn IsAutoIncrementCol = schemaTable.Columns["IsAutoIncrement"];
  246. DataColumn AllowDBNullCol = schemaTable.Columns["AllowDBNull"];
  247. DataColumn IsReadOnlyCol = schemaTable.Columns["IsReadOnly"];
  248. DataColumn IsKeyCol = schemaTable.Columns["IsKey"];
  249. DataColumn IsUniqueCol = schemaTable.Columns["IsUnique"];
  250. DataColumn ColumnSizeCol = schemaTable.Columns["ColumnSize"];
  251. foreach (DataRow schemaRow in schemaTable.Rows) {
  252. // generate a unique column name in the source table.
  253. string sourceColumnName;
  254. string realSourceColumnName ;
  255. if (ColumnNameCol == null || schemaRow.IsNull(ColumnNameCol) ||
  256. (string)schemaRow [ColumnNameCol] == String.Empty) {
  257. sourceColumnName = DefaultSourceColumnName;
  258. realSourceColumnName = DefaultSourceColumnName + "1";
  259. } else {
  260. sourceColumnName = (string) schemaRow [ColumnNameCol];
  261. realSourceColumnName = sourceColumnName;
  262. }
  263. for (int i = 1; sourceColumns.Contains (realSourceColumnName); i += 1)
  264. realSourceColumnName = String.Format ("{0}{1}", sourceColumnName, i);
  265. sourceColumns.Add(realSourceColumnName);
  266. // generate DataSetColumnName from DataTableMapping, if any
  267. DataTableMapping tableMapping = null;
  268. //FIXME : The sourcetable name shud get passed as a parameter..
  269. int index = dtMapping.IndexOfDataSetTable (table.TableName);
  270. string srcTable = (index != -1 ? dtMapping[index].SourceTable : table.TableName);
  271. tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (dtMapping, ADP.IsEmpty (srcTable) ? " " : srcTable, table.TableName, missingMapAction);
  272. if (tableMapping != null) {
  273. table.TableName = tableMapping.DataSetTable;
  274. // check to see if the column mapping exists
  275. DataColumnMapping columnMapping = DataColumnMappingCollection.GetColumnMappingBySchemaAction(tableMapping.ColumnMappings, realSourceColumnName, missingMapAction);
  276. if (columnMapping != null) {
  277. Type columnType = schemaRow[DataTypeCol] as Type;
  278. DataColumn col = columnType != null ? columnMapping.GetDataColumnBySchemaAction(
  279. table ,
  280. columnType,
  281. missingSchAction) : null;
  282. if (col != null) {
  283. // if the column is not in the table - add it.
  284. if (table.Columns.IndexOf(col) == -1) {
  285. if (missingSchAction == MissingSchemaAction.Add
  286. || missingSchAction == MissingSchemaAction.AddWithKey)
  287. table.Columns.Add(col);
  288. int[] tmp = new int[mapping.Length + 1];
  289. Array.Copy(mapping,0,tmp,0,col.Ordinal);
  290. Array.Copy(mapping,col.Ordinal,tmp,col.Ordinal + 1,mapping.Length - col.Ordinal);
  291. mapping = tmp;
  292. }
  293. if (missingSchAction == MissingSchemaAction.AddWithKey) {
  294. object value = (AllowDBNullCol != null) ? schemaRow[AllowDBNullCol] : null;
  295. bool allowDBNull = value is bool ? (bool)value : true;
  296. value = (IsKeyCol != null) ? schemaRow[IsKeyCol] : null;
  297. bool isKey = value is bool ? (bool)value : false;
  298. value = (IsAutoIncrementCol != null) ? schemaRow[IsAutoIncrementCol] : null;
  299. bool isAutoIncrement = value is bool ? (bool)value : false;
  300. value = (IsReadOnlyCol != null) ? schemaRow[IsReadOnlyCol] : null;
  301. bool isReadOnly = value is bool ? (bool)value : false;
  302. value = (IsUniqueCol != null) ? schemaRow[IsUniqueCol] : null;
  303. bool isUnique = value is bool ? (bool)value : false;
  304. col.AllowDBNull = allowDBNull;
  305. // fill woth key info
  306. if (isAutoIncrement && DataColumn.CanAutoIncrement(columnType)) {
  307. col.AutoIncrement = true;
  308. if (!allowDBNull)
  309. col.AllowDBNull = false;
  310. }
  311. if (columnType == DbTypes.TypeOfString) {
  312. col.MaxLength = (ColumnSizeCol != null) ? (int)schemaRow[ColumnSizeCol] : 0;
  313. }
  314. if (isReadOnly)
  315. col.ReadOnly = true;
  316. if (!allowDBNull && (!isReadOnly || isKey))
  317. col.AllowDBNull = false;
  318. if (isUnique && !isKey && !columnType.IsArray) {
  319. col.Unique = true;
  320. if (!allowDBNull)
  321. col.AllowDBNull = false;
  322. }
  323. // This might not be set by all DataProviders
  324. bool isHidden = false;
  325. if (schemaTable.Columns.Contains ("IsHidden")) {
  326. value = schemaRow["IsHidden"];
  327. isHidden = ((value is bool) ? (bool)value : false);
  328. }
  329. if (isKey && !isHidden) {
  330. primaryKey.Add (col);
  331. if (allowDBNull)
  332. createPrimaryKey = false;
  333. }
  334. }
  335. // add the ordinal of the column as a key and the index of the column in the datareader as a value.
  336. mapping[col.Ordinal] = readerIndex++;
  337. }
  338. }
  339. }
  340. }
  341. if (primaryKey.Count > 0) {
  342. DataColumn[] colKey = (DataColumn[])(primaryKey.ToArray(typeof (DataColumn)));
  343. if (createPrimaryKey)
  344. table.PrimaryKey = colKey;
  345. else {
  346. UniqueConstraint uConstraint = new UniqueConstraint(colKey);
  347. for (int i = 0; i < table.Constraints.Count; i++) {
  348. if (table.Constraints[i].Equals(uConstraint)) {
  349. uConstraint = null;
  350. break;
  351. }
  352. }
  353. if (uConstraint != null)
  354. table.Constraints.Add(uConstraint);
  355. }
  356. }
  357. return mapping;
  358. }
  359. internal bool FillTable (DataTable dataTable, IDataReader dataReader, int startRecord, int maxRecords, ref int counter)
  360. {
  361. if (dataReader.FieldCount == 0)
  362. return false;
  363. int counterStart = counter;
  364. int[] mapping = BuildSchema (dataReader, dataTable, SchemaType.Mapped);
  365. int [] sortedMapping = new int [mapping.Length];
  366. int length = sortedMapping.Length;
  367. for (int i = 0; i < sortedMapping.Length; i++) {
  368. if (mapping [i] >= 0)
  369. sortedMapping [mapping [i]] = i;
  370. else
  371. sortedMapping [--length] = i;
  372. }
  373. for (int i = 0; i < startRecord; i++) {
  374. dataReader.Read ();
  375. }
  376. dataTable.BeginLoadData ();
  377. while (dataReader.Read () && (maxRecords == 0 || (counter - counterStart) < maxRecords)) {
  378. try {
  379. dataTable.LoadDataRow (dataReader, sortedMapping, length, AcceptChangesDuringFill);
  380. counter++;
  381. }
  382. catch (Exception e) {
  383. object[] readerArray = new object [dataReader.FieldCount];
  384. object[] tableArray = new object [mapping.Length];
  385. // we get the values from the datareader
  386. dataReader.GetValues (readerArray);
  387. // copy from datareader columns to table columns according to given mapping
  388. for (int i = 0; i < mapping.Length; i++) {
  389. if (mapping [i] >= 0) {
  390. tableArray [i] = readerArray [mapping [i]];
  391. }
  392. }
  393. FillErrorEventArgs args = CreateFillErrorEvent (dataTable, tableArray, e);
  394. OnFillErrorInternal (args);
  395. // if args.Continue is not set to true or if a handler is not set, rethrow the error..
  396. if(!args.Continue)
  397. throw e;
  398. }
  399. }
  400. dataTable.EndLoadData ();
  401. return true;
  402. }
  403. internal virtual void OnFillErrorInternal (FillErrorEventArgs value)
  404. {
  405. #if NET_2_0
  406. OnFillError (value);
  407. #endif
  408. }
  409. internal FillErrorEventArgs CreateFillErrorEvent (DataTable dataTable, object[] values, Exception e)
  410. {
  411. FillErrorEventArgs args = new FillErrorEventArgs (dataTable, values);
  412. args.Errors = e;
  413. args.Continue = false;
  414. return args;
  415. }
  416. internal string SetupSchema (SchemaType schemaType, string sourceTableName)
  417. {
  418. DataTableMapping tableMapping = null;
  419. if (schemaType == SchemaType.Mapped) {
  420. tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, sourceTableName, sourceTableName, MissingMappingAction);
  421. if (tableMapping != null)
  422. return tableMapping.DataSetTable;
  423. return null;
  424. } else
  425. return sourceTableName;
  426. }
  427. internal int FillInternal (DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords)
  428. {
  429. if (dataSet == null)
  430. throw new ArgumentNullException ("DataSet");
  431. if (startRecord < 0)
  432. throw new ArgumentException ("The startRecord parameter was less than 0.");
  433. if (maxRecords < 0)
  434. throw new ArgumentException ("The maxRecords parameter was less than 0.");
  435. DataTable dataTable = null;
  436. int resultIndex = 0;
  437. int count = 0;
  438. try {
  439. string tableName = srcTable;
  440. do {
  441. // Non-resultset queries like insert, delete or update aren't processed.
  442. if (dataReader.FieldCount != -1) {
  443. tableName = SetupSchema (SchemaType.Mapped, tableName);
  444. if (tableName != null) {
  445. // check if the table exists in the dataset
  446. if (dataSet.Tables.Contains (tableName))
  447. // get the table from the dataset
  448. dataTable = dataSet.Tables [tableName];
  449. else {
  450. // Do not create schema if MissingSchemAction is set to Ignore
  451. if (this.MissingSchemaAction == MissingSchemaAction.Ignore)
  452. continue;
  453. dataTable = dataSet.Tables.Add (tableName);
  454. }
  455. if (!FillTable (dataTable, dataReader, startRecord, maxRecords, ref count))
  456. continue;
  457. tableName = String.Format ("{0}{1}", srcTable, ++resultIndex);
  458. startRecord = 0;
  459. maxRecords = 0;
  460. }
  461. }
  462. } while (dataReader.NextResult ());
  463. } finally {
  464. dataReader.Close ();
  465. }
  466. return count;
  467. }
  468. #if NET_2_0
  469. public virtual int Fill (DataSet dataSet)
  470. {
  471. throw new NotSupportedException();
  472. }
  473. protected virtual int Fill (DataTable dataTable, IDataReader dataReader)
  474. {
  475. return FillInternal (dataTable, dataReader);
  476. }
  477. protected virtual int Fill (DataTable[] dataTables, IDataReader dataReader, int startRecord, int maxRecords)
  478. {
  479. int count = 0;
  480. if (dataReader.IsClosed)
  481. return 0;
  482. if (startRecord < 0)
  483. throw new ArgumentException ("The startRecord parameter was less than 0.");
  484. if (maxRecords < 0)
  485. throw new ArgumentException ("The maxRecords parameter was less than 0.");
  486. try {
  487. foreach (DataTable dataTable in dataTables) {
  488. string tableName = SetupSchema (SchemaType.Mapped, dataTable.TableName);
  489. if (tableName != null) {
  490. dataTable.TableName = tableName;
  491. FillTable (dataTable, dataReader, 0, 0, ref count);
  492. }
  493. }
  494. } finally {
  495. dataReader.Close ();
  496. }
  497. return count;
  498. }
  499. protected virtual int Fill (DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords)
  500. {
  501. return FillInternal (dataSet, srcTable, dataReader, startRecord, maxRecords);
  502. }
  503. [MonoTODO]
  504. protected virtual DataTable FillSchema (DataTable dataTable, SchemaType schemaType, IDataReader dataReader)
  505. {
  506. throw new NotImplementedException ();
  507. }
  508. [MonoTODO]
  509. protected virtual DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType, string srcTable, IDataReader dataReader)
  510. {
  511. throw new NotImplementedException ();
  512. }
  513. public virtual DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType)
  514. {
  515. throw new NotSupportedException ();
  516. }
  517. [MonoTODO]
  518. [EditorBrowsable (EditorBrowsableState.Advanced)]
  519. public virtual IDataParameter[] GetFillParameters ()
  520. {
  521. throw new NotImplementedException ();
  522. }
  523. protected bool HasTableMappings ()
  524. {
  525. return (TableMappings.Count != 0);
  526. }
  527. protected virtual void OnFillError (FillErrorEventArgs value)
  528. {
  529. if (FillError != null)
  530. FillError (this, value);
  531. }
  532. [EditorBrowsable (EditorBrowsableState.Never)]
  533. public void ResetFillLoadOption ()
  534. {
  535. //FIXME: what else ??
  536. FillLoadOption = LoadOption.OverwriteChanges;
  537. }
  538. [EditorBrowsable (EditorBrowsableState.Never)]
  539. public virtual bool ShouldSerializeAcceptChangesDuringFill ()
  540. {
  541. return true;
  542. }
  543. [EditorBrowsable (EditorBrowsableState.Never)]
  544. public virtual bool ShouldSerializeFillLoadOption ()
  545. {
  546. return false;
  547. }
  548. [MonoTODO]
  549. public virtual int Update (DataSet dataSet)
  550. {
  551. throw new NotImplementedException ();
  552. }
  553. #else
  554. public abstract int Fill (DataSet dataSet);
  555. public abstract DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType);
  556. public abstract IDataParameter[] GetFillParameters ();
  557. public abstract int Update (DataSet dataSet);
  558. #endif
  559. #endregion
  560. }
  561. }