Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDT parameter for requests #487

Open
jwoyame opened this issue Dec 19, 2016 · 4 comments
Open

UDT parameter for requests #487

jwoyame opened this issue Dec 19, 2016 · 4 comments
Labels
feature-planned known issue for any issue that has been reported or there's a PR with the fix

Comments

@jwoyame
Copy link

jwoyame commented Dec 19, 2016

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!

@tvrprasad
Copy link
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.

@VitorBisterso
Copy link

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

@samlof
Copy link

samlof commented Aug 16, 2022

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

@MichaelSun90
Copy link
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
Labels
feature-planned known issue for any issue that has been reported or there's a PR with the fix
Projects
None yet
Development

No branches or pull requests

6 participants