예제 #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;
        }
        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;
        }
        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;
        }
        // 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> >();
        }
        // 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));
 }
 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;
 }
 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;
 }
 /// <inheritdoc/>
 protected override void Initialize()
 {
     driver          = Handlers.StorageDriver;
     providerInfo    = Handlers.ProviderInfo;
     useLargeObjects = Handlers.ProviderInfo.Supports(ProviderFeatures.LargeObjects);
 }