コード例 #1
0
        // Constructors

        public SqlExecutor(StorageDriver driver, SqlConnection connection)
        {
            ArgumentValidator.EnsureArgumentNotNull(driver, "driver");
            ArgumentValidator.EnsureArgumentNotNull(connection, "connection");
            this.driver     = driver;
            this.connection = connection;
        }
コード例 #2
0
 protected QueryRequest CreateQueryRequest(StorageDriver driver, SqlSelect statement, IEnumerable <QueryParameterBinding> parameterBindings,
                                           TupleDescriptor tupleDescriptor, QueryRequestOptions options)
 {
     if (Handlers.Domain.Configuration.ShareStorageSchemaOverNodes)
     {
         return(new QueryRequest(driver, statement, parameterBindings, tupleDescriptor, options, NodeConfiguration));
     }
     return(new QueryRequest(driver, statement, parameterBindings, tupleDescriptor, options));
 }
コード例 #3
0
        // Constructors

        public CommandFactory(StorageDriver driver, Session session, SqlConnection connection)
        {
            ArgumentValidator.EnsureArgumentNotNull(driver, "driver");
            ArgumentValidator.EnsureArgumentNotNull(session, "session");
            ArgumentValidator.EnsureArgumentNotNull(connection, "connection");

            Driver     = driver;
            Session    = session;
            Connection = connection;

            emptyStringIsNull = driver.ProviderInfo.Supports(ProviderFeatures.TreatEmptyStringAsNull);
        }
コード例 #4
0
        internal SqlSessionHandler(Session session, SqlConnection connection, bool connectionIsExternal, bool transactionIsExternal)
            : base(session)
        {
            this.connection            = connection;
            this.connectionIsExternal  = connectionIsExternal;
            this.transactionIsExternal = transactionIsExternal;

            domainHandler = Handlers.DomainHandler;
            driver        = Handlers.StorageDriver;

            commandProcessor = domainHandler.CommandProcessorFactory.CreateCommandProcessor(Session, connection);
            prefetchManager  = new PrefetchManager(Session);
        }
コード例 #5
0
        // Constructors

        public QueryRequest(
            StorageDriver driver, SqlSelect statement, IEnumerable <QueryParameterBinding> parameterBindings,
            TupleDescriptor tupleDescriptor, QueryRequestOptions options)
        {
            ArgumentValidator.EnsureArgumentNotNull(driver, "driver");
            ArgumentValidator.EnsureArgumentNotNull(statement, "statement");
            ArgumentValidator.EnsureArgumentNotNull(tupleDescriptor, "tupleDescriptor");

            this.driver       = driver;
            Statement         = statement;
            ParameterBindings = ParameterBinding.NormalizeBindings(parameterBindings);
            TupleDescriptor   = tupleDescriptor;
            Options           = options;
        }
コード例 #6
0
        public SequenceQueryBuilder(StorageDriver driver)
        {
            ArgumentValidator.EnsureArgumentNotNull(driver, "driver");

            this.driver = driver;

            var providerInfo = driver.ProviderInfo;

            hasSequences           = providerInfo.Supports(ProviderFeatures.Sequences);
            hasBatches             = providerInfo.Supports(ProviderFeatures.DmlBatches);
            hasInsertDefaultValues = providerInfo.Supports(ProviderFeatures.InsertDefaultValues);
            storesAutoIncrementSettingsInMemory = providerInfo.Supports(ProviderFeatures.AutoIncrementSettingsInMemory);

            compartment = hasSequences || providerInfo.Supports(ProviderFeatures.TransactionalKeyGenerators)
        ? SequenceQueryCompartment.SameSession
        : SequenceQueryCompartment.SeparateSession;
        }
コード例 #7
0
        public PersistRequest(
            StorageDriver driver, SqlStatement statement, IEnumerable <PersistParameterBinding> parameterBindings, NodeConfiguration nodeConfiguration)
        {
            ArgumentValidator.EnsureArgumentNotNull(driver, "driver");
            ArgumentValidator.EnsureArgumentNotNull(statement, "statement");

            var compileUnit = statement as ISqlCompileUnit;

            if (compileUnit == null)
            {
                throw new ArgumentException("Statement is not ISqlCompileUnit");
            }

            this.driver       = driver;
            Statement         = statement;
            CompileUnit       = compileUnit;
            ParameterBindings = ParameterBinding.NormalizeBindings(parameterBindings);
            NodeConfiguration = nodeConfiguration;
        }
