public void Configure(SelectRequest request)
        {
            Arguments.Add ("SignatureMethod", SignatureMethod);
            Arguments.Add ("SignatureVersion", SignatureVersion);
            Arguments.Add ("Timestamp", DateTime.UtcNow.ToString ("o"));
            Arguments.Add ("Version", Version);

            Arguments.Add ("SelectExpression", request.SelectExpression);

            Action = "Select";

            if (request != null && request.NextToken != null) {
                Arguments.Add ("NextToken", request.NextToken);
            }

            if (request != null && request.ConsistentRead) {
                Arguments.Add ("ConsistentRead", "true");
            }
        }
		public async Task<SelectResponse> Select (SelectRequest request)
		{
			using (HttpClient Client = new HttpClient ()) {

				SelectRequestMarshaller marshaller = new SelectRequestMarshaller ();
				marshaller.Configure (request);
				HttpResponseMessage responseMessage;

				responseMessage = await Client.SendAsync (ConfigureClient (Client, marshaller));

				SelectResponseUnMarshaller unmarshaler = new SelectResponseUnMarshaller ();
				unmarshaler.Configure (responseMessage);
				return unmarshaler.UnMarshal ();
			}
		}
Пример #3
0
        public void TestSelectRequest()
        {
            List<ReplaceableAttribute> list = new List<ReplaceableAttribute> ();
            list.Add (new ReplaceableAttribute ("Test", "true", true));

            List<ReplaceableItem> items = new List<ReplaceableItem> ();
            ReplaceableItem item0 = new ReplaceableItem ("0", list);
            items.Add (item0);
            ReplaceableItem item1 = new ReplaceableItem ("1", list);
            items.Add (item1);
            BatchPutAttributesRequest request = new BatchPutAttributesRequest ("Test", items);
            BatchPutAttributesResponse response = Client.BatchPutAttributes (request).Result;
            Assert.AreEqual (HttpStatusCode.OK, response.HttpStatusCode);

            SelectRequest request2 = new SelectRequest ("select * from Test where Test = 'true'", true);
            SelectResponse response2 = Client.Select (request2).Result;

            Assert.AreEqual ("Test", response2.SelectResult.Item [0].Attribute [0].Name);
            Assert.AreEqual ("true", response2.SelectResult.Item [0].Attribute [0].Value);
            Assert.AreEqual ("Test", response2.SelectResult.Item [1].Attribute [0].Name);
            Assert.AreEqual ("true", response2.SelectResult.Item [1].Attribute [0].Value);
            Assert.AreEqual (HttpStatusCode.OK, response2.HttpStatusCode);
        }