예제 #1
0
        public object Execute(Query.IContentQuery <Models.TextContent> query)
        {
            var translator = new QueryProcessor.TextContentTranslator();
            var executor   = translator.Translate(query);

            return(executor.Execute());
        }
예제 #2
0
        private IEnumerable <string> GetCategoryClause(Repository repository, IEnumerable <IContentQuery <TextContent> > categoryQueries, List <Parameter> parameters)
        {
            TextContentTranslator translator        = new TextContentTranslator();
            List <string>         categoryQueryList = new List <string>();

            foreach (var categoryQuery in categoryQueries)
            {
                var executor        = translator.Translate(categoryQuery);
                var categoryVisitor = new MysqlVisitor <TextContent>(parameters);
                categoryVisitor.Visite(categoryQuery.Expression);

                IEnumerable <Parameter> outParameters;
                var categoryQuerySQL = executor.BuildQuerySQL(categoryVisitor, out outParameters);

                categoryQueryList.Add(string.Format(@"EXISTS(
                        SELECT ContentCategory.CategoryUUID 
                            FROM `{0}` ContentCategory,
                                ({1})category
                            WHERE content.UUID = ContentCategory.UUID AND ContentCategory.CategoryUUID = category.UUID 
                      )", repository.GetCategoryTableName()
                                                    , categoryQuerySQL));
            }
            return(categoryQueryList);
        }