public void BuildDatabaseStatement(QueryStatistics statistics)
        {
            if (statistics != null)
            {
                CurrentStatement.UseStatistics(statistics);
            }

            TopStatement.CompileStructure(new MartenExpressionParser(_session.Serializer, _session.Options));
        }
Exemple #2
0
        public IQueryHandler <TResult> BuildHandler <TResult>()
        {
            // TODO -- expression parser should be a singleton somehow to avoid
            // the object allocations
            TopStatement.CompileStructure(new MartenExpressionParser(_session.Serializer, _session.Options));

            if (CurrentStatement.SingleValue)
            {
                return(CurrentStatement.BuildSingleResultHandler <TResult>(_session));
            }
            return(CurrentStatement.SelectClause.BuildHandler <TResult>(_session, TopStatement));
        }
        public void BuildDiagnosticCommand(FetchType fetchType, CommandBuilder sql)
        {
            switch (fetchType)
            {
            case FetchType.Any:
                CurrentStatement.ToAny();
                break;

            case FetchType.Count:
                CurrentStatement.ToCount <long>();
                break;

            case FetchType.FetchOne:
                CurrentStatement.Limit = 1;
                break;
            }

            TopStatement.CompileStructure(_session);

            TopStatement.Configure(sql);
        }
        public void BuildDiagnosticCommand(FetchType fetchType, CommandBuilder sql)
        {
            switch (fetchType)
            {
            case FetchType.Any:
                CurrentStatement.ToAny();
                break;

            case FetchType.Count:
                CurrentStatement.ToCount <long>();
                break;

            case FetchType.FetchOne:
                CurrentStatement.Limit = 1;
                break;
            }

            TopStatement.CompileStructure(new MartenExpressionParser(_session.Serializer, _session.Options));

            TopStatement.Configure(sql);
        }