Example #1
0
        //private new void Initialize(IDataServices dataServices, IDbConnection connection)
        //{
        //    services = dataServices;
        //    conManager = new SqlConnectionManager(this, (DbConnection)connection, 100);
        //    var type = typeof(ALinq.Oracle.DataReader);
        //    readerCompiler = new ObjectReaderCompiler(type, services);
        //    InitializeProviderMode();
        //}

        internal override ICompiledSubQuery CompileSubQuery(SqlNode query, Type elementType, ReadOnlyCollection <SqlParameter> parameters)
        {
            query = SqlDuplicator.Copy(query);
            var annotations = new SqlNodeAnnotations();
            var queries     = BuildQuery(ResultShape.Sequence, TypeSystem.GetSequenceType(elementType), query, parameters, annotations);
            var queryInfo   = queries[0];

            //Set CommandText
            queryInfo.CommandText = new OracleFormatter(this).Format(queryInfo.Query);
            ICompiledSubQuery[]  subQueries    = CompileSubQueries(queryInfo.Query);
            IObjectReaderFactory readerFactory = GetReaderFactory(queryInfo.Query, elementType);

            CheckSqlCompatibility(queries, annotations);

            return(new CompiledSubQuery(queryInfo, readerFactory, parameters, subQueries));
        }
Example #2
0
        internal override ICompiledSubQuery CompileSubQuery(SqlNode query, Type elementType, ReadOnlyCollection <SqlParameter> parameters)
        {
            query = SqlDuplicator.Copy(query);
            var annotations = new SqlNodeAnnotations();

            QueryInfo[] queries   = BuildQuery(ResultShape.Sequence, TypeSystem.GetSequenceType(elementType), query, parameters, annotations);
            QueryInfo   queryInfo = queries[0];

            ICompiledSubQuery[] subQueries = this.CompileSubQueries(queryInfo.Query);
            var formatter = new MySqlFormatter(this);

            for (int i = 0; i < subQueries.Length; i++)
            {
                var subQuery = (CompiledSubQuery)subQueries[i];
                subQuery.QueryInfo.CommandText = formatter.Format(subQuery.QueryInfo.Query);
            }
            IObjectReaderFactory readerFactory = this.GetReaderFactory(queryInfo.Query, elementType);

            CheckSqlCompatibility(queries, annotations);
            return(new CompiledSubQuery(queryInfo, readerFactory, parameters, subQueries, connectionString, this));
        }