Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Delete in DMI

    I am trying to delete some records in the server-side using a DMI method.

    I use this code:
    Code:
    DSRequest fieldsDeleteRequest = new DSRequest(
    				"table",
    				DataSource.OP_REMOVE, rpcManager);
    		fieldsDeleteRequest.setCriteria("f_variante", variantenId);
    Where "f_variante" is NOT a primary key.

    I get this SQL:
    Code:
    delete from table where '1' = '1'
    So the whole table is being deleted.

    If I include fieldsDeleteRequest.setAllowMultiUpdate(true); , then everything works fine:

    Code:
    DSRequest fieldsDeleteRequest = new DSRequest(
    				"table",
    				DataSource.OP_REMOVE, rpcManager);
    fieldsDeleteRequest.setAllowMultiUpdate(true);	fieldsDeleteRequest.setCriteria("f_variante", variantenId);
    But when I read the docs of setAllowMultiUpdate(true);:

    Code:
    provides safeguards for server code
    provides safeguards for server code? If this is not set, the COMPLETE table is being deleted! Which should not be.

    Using Smartgwt 4.1p power.

    #2
    To clarify, it provides safeguards so that the framework does not delete the entire table if a *client request* comes in with no PK value.

    Server-initiated requests are expected to be carefully checked by the developer, and the framework does what you say to do.

    Comment

    Working...
    X