Ejemplo n.º 1
0
        public void ProjectCountSample()
        {
            var query = new ComplexQuery(
                "id, englishName",
                "title eq 'moeta' and property/field ne 'val' or number ge 5 and (likes ne 3 or special lt 3)",
                30,
                null,
                "_created asc, createdDateTime desc",
                "dev",
                true);
            var projectTranslator = new ProjectTranslator();
            var sqlQuery          = projectTranslator.Translate(query);

            Assert.AreEqual("select count(1)  from c where c.title = 'moeta' and c.property.field <> 'val' or c.number >= 5 and (c.likes <> 3 or c.special < 3) and c.entity = 'kotori/project' and c.instance = 'dev' ", sqlQuery);
        }
Ejemplo n.º 2
0
        public void ProjectSelectSample3()
        {
            var query = new ComplexQuery(
                "a,b,c",
                null,
                null,
                null,
                null,
                "dev",
                false);
            var projectTranslator = new ProjectTranslator();
            var sqlQuery          = projectTranslator.Translate(query);

            Assert.AreEqual("select c.a,c.b,c.c from c where c.entity = 'kotori/project' and c.instance = 'dev' ", sqlQuery);
        }
Ejemplo n.º 3
0
        public void ProjectSelectSampleWithTransformation()
        {
            var query = new ComplexQuery(
                "",
                "id eq 'yuri-yuri'",
                null,
                null,
                null,
                "dev",
                false);
            var projectTranslator = new ProjectTranslator();
            var sqlQuery          = projectTranslator.Translate(query);

            Assert.AreEqual("select * from c where c.identifier = 'kotori://api/projects/yuri-yuri' and c.entity = 'kotori/project' and c.instance = 'dev' ", sqlQuery);
        }
Ejemplo n.º 4
0
        public void ProjectSelectSample()
        {
            var query = new ComplexQuery(
                "id, robot",
                "title eq 'moeta'",
                30,
                null,
                null,
                "dev",
                false);
            var projectTranslator = new ProjectTranslator();
            var sqlQuery          = projectTranslator.Translate(query);

            Assert.AreEqual("select top 30 c.identifier, c.robot from c where c.title = 'moeta' and c.entity = 'kotori/project' and c.instance = 'dev' ", sqlQuery);
        }