public SybaseDataProvider(string name) : base(name, MappingSchemaInstance.Get(name), SybaseProviderAdapter.GetInstance(name)) { SqlProviderFlags.AcceptsTakeAsParameter = false; SqlProviderFlags.IsSkipSupported = false; SqlProviderFlags.IsSubQueryTakeSupported = false; //SqlProviderFlags.IsCountSubQuerySupported = false; SqlProviderFlags.CanCombineParameters = false; SqlProviderFlags.IsSybaseBuggyGroupBy = true; SqlProviderFlags.IsCrossJoinSupported = false; SqlProviderFlags.IsSubQueryOrderBySupported = false; SqlProviderFlags.IsDistinctOrderBySupported = false; SqlProviderFlags.IsDistinctSetOperationsSupported = false; SqlProviderFlags.IsGroupByExpressionSupported = false; SetCharField("char", (r, i) => r.GetString(i).TrimEnd(' ')); SetCharField("nchar", (r, i) => r.GetString(i).TrimEnd(' ')); SetCharFieldToType <char>("char", DataTools.GetCharExpression); SetCharFieldToType <char>("nchar", DataTools.GetCharExpression); SetProviderField <IDataReader, TimeSpan, DateTime>((r, i) => r.GetDateTime(i) - new DateTime(1900, 1, 1)); SetField <IDataReader, DateTime>("time", (r, i) => GetDateTimeAsTime(r.GetDateTime(i))); _sqlOptimizer = new SybaseSqlOptimizer(SqlProviderFlags); }
/// <summary> /// Creates the specified SQLite provider based on the provider name. /// </summary> /// <param name="name">If ProviderName.SQLite is provided, /// the detection mechanism preferring System.Data.SQLite /// to Microsoft.Data.Sqlite will be used.</param> public SQLiteDataProvider(string name) : this(name, MappingSchemaInstance.Get(name)) { }
public SqlServerDataProvider(string name, SqlServerVersion version, SqlServerProvider provider) : base( name, MappingSchemaInstance.Get(version), SqlServerProviderAdapter.GetInstance(provider)) { Version = version; Provider = provider; SqlProviderFlags.IsDistinctOrderBySupported = false; SqlProviderFlags.IsSubQueryOrderBySupported = false; SqlProviderFlags.IsDistinctSetOperationsSupported = true; SqlProviderFlags.IsCountDistinctSupported = true; SqlProviderFlags.IsUpdateFromSupported = true; if (version == SqlServerVersion.v2000) { SqlProviderFlags.AcceptsTakeAsParameter = false; SqlProviderFlags.IsSkipSupported = false; SqlProviderFlags.IsCountSubQuerySupported = false; } else { SqlProviderFlags.IsApplyJoinSupported = true; SqlProviderFlags.TakeHintsSupported = TakeHints.Percent | TakeHints.WithTies; SqlProviderFlags.IsCommonTableExpressionsSupported = version >= SqlServerVersion.v2008; } SetCharField("char", (r, i) => r.GetString(i).TrimEnd(' ')); SetCharField("nchar", (r, i) => r.GetString(i).TrimEnd(' ')); SetCharFieldToType <char>("char", DataTools.GetCharExpression); SetCharFieldToType <char>("nchar", DataTools.GetCharExpression); _sqlOptimizer = version switch { SqlServerVersion.v2000 => new SqlServer2000SqlOptimizer(SqlProviderFlags), SqlServerVersion.v2005 => new SqlServer2005SqlOptimizer(SqlProviderFlags), SqlServerVersion.v2012 => new SqlServer2012SqlOptimizer(SqlProviderFlags), SqlServerVersion.v2016 => new SqlServer2016SqlOptimizer(SqlProviderFlags), SqlServerVersion.v2017 => new SqlServer2017SqlOptimizer(SqlProviderFlags), _ => new SqlServer2008SqlOptimizer(SqlProviderFlags), }; // missing: // GetSqlBytes // GetSqlChars SetProviderField <SqlBinary, SqlBinary>(SqlTypes.GetSqlBinaryReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlBoolean, SqlBoolean>(SqlTypes.GetSqlBooleanReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlByte, SqlByte>(SqlTypes.GetSqlByteReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlDateTime, SqlDateTime>(SqlTypes.GetSqlDateTimeReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlDecimal, SqlDecimal>(SqlTypes.GetSqlDecimalReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlDouble, SqlDouble>(SqlTypes.GetSqlDoubleReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlGuid, SqlGuid>(SqlTypes.GetSqlGuidReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlInt16, SqlInt16>(SqlTypes.GetSqlInt16ReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlInt32, SqlInt32>(SqlTypes.GetSqlInt32ReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlInt64, SqlInt64>(SqlTypes.GetSqlInt64ReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlMoney, SqlMoney>(SqlTypes.GetSqlMoneyReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlSingle, SqlSingle>(SqlTypes.GetSqlSingleReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlString, SqlString>(SqlTypes.GetSqlStringReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <SqlXml, SqlXml>(Adapter.GetSqlXmlReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <DateTimeOffset>(Adapter.GetDateTimeOffsetReaderMethod, dataReaderType: Adapter.DataReaderType); SetProviderField <TimeSpan> (Adapter.GetTimeSpanReaderMethod, dataReaderType: Adapter.DataReaderType); // non-specific fallback SetProviderField <IDataReader, SqlString, SqlString>((r, i) => r.GetString(i)); SqlServerTypes.Configure(this); }