public override char GetParameterToken(char token, string context) { if (TestProvNameDb2i.IsiSeriesOleDb(context) || TestProvNameDb2i.IsiSeriesODBC(context)) { return('?'); } else { return('@'); } }
/// <summary> /// Returns database name for provided connection. /// Returns UNUSED_DB if fully-qualified table name doesn't support database name. /// </summary> public static string GetDatabaseName(IDataContext db) { switch (TestProvNameDb2i.GetFamily(GetContextName(db))) { case ProviderName.SQLiteClassic: case TestProvName.SQLiteClassicMiniProfilerMapped: case TestProvName.SQLiteClassicMiniProfilerUnmapped: case ProviderName.SQLiteMS: return("main"); case ProviderName.Access: case ProviderName.AccessOdbc: return("Database\\TestData"); case ProviderName.MySql: case ProviderName.MySqlConnector: case TestProvName.MariaDB: case TestProvName.MySql55: case ProviderName.PostgreSQL: case ProviderName.PostgreSQL92: case ProviderName.PostgreSQL93: case ProviderName.PostgreSQL95: case TestProvName.PostgreSQL10: case TestProvName.PostgreSQL11: case TestProvName.PostgreSQL12: case TestProvName.PostgreSQL13: case ProviderName.DB2: case TestProvNameDb2i.DB2iBase: case ProviderName.Sybase: case ProviderName.SybaseManaged: case ProviderName.SqlServer2000: case ProviderName.SqlServer2005: case ProviderName.SqlServer2008: case ProviderName.SqlServer2012: case ProviderName.SqlServer2014: case TestProvName.SqlServer2016: case ProviderName.SqlServer2017: case TestProvName.SqlServer2019: case TestProvName.SqlAzure: return(db.GetTable <LinqDataTypes>().Select(_ => DbName()).First()); case ProviderName.Informix: case ProviderName.InformixDB2: return(db.GetTable <LinqDataTypes>().Select(_ => DbInfo("dbname")).First()); } return(NO_DATABASE_NAME); }
public override IEnumerable <string> InterceptTestDataSources(DataSourcesBaseAttribute dataSourcesAttribute, IMethodInfo testMethod, IEnumerable <string> contexts) { var test = ExtractMethod(testMethod); //Filter out specific tests switch (ExtractMethod(testMethod)) { //Test targets DB2 provider case ("SchemaProviderTests", "DB2Test"): //Tests have internal logic based on BulkCopyType - Copied to custom tests case ("BulkCopyTests", "KeepIdentity_SkipOnInsertTrue"): case ("BulkCopyTests", "KeepIdentity_SkipOnInsertFalse"): //Tests have property have space - Copied to custom tests case ("DynamicColumnsTests", "SqlPropertyNoStoreNonIdentifier"): case ("DynamicColumnsTests", "SqlPropertyNoStoreNonIdentifierGrouping"): //Test copied to custom to reduce default source row number case ("MergeTests", "BigSource"): //Tests passing provider specific parameter types - Generic linq2db test - Not applicable case ("MergeTests", "TestParametersInListSourceProperty"): //Tests active issue with DB2 family ordering NULL last by default - Not applicable case ("MergeTests", "SortedMergeResultsIssue"): //Too many cases in code - Copied to custom tests case ("CharTypesTests", _): //Too many changes and cases - Copied to custom tests case ("MergeTests", "TestTypesInsertByMerge"): case ("MergeTests", "TestMergeTypes"): case ("MergeTests", "TestDB2NullsInSource"): //Case valid for DB2 but not for DB2i case ("Issue792Tests", "TestWithTransactionThrowsFromProvider"): //Data not valid for DB2i case ("Issue1287Tests", _): //Query contains invalid keyword permission case ("Issue825Tests", "Test"): return(Enumerable.Empty <string>()); //Access client throws a different exception so it is excluded case ("DataContextTests", "ProviderConnectionStringConstructorTest2"): return(contexts.Except(TestProvNameDb2i.GetProviders(TestProvNameDb2i.All_AccessClient))); } return(contexts); }
/// <summary> /// Returns schema name for provided connection. /// Returns UNUSED_SCHEMA if fully-qualified table name doesn't support database name. /// </summary> public static string GetSchemaName(IDataContext db) { switch (TestProvNameDb2i.GetFamily(GetContextName(db))) { case ProviderName.Informix: case ProviderName.InformixDB2: case ProviderName.Oracle: case ProviderName.OracleNative: case ProviderName.OracleManaged: case TestProvName.Oracle11Native: case TestProvName.Oracle11Managed: case ProviderName.PostgreSQL: case ProviderName.PostgreSQL92: case ProviderName.PostgreSQL93: case ProviderName.PostgreSQL95: case TestProvName.PostgreSQL10: case TestProvName.PostgreSQL11: case TestProvName.PostgreSQL12: case TestProvName.PostgreSQL13: case ProviderName.DB2: case TestProvNameDb2i.DB2iBase: case ProviderName.Sybase: case ProviderName.SybaseManaged: case ProviderName.SqlServer2005: case ProviderName.SqlServer2008: case ProviderName.SqlServer2012: case ProviderName.SqlServer2014: case TestProvName.SqlServer2016: case ProviderName.SqlServer2017: case TestProvName.SqlServer2019: case TestProvName.SqlAzure: case ProviderName.SapHanaNative: case ProviderName.SapHanaOdbc: return(db.GetTable <LinqDataTypes>().Select(_ => SchemaName()).First()); case ProviderName.SqlServer2000: return(db.FromSql <string>($"SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = {nameof(LinqDataTypes)}").First()); } return(NO_SCHEMA_NAME); }
public override IEnumerable <string> GetSupportedProviders(IEnumerable <string> providers) { return(TestProvNameDb2i.GetAll()); }
public override IEnumerable <string> InterceptDataSources(DataSourcesBaseAttribute dataSourcesAttribute, IEnumerable <string> contexts) { return(contexts.Concat(TestProvNameDb2i.GetProviders(contexts))); }