Bump corefx
authorMarek Safar <marek.safar@gmail.com>
Tue, 9 May 2017 15:52:43 +0000 (17:52 +0200)
committerMarek Safar <marek.safar@gmail.com>
Tue, 9 May 2017 20:55:46 +0000 (22:55 +0200)
external/corefx
mcs/class/System.Data/corefx.common.sources
mcs/class/System.Data/corefx/DBCommandBuilder.cs [new file with mode: 0644]
mcs/class/System.Data/corefx/DataView.cs [new file with mode: 0644]
mcs/class/System.Data/corefx/DbConnection.cs [new file with mode: 0644]
mcs/class/System.Data/corefx/FieldNameLookup.cs [new file with mode: 0644]
mcs/class/System.Data/corefx/Index.cs [new file with mode: 0644]
mcs/class/System.Data/corefx/Selection.cs [new file with mode: 0644]
mcs/class/System.Data/net_4_x_System.Data.dll.sources
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs

index 76767209e09be647a5c7e0d272c3f22b87adfd6b..0d81ca28ac43d399124d07f9dd46485c0bf2ab52 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 76767209e09be647a5c7e0d272c3f22b87adfd6b
+Subproject commit 0d81ca28ac43d399124d07f9dd46485c0bf2ab52
index 354c30b591574210c9898f87caadaaa115dd7038..641c59fb00513deaeb30d13d3218603ce1cdbc93 100644 (file)
 ../../../external/corefx/src/System.Data.Common/src/System/Data/UpdateRowSource.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/updatestatus.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/XDRSchema.cs
-../../../external/corefx/src/System.Data.Common/src/System/Data/XmlContent.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/XmlDataLoader.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/XMLDiffLoader.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/XmlKeywords.cs
 ../referencesource/System.Data/System/Data/SqlClient/SqlUtil.cs
 ../referencesource/System.Data/System/Data/SqlClient/TdsEnums.cs
 ../referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs
