Hi Isomorphic,
please see this testcase:
employees.ds.xml
Here the console-output:
=== 2018-12-11 15:17:25,217 [-132] INFO RequestContext - URL: '/builtinds/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36': Safari with Accept-Encoding header
=== 2018-12-11 15:17:25,218 [-132] DEBUG DataSourceLoader - For DataSource 'supplyItem', got instanceId 10
=== 2018-12-11 15:17:25,220 [1-60] INFO Compression - /builtinds/builtinds.nocache.js: 2474 -> 1222 bytes
=== 2018-12-11 15:17:25,220 [-132] DEBUG DataSourceLoader - For DataSource 'animals', got instanceId 14
=== 2018-12-11 15:17:25,222 [-132] DEBUG DataSourceLoader - For DataSource 'employees', got instanceId 1112
=== 2018-12-11 15:17:25,224 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:25,224 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:25,225 [-132] INFO Compression - /builtinds/sc/DataSourceLoader: 4868 -> 1951 bytes
=== 2018-12-11 15:17:25,229 [-117] INFO Compression - /builtinds/sc/initsc.js: 47 -> 72 bytes
=== 2018-12-11 15:17:25,242 [-154] INFO Compression - /builtinds/sc/modules/ISC_RichTextEditor.js: 64002 -> 16638 bytes
=== 2018-12-11 15:17:25,253 [-117] INFO Compression - /builtinds/sc/modules/ISC_Containers.js: 167757 -> 38907 bytes
=== 2018-12-11 15:17:25,260 [-132] INFO Compression - /builtinds/sc/modules/ISC_Foundation.js: 377054 -> 87846 bytes
=== 2018-12-11 15:17:25,271 [-154] INFO Compression - /builtinds/sc/modules/ISC_Calendar.js: 285539 -> 69051 bytes
=== 2018-12-11 15:17:25,295 [-153] INFO Compression - /builtinds/sc/modules/ISC_Forms.js: 1009681 -> 244549 bytes
=== 2018-12-11 15:17:25,311 [-152] INFO Compression - /builtinds/sc/modules/ISC_Grids.js: 1094957 -> 278594 bytes
=== 2018-12-11 15:17:25,320 [-117] INFO Compression - /builtinds/sc/modules/ISC_DataBinding.js: 996054 -> 239058 bytes
=== 2018-12-11 15:17:25,324 [1-60] INFO Compression - /builtinds/sc/modules/ISC_Core.js: 1272899 -> 332535 bytes
GET /recompile/builtinds
Job com.smartgwt.sample.BuiltInDS_2_15
starting job: com.smartgwt.sample.BuiltInDS_2_15
binding: user.agent=safari
skipped compile because no input files have changed
0,048s total -- Compile completed
=== 2018-12-11 15:17:26,372 [-132] INFO RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36': Safari with Accept-Encoding header
=== 2018-12-11 15:17:26,373 [-132] WARN RPCManager - client/server version mismatch. Client is version: v12.0p_2018-12-06, server is version: v12.0p_2018-04-15 - mixing different client/server versions is generally not supported. If you've installed a more recent client version, try clearing the browser cache and reloading the page.
=== 2018-12-11 15:17:26,379 [-132] DEBUG XML - Parsed XML from (in memory stream): 6ms
=== 2018-12-11 15:17:26,382 [-132] DEBUG RPCManager - Processing 1 requests.
=== 2018-12-11 15:17:26,382 [-132] DEBUG RPCManager - Request #1 (DSRequest) payload: {
criteria:{
},
values:{
operator:"iContains",
fieldName:"Name",
value:"Charles",
_constructor:"AdvancedCriteria"
},
operationConfig:{
dataSource:"employees",
repo:null,
operationType:"update",
textMatchStyle:"exact"
},
appID:"builtinApplication",
operation:"updateGender",
oldValues:{
operator:"iContains",
fieldName:"Name",
value:"Charles",
_constructor:"AdvancedCriteria"
}
}
=== 2018-12-11 15:17:26,382 [-132] INFO IDACall - Performing 1 operation(s)
=== 2018-12-11 15:17:26,383 [-132] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
=== 2018-12-11 15:17:26,383 [-132] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing...
=== 2018-12-11 15:17:26,384 [-132] DEBUG AppBase - [builtinApplication.updateGender] No userTypes defined, allowing anyone access to all operations for this application
=== 2018-12-11 15:17:26,384 [-132] DEBUG AppBase - [builtinApplication.updateGender] No public zero-argument method named '_updateGender' found, performing generic datasource operation
=== 2018-12-11 15:17:26,388 [-132] INFO SQLDataSource - [builtinApplication.updateGender] Performing update operation with
criteria: {} values: {operator:"iContains",fieldName:"Name",value:"Charles",_constructor:"AdvancedCriteria",Gender:"male"}
=== 2018-12-11 15:17:26,388 [-132] INFO SQLValuesClause - [builtinApplication.updateGender] Ignored data for non-existent or included columns: [operator, fieldName, value, _constructor]
=== 2018-12-11 15:17:26,389 [-132] INFO SQLWhereClause - [builtinApplication.updateGender] empty condition
=== 2018-12-11 15:17:26,389 [-132] DEBUG SQLConnectionManager - [builtinApplication.updateGender] Borrowed connection '449826350'
=== 2018-12-11 15:17:26,389 [-132] DEBUG SQLTransaction - [builtinApplication.updateGender] Started new HSQLDB transaction "449826350"
=== 2018-12-11 15:17:26,389 [-132] DEBUG SQLDataSource - [builtinApplication.updateGender] Setting DSRequest as being part of a transaction
=== 2018-12-11 15:17:26,389 [-132] INFO SQLDriver - [builtinApplication.updateGender] Executing SQL query on 'HSQLDB' using connection '449826350': UPDATE employeeTable SET Gender='male' WHERE ('1'='1')
=== 2018-12-11 15:17:26,410 [-132] INFO SQLDataSource - [builtinApplication.updateGender] primaryKeys: {}
=== 2018-12-11 15:17:26,410 [-132] DEBUG SQLDataSource - [builtinApplication.updateGender] Gathered all keys. lastPrimaryKeys is now {}
=== 2018-12-11 15:17:26,410 [-132] DEBUG SQLDataSource - [builtinApplication.updateGender] update operation affected 115 rows
=== 2018-12-11 15:17:26,410 [-132] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
=== 2018-12-11 15:17:26,410 [-132] DEBUG SQLTransaction - Committing HSQLDB transaction "449826350"
=== 2018-12-11 15:17:26,411 [-132] DEBUG RPCManager - non-DMI response, dropExtraFields: false
=== 2018-12-11 15:17:26,411 [-132] DEBUG SQLTransaction - getConnection() looked for transactional connection for HSQLDB: hashcode "449826350"
=== 2018-12-11 15:17:26,412 [-132] WARN SQLTransaction - Ending HSQLDB transaction "449826350"
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLConnectionManager - About to close connection with hashcode "449826350"
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:26,412 [-132] INFO Compression - /builtinds/sc/IDACall: 160 -> 143 bytes
GET /sourcemaps/builtinds/44F7120C32C36BC77509000F9066A422_sourcemap.json
Should the criteria not be applied under "criteria" in the "payload"? With this, all entries with Gender == male are getting updated, and not just those with Name == Charles.
Thanks in Advance,
Kind Regards
please see this testcase:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criterion; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.Record; import com.smartgwt.client.types.DSOperationType; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); DataSource employeesDS = DataSource.get("employees"); AdvancedCriteria employeesC = new AdvancedCriteria(new Criterion("Name", OperatorId.ICONTAINS, "Charles")); Record employessRecord = new Record(); employessRecord.setAttribute("Gender", "male"); DSRequest employeesRequest = new DSRequest(DSOperationType.UPDATE, "updateGender", employeesC); employeesDS.updateData(employessRecord, null, employeesRequest); } }
Code:
<DataSource ID="employees" serverType="sql" tableName="employeeTable" recordName="employee" testFileName="/examples/shared/ds/test_data/employees.data.xml" titleField="Name" > <fields> <field name="userOrder" title="userOrder" type="integer" canEdit="false" hidden="true"/> <field name="Name" title="Name" type="text" length="128"/> <field name="EmployeeId" title="Employee ID" type="integer" primaryKey="true" required="true"/> <field name="ReportsTo" title="Manager" type="integer" required="true" foreignKey="employees.EmployeeId" rootValue="1" detail="true"/> <field name="Job" title="Title" type="text" length="128"/> <field name="Email" title="Email" type="text" length="128"/> <field name="EmployeeType" title="Employee Type" type="text" length="40"/> <field name="EmployeeStatus" title="Status" type="text" length="40"/> <field name="Salary" title="Salary" type="float"/> <field name="OrgUnit" title="Org Unit" type="text" length="128"/> <field name="Gender" title="Gender" type="text" length="7"> <valueMap> <value>male</value> <value>female</value> </valueMap> </field> <field name="MaritalStatus" title="Marital Status" type="text" length="10"> <valueMap> <value>married</value> <value>single</value> </valueMap> </field> </fields> <operationBinding operationType="update" operationId="updateGender" allowMultiUpdate="true"> <values fieldName="Gender" value="male" /> </operationBinding> </DataSource>
=== 2018-12-11 15:17:25,217 [-132] INFO RequestContext - URL: '/builtinds/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36': Safari with Accept-Encoding header
=== 2018-12-11 15:17:25,218 [-132] DEBUG DataSourceLoader - For DataSource 'supplyItem', got instanceId 10
=== 2018-12-11 15:17:25,220 [1-60] INFO Compression - /builtinds/builtinds.nocache.js: 2474 -> 1222 bytes
=== 2018-12-11 15:17:25,220 [-132] DEBUG DataSourceLoader - For DataSource 'animals', got instanceId 14
=== 2018-12-11 15:17:25,222 [-132] DEBUG DataSourceLoader - For DataSource 'employees', got instanceId 1112
=== 2018-12-11 15:17:25,224 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:25,224 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:25,225 [-132] INFO Compression - /builtinds/sc/DataSourceLoader: 4868 -> 1951 bytes
=== 2018-12-11 15:17:25,229 [-117] INFO Compression - /builtinds/sc/initsc.js: 47 -> 72 bytes
=== 2018-12-11 15:17:25,242 [-154] INFO Compression - /builtinds/sc/modules/ISC_RichTextEditor.js: 64002 -> 16638 bytes
=== 2018-12-11 15:17:25,253 [-117] INFO Compression - /builtinds/sc/modules/ISC_Containers.js: 167757 -> 38907 bytes
=== 2018-12-11 15:17:25,260 [-132] INFO Compression - /builtinds/sc/modules/ISC_Foundation.js: 377054 -> 87846 bytes
=== 2018-12-11 15:17:25,271 [-154] INFO Compression - /builtinds/sc/modules/ISC_Calendar.js: 285539 -> 69051 bytes
=== 2018-12-11 15:17:25,295 [-153] INFO Compression - /builtinds/sc/modules/ISC_Forms.js: 1009681 -> 244549 bytes
=== 2018-12-11 15:17:25,311 [-152] INFO Compression - /builtinds/sc/modules/ISC_Grids.js: 1094957 -> 278594 bytes
=== 2018-12-11 15:17:25,320 [-117] INFO Compression - /builtinds/sc/modules/ISC_DataBinding.js: 996054 -> 239058 bytes
=== 2018-12-11 15:17:25,324 [1-60] INFO Compression - /builtinds/sc/modules/ISC_Core.js: 1272899 -> 332535 bytes
GET /recompile/builtinds
Job com.smartgwt.sample.BuiltInDS_2_15
starting job: com.smartgwt.sample.BuiltInDS_2_15
binding: user.agent=safari
skipped compile because no input files have changed
0,048s total -- Compile completed
=== 2018-12-11 15:17:26,372 [-132] INFO RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36': Safari with Accept-Encoding header
=== 2018-12-11 15:17:26,373 [-132] WARN RPCManager - client/server version mismatch. Client is version: v12.0p_2018-12-06, server is version: v12.0p_2018-04-15 - mixing different client/server versions is generally not supported. If you've installed a more recent client version, try clearing the browser cache and reloading the page.
=== 2018-12-11 15:17:26,379 [-132] DEBUG XML - Parsed XML from (in memory stream): 6ms
=== 2018-12-11 15:17:26,382 [-132] DEBUG RPCManager - Processing 1 requests.
=== 2018-12-11 15:17:26,382 [-132] DEBUG RPCManager - Request #1 (DSRequest) payload: {
criteria:{
},
values:{
operator:"iContains",
fieldName:"Name",
value:"Charles",
_constructor:"AdvancedCriteria"
},
operationConfig:{
dataSource:"employees",
repo:null,
operationType:"update",
textMatchStyle:"exact"
},
appID:"builtinApplication",
operation:"updateGender",
oldValues:{
operator:"iContains",
fieldName:"Name",
value:"Charles",
_constructor:"AdvancedCriteria"
}
}
=== 2018-12-11 15:17:26,382 [-132] INFO IDACall - Performing 1 operation(s)
=== 2018-12-11 15:17:26,383 [-132] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
=== 2018-12-11 15:17:26,383 [-132] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing...
=== 2018-12-11 15:17:26,384 [-132] DEBUG AppBase - [builtinApplication.updateGender] No userTypes defined, allowing anyone access to all operations for this application
=== 2018-12-11 15:17:26,384 [-132] DEBUG AppBase - [builtinApplication.updateGender] No public zero-argument method named '_updateGender' found, performing generic datasource operation
=== 2018-12-11 15:17:26,388 [-132] INFO SQLDataSource - [builtinApplication.updateGender] Performing update operation with
criteria: {} values: {operator:"iContains",fieldName:"Name",value:"Charles",_constructor:"AdvancedCriteria",Gender:"male"}
=== 2018-12-11 15:17:26,388 [-132] INFO SQLValuesClause - [builtinApplication.updateGender] Ignored data for non-existent or included columns: [operator, fieldName, value, _constructor]
=== 2018-12-11 15:17:26,389 [-132] INFO SQLWhereClause - [builtinApplication.updateGender] empty condition
=== 2018-12-11 15:17:26,389 [-132] DEBUG SQLConnectionManager - [builtinApplication.updateGender] Borrowed connection '449826350'
=== 2018-12-11 15:17:26,389 [-132] DEBUG SQLTransaction - [builtinApplication.updateGender] Started new HSQLDB transaction "449826350"
=== 2018-12-11 15:17:26,389 [-132] DEBUG SQLDataSource - [builtinApplication.updateGender] Setting DSRequest as being part of a transaction
=== 2018-12-11 15:17:26,389 [-132] INFO SQLDriver - [builtinApplication.updateGender] Executing SQL query on 'HSQLDB' using connection '449826350': UPDATE employeeTable SET Gender='male' WHERE ('1'='1')
=== 2018-12-11 15:17:26,410 [-132] INFO SQLDataSource - [builtinApplication.updateGender] primaryKeys: {}
=== 2018-12-11 15:17:26,410 [-132] DEBUG SQLDataSource - [builtinApplication.updateGender] Gathered all keys. lastPrimaryKeys is now {}
=== 2018-12-11 15:17:26,410 [-132] DEBUG SQLDataSource - [builtinApplication.updateGender] update operation affected 115 rows
=== 2018-12-11 15:17:26,410 [-132] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
=== 2018-12-11 15:17:26,410 [-132] DEBUG SQLTransaction - Committing HSQLDB transaction "449826350"
=== 2018-12-11 15:17:26,411 [-132] DEBUG RPCManager - non-DMI response, dropExtraFields: false
=== 2018-12-11 15:17:26,411 [-132] DEBUG SQLTransaction - getConnection() looked for transactional connection for HSQLDB: hashcode "449826350"
=== 2018-12-11 15:17:26,412 [-132] WARN SQLTransaction - Ending HSQLDB transaction "449826350"
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLConnectionManager - About to close connection with hashcode "449826350"
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:26,412 [-132] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 1112
=== 2018-12-11 15:17:26,412 [-132] INFO Compression - /builtinds/sc/IDACall: 160 -> 143 bytes
GET /sourcemaps/builtinds/44F7120C32C36BC77509000F9066A422_sourcemap.json
Should the criteria not be applied under "criteria" in the "payload"? With this, all entries with Gender == male are getting updated, and not just those with Name == Charles.
Thanks in Advance,
Kind Regards
Comment