IGNITE-7413 Fix SqlDmlExample
authorPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 18 Jan 2018 09:05:12 +0000 (12:05 +0300)
committerPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 18 Jan 2018 09:05:12 +0000 (12:05 +0300)
This closes #3389

examples/src/main/java/org/apache/ignite/examples/sql/SqlDmlExample.java
modules/platforms/dotnet/examples/Apache.Ignite.Examples/Sql/SqlDmlExample.cs

index cb2a04a..dbb1088 100644 (file)
@@ -119,15 +119,9 @@ public class SqlDmlExample {
      * @param personCache Person cache.
      */
     private static void delete(IgniteCache<Long, Person> personCache) {
-        String sql =
-            "delete from Person " +
-            "where id in (" +
-                "select p.id " +
-                "from Person p, \"" + ORG_CACHE + "\".Organization as o " +
-                "where o.name != ? and p.orgId = o.id" +
-            ")";
-
-        personCache.query(new SqlFieldsQuery(sql).setArgs("ASF")).getAll();
+        String sql = "delete from Person where orgId != ?";
+
+        personCache.query(new SqlFieldsQuery(sql).setArgs(1)).getAll();
     }
 
     /**
index a37db76..7b84fc3 100644 (file)
@@ -153,10 +153,7 @@ namespace Apache.Ignite.Examples.Sql
         /// <param name="employeeCache">Employee cache.</param>
         private static void Delete(ICache<int, Employee> employeeCache)
         {
-            var qry = new SqlFieldsQuery(string.Format(
-                "delete from Employee where _key in (" +
-                "select emp._key from Employee emp, \"{0}\".Organization org " +
-                "where org.Name != ? and org._key = emp.organizationId)", OrganizationCacheName), "ASF");
+            var qry = new SqlFieldsQuery("delete from Employee where organizationId != ?", 1);
 
             employeeCache.Query(qry);
         }