-
Notifications
You must be signed in to change notification settings - Fork 445
feat: Json data type #1683
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
base: master
Are you sure you want to change the base?
feat: Json data type #1683
Changes from 2 commits
2502664
9ffc9a9
5793724
127dd31
d53f039
0630b26
527cea2
8dddb82
091ed6f
2ccb056
38fb742
c4aea72
2a8b989
8f19878
f715b4b
937e6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||||||
| import { type DataType } from '../data-type'; | ||||||||||
| const UNKNOWN_PLP_LEN = Buffer.from([0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]); | ||||||||||
| const PLP_TERMINATOR = Buffer.from([0x00, 0x00, 0x00, 0x00]); | ||||||||||
| const MAX_NULL_LENGTH = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||||||||||
|
|
||||||||||
| const Json: DataType = { | ||||||||||
| id: 0xF4, | ||||||||||
| type: 'JSON', | ||||||||||
| name: 'Json', | ||||||||||
|
|
||||||||||
| declaration: (parameter) => { | ||||||||||
| return 'json'; | ||||||||||
| }, | ||||||||||
| resolveLength: (parameter) => { | ||||||||||
| if ((parameter.value instanceof String || typeof (parameter.value) == 'string')) | ||||||||||
| return parameter.value.length; | ||||||||||
| else return JSON.stringify(parameter.value).length; | ||||||||||
|
||||||||||
| return parameter.value.length; | |
| else return JSON.stringify(parameter.value).length; | |
| return Buffer.byteLength(parameter.value, 'utf8'); | |
| else return Buffer.byteLength(JSON.stringify(parameter.value), 'utf8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also isn't accurate. To my knowledge this is sent by Tedious as nvarchar at serialization time -- the correct length is as indicated. @arthurschreiber thoughts?
Uh oh!
There was an error while loading. Please reload this page.