You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@@ -48,13 +48,13 @@ namespace MonoTests.System.Data.Connected
|
||||
private static ConnectionManager instance;
|
||||
private ConnectionHolder<SqlConnection> sql;
|
||||
|
||||
private const string OdbcEnvVar = "SYSTEM_DATA_ODBC";
|
||||
private const string SqlEnvVar = "SYSTEM_DATA_MSSQL";
|
||||
private const string OdbcEnvVar = "SYSTEM_DATA_ODBC_V2";
|
||||
private const string SqlEnvVar = "SYSTEM_DATA_MSSQL_V2";
|
||||
|
||||
private ConnectionManager ()
|
||||
{
|
||||
//Environment.SetEnvironmentVariable(OdbcEnvVar, @"Driver={MySQL ODBC 5.3 Unicode Driver};server=127.0.0.1;uid=sa;pwd=qwerty123;";
|
||||
//Environment.SetEnvironmentVariable(SqlEnvVar, @"server=127.0.0.1;database=master;user id=sa;password=qwerty123";
|
||||
//Environment.SetEnvironmentVariable(OdbcEnvVar, @"Driver={MySQL ODBC 5.3 Unicode Driver};server=127.0.0.1;uid=sa;pwd=qwerty123;");
|
||||
//Environment.SetEnvironmentVariable(SqlEnvVar, @"server=127.0.0.1;database=master;user id=sa;password=qwerty123");
|
||||
|
||||
// Generate a random db name
|
||||
DatabaseName = "monotest" + Guid.NewGuid().ToString().Substring(0, 7);
|
||||
@@ -122,7 +122,8 @@ namespace MonoTests.System.Data.Connected
|
||||
private void CreateMssqlDatabase()
|
||||
{
|
||||
DBHelper.ExecuteNonQuery(sql.Connection, $"CREATE DATABASE [{DatabaseName}]");
|
||||
sql.Connection.ChangeDatabase(DatabaseName);
|
||||
sql.ConnectionString = sql.ConnectionString.Replace(sql.Connection.Database, DatabaseName);
|
||||
sql.CloseConnection();
|
||||
|
||||
string query = File.ReadAllText(@"Test/ProviderTests/sql/sqlserver.sql");
|
||||
|
||||
@@ -247,5 +248,7 @@ namespace MonoTests.System.Data.Connected
|
||||
this.connection = connection;
|
||||
ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
public bool IsAzure => ConnectionString.ToLower().Contains("database.windows.net");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace MonoTests.System.Data.Connected
|
||||
IDbCommand command = connection.CreateCommand ();
|
||||
command.CommandType = CommandType.Text;
|
||||
command.CommandText = query;
|
||||
command.CommandTimeout = 120;
|
||||
int result = -1;
|
||||
try {
|
||||
result = command.ExecuteNonQuery ();
|
||||
|
||||
@@ -788,6 +788,7 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
// FIXME: Add test for ContinueUpdateOnError property
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void CheckParameters_BuiltCommand ()
|
||||
{
|
||||
SqlDataAdapter adapter = new SqlDataAdapter ("select id,type_varchar from string_family", conn);
|
||||
@@ -813,6 +814,7 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void DeriveParameters ()
|
||||
{
|
||||
SqlCommand cmd = null;
|
||||
|
||||
@@ -1438,6 +1438,7 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
}
|
||||
|
||||
[Test] // bug #319598
|
||||
[Category("NotWorking")]
|
||||
public void LongQueryTest ()
|
||||
{
|
||||
if (ClientVersion == 7)
|
||||
|
||||
@@ -288,15 +288,27 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
[Test]
|
||||
public void ChangeDatabase ()
|
||||
{
|
||||
conn = new SqlConnection (connectionString);
|
||||
conn.Open ();
|
||||
conn.ChangeDatabase ("master");
|
||||
Assert.AreEqual ("master", conn.Database);
|
||||
conn = new SqlConnection(connectionString);
|
||||
conn.Open();
|
||||
|
||||
if (ConnectionManager.Instance.Sql.IsAzure)
|
||||
{
|
||||
var exc = Assert.Throws<SqlException>(() => conn.ChangeDatabase("master"));
|
||||
Assert.Equals(40508, exc.Number); //USE statement is not supported to switch between databases (Azure).
|
||||
}
|
||||
else
|
||||
{
|
||||
conn.ChangeDatabase("master");
|
||||
Assert.AreEqual("master", conn.Database);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangeDatabase_DatabaseName_DoesNotExist ()
|
||||
{
|
||||
if (ConnectionManager.Instance.Sql.IsAzure)
|
||||
Assert.Ignore("SQL Azure doesn't support 'ChangeDatabase'");
|
||||
|
||||
conn = new SqlConnection (connectionString);
|
||||
conn.Open ();
|
||||
|
||||
@@ -385,6 +397,7 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void ClearAllPools ()
|
||||
{
|
||||
SqlConnection conn1 = new SqlConnection (connectionString + ";Pooling=false");
|
||||
@@ -668,6 +681,9 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
[Test]
|
||||
public void Database ()
|
||||
{
|
||||
if (ConnectionManager.Instance.Sql.IsAzure)
|
||||
Assert.Ignore("SQL Azure doesn't support 'use [db]'");
|
||||
|
||||
conn = new SqlConnection (connectionString);
|
||||
string database = conn.Database;
|
||||
|
||||
@@ -830,6 +846,9 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
[Test]
|
||||
public void GetSchemaTest1()
|
||||
{
|
||||
if (ConnectionManager.Instance.Sql.IsAzure)
|
||||
Assert.Ignore("SQL Azure - Not supported'");
|
||||
|
||||
bool flag = false;
|
||||
DataTable tab1 = conn.GetSchema("databases");
|
||||
foreach (DataRow row in tab1.Rows)
|
||||
@@ -1004,6 +1023,9 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
[Test]
|
||||
public void GetSchemaTest9()
|
||||
{
|
||||
if (ConnectionManager.Instance.Sql.IsAzure)
|
||||
Assert.Ignore("SQL Azure - Not supported'");
|
||||
|
||||
bool flag = false;
|
||||
DataTable tab1 = conn.GetSchema("Columns");
|
||||
foreach (DataRow row in tab1.Rows)
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
}
|
||||
|
||||
[Test] // bug #324840
|
||||
[Category("NotWorking")]
|
||||
public void ParameterSizeTest ()
|
||||
{
|
||||
if (ClientVersion == 7)
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace MonoTests.System.Data.Connected.SqlClient
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void Commit ()
|
||||
{
|
||||
if (RunningOnMono)
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
../../../external/corefx/src/Common/src/System/Data/Common/DbConnectionPoolKey.cs
|
||||
../../../external/corefx/src/Common/src/System/Data/Common/MultipartIdentifier.cs
|
||||
../../../external/corefx/src/Common/src/System/Data/Common/NameValuePair.cs
|
||||
../../../external/corefx/src/Common/src/System/Data/Common/SQLResource.cs
|
||||
|
||||
../../../external/corefx/src/System.Data.Common/src/System/HResults.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/AcceptRejectRule.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/AggregateType.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/BaseCollection.cs
|
||||
@@ -24,7 +30,6 @@
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbCommand.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DBCommandBuilder.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnection.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnectionPoolKey.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataAdapter.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataReader.cs
|
||||
@@ -52,8 +57,6 @@
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Int16Storage.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Int32Storage.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Int64Storage.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/MultipartIdentifier.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/NameValuePair.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/ObjectStorage.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/RowUpdatedEventArgs.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/Common/RowUpdatingEventArgs.cs
|
||||
@@ -206,7 +209,6 @@
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLResource.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
|
||||
../../../external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLUtility.cs
|
||||
@@ -221,7 +223,6 @@
|
||||
../../../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
|
||||
@@ -250,7 +251,6 @@
|
||||
../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlError.cs
|
||||
../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlErrorCollection.cs
|
||||
../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInfoMessageEvent.cs
|
||||
../../../external/corefx/src/System.Private.Xml/src/Misc/HResults.cs
|
||||
../referencesource/System.Data/Microsoft/SqlServer/Server/SqlTriggerContext.cs
|
||||
../referencesource/System.Data/Misc/ExternDll.cs
|
||||
../referencesource/System.Data/System/Data/CodeGen/StrongTypingException.cs
|
||||
@@ -292,3 +292,6 @@
|
||||
../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
|
||||
|
||||
91
mcs/class/System.Data/corefx/DBCommandBuilder.cs
Normal file
91
mcs/class/System.Data/corefx/DBCommandBuilder.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
mcs/class/System.Data/corefx/DataView.cs
Normal file
40
mcs/class/System.Data/corefx/DataView.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
namespace System.Data
|
||||
{
|
||||
partial class DataView
|
||||
{
|
||||
/// <summary>
|
||||
/// Allow construction of DataView with <see cref="System.Predicate<DataRow>"/> and <see cref="System.Comparison<DataRow>"/>
|
||||
/// </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);
|
||||
}
|
||||
}
|
||||
}
|
||||
7
mcs/class/System.Data/corefx/DbConnection.cs
Normal file
7
mcs/class/System.Data/corefx/DbConnection.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace System.Data.Common
|
||||
{
|
||||
partial class DbConnection
|
||||
{
|
||||
internal DbProviderFactory ProviderFactory => DbProviderFactory;
|
||||
}
|
||||
}
|
||||
16
mcs/class/System.Data/corefx/FieldNameLookup.cs
Normal file
16
mcs/class/System.Data/corefx/FieldNameLookup.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
mcs/class/System.Data/corefx/Index.cs
Normal file
21
mcs/class/System.Data/corefx/Index.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -63,6 +66,8 @@ System.Data.Common/DbTypes.cs
|
||||
System.Data.Common/ExceptionHelper.cs
|
||||
System.Data.Common/DbConnectionStringBuilderHelper.cs
|
||||
|
||||
../../../external/corefx/src/System.Data.Odbc/src/Common/System/HResults.cs
|
||||
|
||||
../referencesource/System.Data/bid/inc/cs/bidPrivateBase.cs
|
||||
../referencesource/System.Data/Misc/PrivilegedConfigurationManager.cs
|
||||
../referencesource/System.Data/System/Data/CodeGen/datacache.cs
|
||||
|
||||
Reference in New Issue
Block a user