Skip to content

UDT parameter for requests #487

Open

Description

@jwoyame

Hello!

I see that request.js has a function validateParameters which goes through all of the request parameters and calls validate on each one's type, passing the parameter's value to check.

The UDT type does not have a validate function defined in data-type.js. This is a problem if you create a request with a UDT parameter and initiate callProcedure on it, because it tries to validate the parameters.

I am willing to contribute to fix this issue. However, I want some input on the best way to address this. There are two good options:

  1. Have validateParameters skip parameters whose type does not have a validate function.
  2. Create a validate function for UDT that does... something. Maybe just returns the value without doing anything?

Any suggestions? Thanks!

Activity

  1. tvrprasad commented on Jan 4, 2017

    @tvrprasad
    Contributor

    UDT is not the only type that does not have 'validate' function. This is the full list of types that don't seem to have 'validate' :
    INTN, NTEXT, BITN, DECIMALN, NUMERICN, FLTN, MONEYN, DATETIMN, XML, UDTTYPE, SSVARIANTTYPE

    I think there is more work to support these parameter types than just adding a dummy 'validate'. If you see the constructor for RpcRequestPayload in rpcrequest-payload.js, it also invokes writeTypeInfo and writeParameterData on the type, and these are also missing for the UDTTYPE as well as the other types listed above.

    I think you need real implementations for the three methods at a minimum to support a type - 'validate', 'writeTypeInfo' and 'writeParameterData'.

    Seems like there is support for reading UDTTYPE. If you feel inspired to add support for UDTTYPE parameter, a look at readUDTInfo in metadata-parser.js might help.

  2. VitorBisterso commented on Aug 7, 2018

    @VitorBisterso

    I've also had this problem. To solve it, I just changed "NTEXT" to "VARCHAR". It's still not fixed, please fix.

  3. added
    known issue
    on Dec 17, 2019
  4. samlof commented on Aug 16, 2022

    @samlof

    I get error Invalid column type from bcp client for colid when trying to send geometry types with bulk load. It tries to use varbinary which bcp protocol doesn't seem to like. Think it's related to this same UDT parameters. I'm using through mssql

    http://tediousjs.github.io/tedious/api-datatypes.html at least has UDT listed as not supported as parameters

  5. MichaelSun90 commented on Aug 17, 2022

    @MichaelSun90
    Contributor

    Hi @samlof, Thanks for bring this one up. If you go to the "Other Data Types" table, under parameter column of UDT's row, you can see it is marked as "-". Maybe you missed this part. We are also looking into better support these types like what Arthur mentioned in #678.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-plannedknown issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions