当前位置: 首页>>代码示例>>C#>>正文


C# QueryRequest.GetFormValuesAsJson方法代码示例

本文整理汇总了C#中Couchbase.N1QL.QueryRequest.GetFormValuesAsJson方法的典型用法代码示例。如果您正苦于以下问题:C# QueryRequest.GetFormValuesAsJson方法的具体用法?C# QueryRequest.GetFormValuesAsJson怎么用?C# QueryRequest.GetFormValuesAsJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Couchbase.N1QL.QueryRequest的用法示例。


在下文中一共展示了QueryRequest.GetFormValuesAsJson方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_Statement

        public void Test_Statement()
        {
            var query = new QueryRequest().
                BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
                Statement("SELECT * FROM default");

            var json = query.GetFormValuesAsJson();
            var expected = "{\"statement\":\"SELECT * FROM default\",\"timeout\":\"75000ms\"}";
            Console.WriteLine(json);
            Assert.AreEqual(expected, json);
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:11,代码来源:QueryRequestTests.cs

示例2: Test_Positional_Parameters

        public void Test_Positional_Parameters()
        {
            var query = new QueryRequest().
                BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
                Statement("SELECT * FROM default WHERE type=$1").
                AddPositionalParameter("dog");

            var json = query.GetFormValuesAsJson();
            var expected = "{\"statement\":\"SELECT * FROM default WHERE type=$1\",\"timeout\":\"75000ms\",\"args\":[\"dog\"]}";
            Console.WriteLine(json);
            Assert.AreEqual(expected, json);
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:12,代码来源:QueryRequestTests.cs

示例3: Test_Statement_ClientContextId

        public void Test_Statement_ClientContextId()
        {
            var query = new QueryRequest().
                BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
                Statement("SELECT * FROM default").
                ClientContextId("somecontextlessthanorequalto64chars");

            var json = query.GetFormValuesAsJson();
            var expected = "{\"statement\":\"SELECT * FROM default\",\"client_context_id\":\"somecontextlessthanorequalto64chars\"}";
            Console.WriteLine(json);
            Assert.AreEqual(expected, json);
        }
开发者ID:huyqta,项目名称:couchbase-net-client,代码行数:12,代码来源:QueryRequestTests.cs

示例4: Test_Named_Parameters_Two_Arguments

        public void Test_Named_Parameters_Two_Arguments()
        {
            var query = new QueryRequest().
                BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
                Statement("SELECT * FROM default WHERE type=$canine OR type=$feline").
                AddNamedParameter("canine", "dog").
                AddNamedParameter("feline", "cat");

            var json = query.GetFormValuesAsJson();
            var expected = "{\"statement\":\"SELECT * FROM default WHERE type=$canine OR type=$feline\"," +
                "\"timeout\":\"75000ms\",\"$canine\":\"dog\",\"$feline\":\"cat\"}";
            Console.WriteLine(json);
            Assert.AreEqual(expected, json);
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:14,代码来源:QueryRequestTests.cs

示例5: When_Timeout_Set_Query_Contains_Milliseconds_With_Unit

        public void When_Timeout_Set_Query_Contains_Milliseconds_With_Unit()
        {
            var query = new QueryRequest()
                .BaseUri(new Uri(string.Format("http://{0}:8093/query", _server)))
                .Statement("SELECT * FROM `beer-sample`")
                .Timeout(new TimeSpan(0, 0, 0, 0, 5));

            var json = query.GetFormValuesAsJson();
            var expected = "{\"statement\":\"SELECT * FROM `beer-sample`\",\"timeout\":\"5ms\"}";
            Console.WriteLine(json);

            Assert.AreEqual(expected, json);
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:13,代码来源:QueryRequestTests.cs

示例6: When_isAdmin_Is_False_Credentials_Contains_local

        public void When_isAdmin_Is_False_Credentials_Contains_local()
        {
            var query = new QueryRequest().
                BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
                Statement("SELECT * FROM authenticated").
                AddCredentials("authenticated", "secret", false);

            var json = query.GetFormValuesAsJson();
            var expected = "{\"statement\":\"SELECT * FROM authenticated\",\"timeout\":\"75000ms\"," +
                           "\"creds\":[{\"user\":\"local:authenticated\",\"pass\":\"secret\"}]}";
            Console.WriteLine(json);
            Assert.AreEqual(expected, json);
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:13,代码来源:QueryRequestTests.cs


注:本文中的Couchbase.N1QL.QueryRequest.GetFormValuesAsJson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。