+
+corefx/DataView.cs
+corefx/Index.cs
diff --git a/mcs/class/System.Data/corefx/DBCommandBuilder.cs b/mcs/class/System.Data/corefx/DBCommandBuilder.cs
new file mode 100644 (file)
index 0000000..98c7776
--- /dev/null
@@ -0,0 +1,91 @@
+namespace System.Data.Common
+{
+       partial class DbCommandBuilder
+       {
+               // open connection is required by OleDb/OdbcCommandBuilder.QuoteIdentifier and UnquoteIdentifier 
+               // to get literals quotes from the driver
+               internal DbConnection GetConnection()
+               {
+                       DbDataAdapter adapter = DataAdapter;
+                       if (adapter != null)
+                       {
+                               DbCommand select = adapter.SelectCommand;
+                               if (select != null)
+                               {
+                                       return select.Connection;
+                               }
+                       }
+
+                       return null;
+               }
+
+        static internal string[] ParseProcedureName(string name, string quotePrefix, string quoteSuffix) {
+            // Procedure may consist of up to four parts:
+            // 0) Server
+            // 1) Catalog
+            // 2) Schema
+            // 3) ProcedureName
+            //
+            // Parse the string into four parts, allowing the last part to contain '.'s.
+            // If less than four period delimited parts, use the parts from procedure backwards.
+            //
+            const string Separator = ".";
+
+            string[] qualifiers = new string[4];
+            if (!ADP.IsEmpty(name)) {
+                bool useQuotes = !ADP.IsEmpty(quotePrefix) && !ADP.IsEmpty(quoteSuffix);
+
+                int currentPos = 0, parts;
+                for(parts = 0; (parts < qualifiers.Length) && (currentPos < name.Length); ++parts) {
+                    int startPos = currentPos;
+
+                    // does the part begin with a quotePrefix?
+                    if (useQuotes && (name.IndexOf(quotePrefix, currentPos, quotePrefix.Length, StringComparison.Ordinal) == currentPos)) {
+                        currentPos += quotePrefix.Length; // move past the quotePrefix
+
+                        // search for the quoteSuffix (or end of string)
+                        while (currentPos < name.Length) {
+                            currentPos = name.IndexOf(quoteSuffix, currentPos, StringComparison.Ordinal);
+                            if (currentPos < 0) {
+                                // error condition, no quoteSuffix
+                                currentPos = name.Length;
+                                break;
+                            }
+                            else {
+                                currentPos += quoteSuffix.Length; // move past the quoteSuffix
+
+                                // is this a double quoteSuffix?
+                                if ((currentPos < name.Length) && (name.IndexOf(quoteSuffix, currentPos, quoteSuffix.Length, StringComparison.Ordinal) == currentPos)) {
+                                    // a second quoteSuffix, continue search for terminating quoteSuffix
+                                    currentPos += quoteSuffix.Length; // move past the second quoteSuffix
+                                }
+                                else {
+                                    // found the terminating quoteSuffix
+                                    break;
+                                }
+                            }
+                        }
+                    }
+
+                    // search for separator (either no quotePrefix or already past quoteSuffix)
+                    if (currentPos < name.Length) {
+                        currentPos = name.IndexOf(Separator, currentPos, StringComparison.Ordinal);
+                        if ((currentPos < 0) || (parts == qualifiers.Length-1)) {
+                            // last part that can be found
+                            currentPos = name.Length;
+                        }
+                    }
+
+                    qualifiers[parts] = name.Substring(startPos, currentPos-startPos);
+                    currentPos += Separator.Length;
+                }
+
+                // allign the qualifiers if we had less than MaxQualifiers
+                for(int j = qualifiers.Length-1; 0 <= j; --j) {
+                    qualifiers[j] = ((0 < parts) ? qualifiers[--parts] : null);
+                }
+            }
+            return qualifiers;
+        }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/corefx/DataView.cs b/mcs/class/System.Data/corefx/DataView.cs
new file mode 100644 (file)
index 0000000..51e4afe
--- /dev/null
@@ -0,0 +1,40 @@
+namespace System.Data
+{
+       partial class DataView
+       {
+        /// <summary>
+        /// Allow construction of DataView with <see cref="System.Predicate&lt;DataRow&gt;"/> and <see cref="System.Comparison&lt;DataRow&gt;"/>
+        /// </summary>
+        /// <remarks>This is a copy of the other DataView ctor and needs to be kept in sync</remarks>
+        internal DataView(DataTable table, System.Predicate<DataRow> predicate, System.Comparison<DataRow> comparison, DataViewRowState RowState) {
+            GC.SuppressFinalize(this);
+            Bid.Trace("<ds.DataView.DataView|API> %d#, table=%d, RowState=%d{ds.DataViewRowState}\n",
+                           ObjectID, (table != null) ? table.ObjectID : 0, (int)RowState);
+            if (table == null)
+                throw ExceptionBuilder.CanNotUse();
+
+            this._dvListener = new DataViewListener(this);
+            this._locked = false;
+            this._table = table;
+            _dvListener.RegisterMetaDataEvents(this._table);
+
+            if ((((int)RowState) &
+                 ((int)~(DataViewRowState.CurrentRows | DataViewRowState.OriginalRows))) != 0) {
+                throw ExceptionBuilder.RecordStateRange();
+            }
+            else if (( ((int)RowState) & ((int)DataViewRowState.ModifiedOriginal) ) != 0 &&
+                     ( ((int)RowState) &  ((int)DataViewRowState.ModifiedCurrent) ) != 0
+                    ) {
+                throw ExceptionBuilder.SetRowStateFilter();
+            }
+            _comparison = comparison;
+            SetIndex2("", RowState, ((null != predicate) ? new RowPredicateFilter(predicate) : null), true);
+        }
+
+               /// <summary>This method exists for LinqDataView to keep a level of abstraction away from the RBTree</summary>
+               internal Range FindRecords<TKey, TRow>(Index.ComparisonBySelector<TKey, TRow> comparison, TKey key) where TRow : DataRow
+               {
+                       return _index.FindRecords(comparison, key);
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/corefx/DbConnection.cs b/mcs/class/System.Data/corefx/DbConnection.cs
new file mode 100644 (file)
index 0000000..d53b1d6
--- /dev/null
@@ -0,0 +1,7 @@
+namespace System.Data.Common
+{
+       partial class DbConnection
+       {
+               internal DbProviderFactory ProviderFactory => DbProviderFactory;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/corefx/FieldNameLookup.cs b/mcs/class/System.Data/corefx/FieldNameLookup.cs
new file mode 100644 (file)
index 0000000..80c5925
--- /dev/null
@@ -0,0 +1,16 @@
+namespace System.Data.ProviderBase
+{
+       partial class FieldNameLookup
+       {
+               public int IndexOfName(string fieldName)
+               {
+                       if (null == _fieldNameLookup)
+                       {
+                               GenerateLookup();
+                       }
+                       // via case sensitive search, first match with lowest ordinal matches
+                       object value = _fieldNameLookup[fieldName];
+                       return ((null != value) ? (int)value : -1);
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/corefx/Index.cs b/mcs/class/System.Data/corefx/Index.cs
new file mode 100644 (file)
index 0000000..7d6a3be
--- /dev/null
@@ -0,0 +1,21 @@
+namespace System.Data
+{
+       partial class Index
+       {
+               internal delegate int ComparisonBySelector<TKey,TRow>(TKey key, TRow row) where TRow:DataRow;
+
+               /// <summary>This method exists for LinqDataView to keep a level of abstraction away from the RBTree</summary>
+               internal Range FindRecords<TKey,TRow>(ComparisonBySelector<TKey,TRow> comparison, TKey key) where TRow:DataRow
+               {
+                       int x = _records.root;
+                       while (IndexTree.NIL != x)
+                       {
+                               int c = comparison(key, (TRow)_table._recordManager[_records.Key(x)]);
+                               if (c == 0) { break; }
+                               if (c < 0) { x = _records.Left(x); }
+                               else { x = _records.Right(x); }
+                       }
+                       return GetRangeFromNode(x);
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/corefx/Selection.cs b/mcs/class/System.Data/corefx/Selection.cs
new file mode 100644 (file)
index 0000000..e69de29
index 47d88bda4c53cbd45ef6d845357b3be6e576b684..755a08f5d52c0e65cdb4f86850fdb657d40708bf 100644 (file)
@@ -16,6 +16,9 @@ ReferenceSources/Win32NativeMethods.cs
 ReferenceSources/SqlInternalConnectionTds.cs
 
 corefx/SR.cs
+corefx/DBCommandBuilder.cs
+corefx/FieldNameLookup.cs
+corefx/DbConnection.cs
 
 Microsoft.SqlServer.Server/SqlDataRecord.cs
 Microsoft.SqlServer.Server/SqlMetaData.cs
index 835b18d97a6e88b9b947df7f61f9c7be4df5f1ff..b62c2e9c275d66cf051452ebee69c045b03c7be5 100644 (file)
@@ -304,11 +304,15 @@ namespace System.Data.ProviderBase {
 #endif
                 }
                 else {
+#if !MONO
+                    // DBConnection::ForceNewConnection is never set
                     if (owningConnection.ForceNewConnection) {
                         Debug.Assert(!(oldConnection is DbConnectionClosed), "Force new connection, but there is no old connection");
                         connection = connectionPool.ReplaceConnection(owningConnection, userOptions, oldConnection);
                     }
-                    else {
+                    else
+#endif
+                    {
                         if (!connectionPool.TryGetConnection(owningConnection, retry, userOptions, out connection)) {
                             return false;
                         }