If you forget to write in a server-side DSRequest "allowMultiupdate(true)" together with an update all records are updated!
Example:
This creates (correctly) the following sql:
If I comment out "updateReq.setAllowMultiUpdate(true);" I get the following sql:
so this means setting setAllowMultiUpdate(false) updates ALL the records ! Is this by-design? Isn't this a contradiction?
Using smartgwt 6.1p power 6.1-p20180208
Example:
Code:
DSRequest updateReq = new DSRequest("myDS", DataSource.OP_UPDATE, rpcManager); List<Criterion> criterions = new ArrayList<>(); Criterion c = new SimpleCriterion("myCriteria", DefaultOperators.Equals, 1); criterions.add(c); AdvancedCriteria ac = new AdvancedCriteria(DefaultOperators.Or, criterions.toArray(new Criterion[] {})); updateReq.setAllowMultiUpdate(true); Map<String, Object> clearedValues = new HashMap<>(); clearedValues.put("f_myValue", null); updateReq.setValues(clearedValues); updateReq.setAdvancedCriteria(ac); updateReq.execute();
Code:
UPDATE myTable SET f_myValue=NULL WHERE ( myCriteria = 1) ;
Code:
UPDATE myTable SET f_myValue=NULL WHERE ('1'='1')
Using smartgwt 6.1p power 6.1-p20180208
Comment