Esempio n. 1
0
        public void QuotedStringTokenizerTests()
        {
            var tokenizier =
                new Dialect.Dialect.QuotedAndParenthesisStringTokenizer(
                    new SqlString("SELECT fish.\"id column\", fish.'fish name' as 'bar\\' column', f FROM fish"));
            var expected = new string[]
            {
                "SELECT",
                "fish.\"id column\"",
                ",",
                "fish.'fish name'",
                "as",
                "'bar\\' column'",
                ",",
                "f",
                "FROM",
                "fish"
            };
            var current = 0;
            var tokens  = tokenizier.GetTokens();

            foreach (var token in tokens)
            {
                Assert.AreEqual(expected[current], token.ToString());
                current += 1;
            }
            Assert.That(expected, Has.Length.EqualTo(current));
        }
Esempio n. 2
0
        public void QuotedAndParenthesisStringTokenizerTests_WithFunctionCallContainingComma()
        {
            var tokenizier =
                new Dialect.Dialect.QuotedAndParenthesisStringTokenizer(
                    new SqlString("SELECT fish.id, cast('astring, with,comma' as string) as bar, f FROM fish"));
            var expected = new string[]
            {
                "SELECT",
                "fish.id",
                ",",
                "cast('astring, with,comma' as string)",
                "as",
                "bar",
                ",",
                "f",
                "FROM",
                "fish"
            };
            var current = 0;
            var tokens  = tokenizier.GetTokens();

            foreach (var token in tokens)
            {
                Assert.AreEqual(expected[current], token.ToString());
                current += 1;
            }
            Assert.AreEqual(current, expected.Length);
        }