コード例 #8
0
        // Constructors

        public ExpressionProcessor(
            LambdaExpression lambda, HandlerAccessor handlers, SqlCompiler compiler, params IReadOnlyList <SqlExpression>[] sourceColumns)
        {
            ArgumentValidator.EnsureArgumentNotNull(lambda, "lambda");
            ArgumentValidator.EnsureArgumentNotNull(handlers, "handlers");
            ArgumentValidator.EnsureArgumentNotNull(sourceColumns, "sourceColumns");

            this.compiler      = compiler; // This might be null, check before use!
            this.lambda        = lambda;
            this.sourceColumns = sourceColumns;

            providerInfo = handlers.ProviderInfo;
            driver       = handlers.StorageDriver;

            fixBooleanExpressions      = !providerInfo.Supports(ProviderFeatures.FullFeaturedBooleanExpressions);
            emptyStringIsNull          = providerInfo.Supports(ProviderFeatures.TreatEmptyStringAsNull);
            dateTimeEmulation          = providerInfo.Supports(ProviderFeatures.DateTimeEmulation);
            dateTimeOffsetEmulation    = providerInfo.Supports(ProviderFeatures.DateTimeOffsetEmulation);
            memberCompilerProvider     = handlers.DomainHandler.GetMemberCompilerProvider <SqlExpression>();
            specialByteArrayComparison = providerInfo.ProviderName.Equals(WellKnown.Provider.Oracle);

            bindings           = new HashSet <QueryParameterBinding>();
            activeParameters   = new List <ParameterExpression>();
            evaluator          = new ExpressionEvaluator(lambda);
            parameterExtractor = new ParameterExtractor(evaluator);

            if (fixBooleanExpressions)
            {
                booleanExpressionConverter = new BooleanExpressionConverter(driver);
            }
            if (lambda.Parameters.Count != sourceColumns.Length)
            {
                throw Exceptions.InternalError(Strings.ExParametersCountIsNotSameAsSourceColumnListsCount, OrmLog.Instance);
            }
            if (sourceColumns.Any(list => list.Any(c => c.IsNullReference())))
            {
                throw Exceptions.InternalError(Strings.ExSourceColumnListContainsNullValues, OrmLog.Instance);
            }
            sourceMapping = new Dictionary <ParameterExpression, IReadOnlyList <SqlExpression> >();
        }
コード例 #9
0
        // Constructors

        public ExpressionTranslationContext(ProviderInfo providerInfo, StorageDriver driver, BooleanExpressionConverter booleanExpressionConverter)
        {
            ProviderInfo = providerInfo;
            Driver       = driver;
            BooleanExpressionConverter = booleanExpressionConverter;
        }
コード例 #10
0
 public BooleanExpressionConverter(StorageDriver driver)
 {
     booleanType = driver.MapValueType(typeof(bool));
 }
コード例 #11
0
 public BooleanExpressionConverter(StorageDriver driver)
 {
     booleanType = driver.MapValueType(WellKnownTypes.Bool);
 }
コード例 #12
0
        // Constructors

        public PersistRequest(
            StorageDriver driver, SqlStatement statement, IEnumerable <PersistParameterBinding> parameterBindings)
            : this(driver, statement, parameterBindings, null)
        {
        }
コード例 #13
0
        // Constructors

        public CursorCommandFactory(StorageDriver driver, Session session, SqlConnection connection)
            : base(driver, session, connection)
        {
        }
コード例 #14
0
 public SqlExecutor(StorageDriver driver, SqlConnection connection, Session session)
     : this(driver, connection)
 {
     this.session = session;
 }
コード例 #15
0
 public ExpressionTranslationScope(ProviderInfo providerInfo, StorageDriver driver, BooleanExpressionConverter booleanExpressionConverter)
     : base(new ExpressionTranslationContext(providerInfo, driver, booleanExpressionConverter))
 {
 }
コード例 #16
0
 /// <inheritdoc/>
 protected override void Initialize()
 {
     driver       = Handlers.StorageDriver;
     providerInfo = Handlers.ProviderInfo;
 }
コード例 #17
0
 /// <inheritdoc/>
 protected override void Initialize()
 {
     driver          = Handlers.StorageDriver;
     providerInfo    = Handlers.ProviderInfo;
     useLargeObjects = Handlers.ProviderInfo.Supports(ProviderFeatures.LargeObjects);
 }