public DB2iSeriesProviderOptions(string providerName, DB2iSeriesProviderType providerType, DB2iSeriesVersion version)
     : this(providerName, providerType)
 {
     SupportsOffsetClause   = version > DB2iSeriesVersion.V7_2;
     SupportsTruncateTable  = version > DB2iSeriesVersion.V7_1 && !providerType.IsOdbc();
     SupportsMergeStatement = version >= DB2iSeriesVersion.V7_1;
     SupportsNCharTypes     = version >= DB2iSeriesVersion.V7_1;
 }
Exemple #2
0
 public DB2iSeriesSqlProviderFlags(
     DB2iSeriesVersion version,
     DB2iSeriesProviderType providerType)
     : this(
         supportsOffsetClause : version >= DB2iSeriesVersion.V7_3,
         supportsTruncateTable : version >= DB2iSeriesVersion.V7_2 && !providerType.IsOdbc(),
         supportsNamedParameters : providerType.IsIBM(),
         supportsMergeStatement : version >= DB2iSeriesVersion.V7_1,
         supportsNCharTypes : version >= DB2iSeriesVersion.V7_1
         )
 {
 }
        /// <summary>
        /// Build a DB2 iSeries data provider.
        /// </summary>
        /// <param name="providerOptions">The provider's construction options, see <see cref="DB2iSeriesProviderOptions"/></param>
        public DB2iSeriesDataProvider(DB2iSeriesProviderOptions providerOptions)
            : base(
                providerOptions.ProviderName,
                GetMappingSchema(
                    providerOptions.ProviderName,
                    providerOptions.ProviderType,
                    providerOptions.MapGuidAsString),
                DB2iSeriesProviderAdapter.GetInstance(providerOptions.ProviderType))
        {
            this.db2iSeriesSqlProviderFlags = new DB2iSeriesSqlProviderFlags(providerOptions);
            this.mappingOptions             = new DB2iSeriesMappingOptions(providerOptions);
            this.ProviderType = providerOptions.ProviderType;

            DB2iSeriesLoadExpressions.SetupExpressions(providerOptions.ProviderName, mappingOptions.MapGuidAsString);

            SqlProviderFlags.AcceptsTakeAsParameter            = false;
            SqlProviderFlags.AcceptsTakeAsParameterIfSkip      = true;
            SqlProviderFlags.IsDistinctOrderBySupported        = false;
            SqlProviderFlags.CanCombineParameters              = false;
            SqlProviderFlags.IsCommonTableExpressionsSupported = true;
            SqlProviderFlags.IsUpdateFromSupported             = false;

            db2iSeriesSqlProviderFlags.SetCustomFlags(SqlProviderFlags);
            mappingOptions.SetCustomFlags(SqlProviderFlags);

            SetCharField(Constants.DbTypes.Char, (r, i) => r.GetString(i).TrimEnd(' '));
            SetCharField(Constants.DbTypes.NChar, (r, i) => r.GetString(i).TrimEnd(' '));
            SetCharField(Constants.DbTypes.Graphic, (r, i) => r.GetString(i).TrimEnd(' '));

            sqlOptimizer   = new DB2iSeriesSqlOptimizer(SqlProviderFlags, db2iSeriesSqlProviderFlags);
            schemaProvider = new DB2iSeriesSchemaProvider(this);
            bulkCopy       = new DB2iSeriesBulkCopy(this);

            if (ProviderType.IsOdbc())
            {
                SetupOdbc();
            }
            else if (ProviderType.IsOleDb())
            {
                SetupOleDb();
            }
#if NETFRAMEWORK
            else if (ProviderType.IsAccessClient())
            {
                SetupAccessClient();
            }
#endif
            else if (ProviderType.IsDB2())
            {
                SetupDB2Connect();
            }
        }