Skip to content

Node JS Default Type Handling #22

@edward-coombes-nuodb

Description

@edward-coombes-nuodb

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 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions