Uploaded image for project: 'Lucee Development'
  1. LDEV-1394

value key of queryparam should not be required when null=true

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.4.19
    • Environment:

      I see this on the latest stable version 5.2.1.9

    • Sprint:
      August 2017 Sprint

      Description

      For the case when a struct key may not exist, code such as the following should work for a queryparam

      var params = {};
      if ( structkeyexists( variables, 'clientId' ) ) {
      	params.insert( "clientId", { value: variables.clientId, cfsqltype: "integer" } );
      } else {
      	params.insert( "clientId", { null: true, cfsqltype: "integer" } );
      }
      

      But the above throws an error:
      "key [value] doesn't exist"
      because the value key is missing in the parameter defined in the else statement.

      If instead, the following is tried so that the value attribute is provided for the case that variables.clientId is null, not defined:

      var params = {};
      if ( structkeyexists( variables, 'clientId' ) ) {
      	params.insert( "clientId", { value: variables.clientId, cfsqltype: "integer" } );
      } else {
      	params.insert( "clientId", {value: variables.clientId, null: true, cfsqltype: "integer" } );
      }
      

      The error "Component [root.model.beans.user] has no accessible Member with name [CLIENTID]" is thrown.

      Trying to work around the issue, if a value of 0 is set on the param:

      params.insert( "clientId", {value: 0, value: '', null: true, cfsqltype: "integer" } );
      

      the null attribute is ignored and 0 is inserted in the database.

      This seems to be related to LDEV-364 Deployed , which has been marked as deployed but a comment says was reverted, in that the null attribute is ignored when there is a value of 0.

      So to sum up,

      Null should be inserted in the db when the actual value IS null,
      but the implementation insists a value is passed in the queryparam,
      and if I include value attributes that sort of make sense,
      either I get an error or the null attribute is ignored.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                21solutions Igal Sapir
                Reporter:
                dnando Nando
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: