You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2019/04/05 11:23:33 UTC

[ignite] branch ignite-11525 updated: Fixing examples

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch ignite-11525
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-11525 by this push:
     new ab3b08d  Fixing examples
ab3b08d is described below

commit ab3b08df7bdfd0d8585c3321acc172af8a9b1a63
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Fri Apr 5 14:23:21 2019 +0300

    Fixing examples
---
 .../Datagrid/BinaryModeExample.cs                  | 38 +++++++---------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/BinaryModeExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/BinaryModeExample.cs
index 0d96f4c..40b0fa0 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/BinaryModeExample.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/BinaryModeExample.cs
@@ -114,12 +114,12 @@ namespace Apache.Ignite.Examples.Datagrid
                 // Run SQL query example.
                 SqlQueryExample(cache);
 
+                // Run SQL query example.
+                SqlQueryExample(cache);
+
                 // Run SQL query with join example.
                 SqlJoinQueryExample(cache);
 
-                // Run SQL fields query example.
-                SqlFieldsQueryExample(cache);
-
                 // Run full text query example.
                 FullTextQueryExample(cache);
 
@@ -153,18 +153,18 @@ namespace Apache.Ignite.Examples.Datagrid
         }
 
         /// <summary>
-        /// Queries persons that have a specific name using SQL.
+        /// Queries names for all persons.
         /// </summary>
         /// <param name="cache">Cache.</param>
         private static void SqlQueryExample(ICache<int, IBinaryObject> cache)
         {
-            var qry = cache.Query(new SqlQuery(PersonType, "name like 'James%'"));
+            var qry = cache.Query(new SqlFieldsQuery("select name from Person order by name"));
 
             Console.WriteLine();
-            Console.WriteLine(">>> Persons named James:");
+            Console.WriteLine(">>> All person names:");
 
-            foreach (var entry in qry)
-                Console.WriteLine(">>>    " + entry.Value);
+            foreach (var row in qry)
+                Console.WriteLine(">>>     " + row[0]);
         }
 
         /// <summary>
@@ -175,9 +175,10 @@ namespace Apache.Ignite.Examples.Datagrid
         {
             const string orgName = "Apache";
 
-            var qry = cache.Query(new SqlQuery(PersonType,
-                "from Person, Company " +
-                "where Person.CompanyId = Company.Id and Company.Name = ?", orgName)
+            var qry = cache.Query(new SqlFieldsQuery(
+                PersonType,
+                "select Person.* from Person, Company where Person.CompanyId = Company.Id and Company.Name = ?",
+                orgName)
             {
                 EnableDistributedJoins = true,
                 Timeout = new TimeSpan(0, 1, 0)
@@ -191,21 +192,6 @@ namespace Apache.Ignite.Examples.Datagrid
         }
 
         /// <summary>
-        /// Queries names for all persons.
-        /// </summary>
-        /// <param name="cache">Cache.</param>
-        private static void SqlFieldsQueryExample(ICache<int, IBinaryObject> cache)
-        {
-            var qry = cache.Query(new SqlFieldsQuery("select name from Person order by name"));
-
-            Console.WriteLine();
-            Console.WriteLine(">>> All person names:");
-
-            foreach (var row in qry)
-                Console.WriteLine(">>>     " + row[0]);
-        }
-
-        /// <summary>
         /// Queries persons that have a specific name using full-text query API.
         /// </summary>
         /// <param name="cache">Cache.</param>