Skip to content

Node JS Default Type Handling #22

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

Open
edward-coombes-nuodb opened this issue Mar 8, 2022 · 0 comments
Open

Node JS Default Type Handling #22

edward-coombes-nuodb opened this issue Mar 8, 2022 · 0 comments

Comments

@edward-coombes-nuodb
Copy link
Contributor

TLDR: Don brings up a good point of whether the default case of treating data as a string by default makes sense. The only types not specifically handled in the nodejs driver are the binary types, and the blob/clob types. Binary types should definitely be handled as numbers so that the developer can take advantage of javascript's bitwise operators, and clobs should absolutely be strings.

Copied from JIRA:

The implication is we think all types not called out have a logical VARCHAR translation. Here is the enum, but I am not sure what make sense, for example not all types are specifically handled, but some types are numbers not strings.

enum SqlType

{ NUOSQL_NULL = 0, /< Represents SQL value NULL (0) */ NUOSQL_BIT = -7, /< Type code representing the SQL type BIT (-7) */ NUOSQL_TINYINT = -6, /< Type code representing the SQL type BYTE (-6) */ NUOSQL_SMALLINT = 5, /< Type code representing the SQL type SMALLINT (5) */ NUOSQL_INTEGER = 4, /< Type code representing the SQL type INTEGER (4) */ NUOSQL_BIGINT = -5, /< Type code representing the SQL type BIGINT (-5) */ NUOSQL_FLOAT = 6, /< Type code representing the SQL type FLOAT (6) */ NUOSQL_DOUBLE = 8, /< Type code representing the SQL type DOUBLE (8) */ NUOSQL_CHAR = 1, /< Type code representing the SQL type CHAR (1) */ NUOSQL_VARCHAR = 12, /< Type code representing the SQL type VARCHAR (12) */ NUOSQL_LONGVARCHAR = -1, /< Type code representing the SQL type LONGVARCHAR (-1) */ NUOSQL_DATE = 91, /< Type code representing the SQL type DATE (91) */ NUOSQL_TIME = 92, /< Type code representing the SQL type TIME (92) */ NUOSQL_TIMESTAMP = 93, /< Type code representing the SQL type TIMESTAMP (93) */ NUOSQL_BLOB = 2004, /< Type code representing the SQL type BLOB (2004) */ NUOSQL_CLOB = 2005, /< Type code representing the SQL type CLOB (2005) */ NUOSQL_NUMERIC = 2, /< Type code representing the SQL type NUMERIC (2) */ NUOSQL_DECIMAL = 3, /< Type code representing the SQL type DECIMAL (3) */ NUOSQL_BOOLEAN = 16, /< Type code representing the SQL type BOOLEAN (16) */ NUOSQL_BINARY = -2, /< Type code representing the SQL type BINARY (-2) */ NUOSQL_LONGVARBINARY = -4, /**< Type code representing the SQL type LONGVARBINARY (-4) */ NUOSQL_TYPE_UNUSED = 0 }

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

1 participant