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

"parameter.type.validate is not a function" when using "geometry" data type #722

Closed
AlexMesser opened this issue Mar 29, 2018 · 2 comments
Closed

Comments

@AlexMesser
Copy link

Hi! I am using node-mssql and trying to save column with geography data type. Node-mssql supports that type (sql.Geography) but tedious falls on validateParameters() function.

This is what I trying:

INSERT INTO "post"("id", "geoType") VALUES (@0, @1)

with parameters:

[{"value":1,"type":"int","params":[]},
{"value":"POINT (100 100)","type":"geometry","params":[]}]

tedious falls with parameter.type.validate is not a function error.

I put log before const value = parameter.type.validate(parameter.value); code:

{ type: 
   { id: 56,
     type: 'INT4',
     name: 'Int',
     declaration: [Function: declaration],
     writeTypeInfo: [Function: writeTypeInfo],
     writeParameterData: [Function: writeParameterData],
     validate: [Function: validate] },
  name: 0,
  value: 1,
  output: false,
  length: undefined,
  precision: undefined,
  scale: undefined }
{ type: { id: 240, type: 'UDTTYPE', name: 'UDT', hasUDTInfo: true },
  name: 1,
  value: 'POINT (100 100)',
  output: false,
  length: undefined,
  precision: undefined,
  scale: undefined }

as we see, second type have wrong definition. What am I doing wrong ?

@Suraiya-Hameed
Copy link
Member

@AlexMesser tedious doesn't support geography data type, refer http://tediousjs.github.io/tedious/api-datatypes.html

As per node-mssql doc ,

node-mssql has built-in serializer for Geography and Geometry CLR data types.

It must be converting geography to some data type that tedious supports. Please raise this issue in node-mssql.

@AlexMesser
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants