How to use the mssql.DateTimeOffset function in mssql

To help you get started, we’ve selected a few mssql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DFEAGILEDEVOPS / MTC / admin / services / data-access / sql.service.js View on Github external
value,
      type: R.prop(findDataType(cacheData.dataType), sqlService.TYPES),
      options
    })
  }
  return params
}

/** SQL Service **/
const sqlService = {
  // SQL type-mapping adapter.  Add new types as required.
  TYPES: {
    BigInt: mssql.BigInt,
    Bit: mssql.Bit,
    Char: mssql.Char,
    DateTimeOffset: mssql.DateTimeOffset,
    DateTime: mssql.DateTime,
    DateTime2: mssql.DateTime2,
    Decimal: mssql.Decimal,
    Float: mssql.Float,
    Int: mssql.Int,
    Numeric: mssql.Numeric,
    NVarChar: mssql.NVarChar,
    Real: mssql.Real,
    SmallInt: mssql.SmallInt,
    UniqueIdentifier: mssql.UniqueIdentifier
  }
}

// Name of the admin database
sqlService.adminSchema = '[mtc_admin]'
github DFEAGILEDEVOPS / MTC / design / z_archive / census-import / services / data-access / sql.service.js View on Github external
value,
      type: R.prop(findDataType(cacheData.dataType), sqlService.TYPES),
      options
    })
  }
  return params
}

/** SQL Service **/
const sqlService = {
  // SQL type-mapping adapter.  Add new types as required.
  TYPES: {
    BigInt: mssql.BigInt,
    Bit: mssql.Bit,
    Char: mssql.Char,
    DateTimeOffset: mssql.DateTimeOffset,
    Decimal: mssql.Decimal,
    Float: mssql.Float,
    Int: mssql.Int,
    Numeric: mssql.Numeric,
    NVarChar: mssql.NVarChar,
    Real: mssql.Real,
    SmallInt: mssql.SmallInt,
    UniqueIdentifier: mssql.UniqueIdentifier
  }
}

// Name of the admin database
sqlService.adminSchema = '[mtc_admin]'

sqlService.initPool = async () => {
  if (pool) {
github DFEAGILEDEVOPS / MTC / deploy / sql / schema-WIP / sql.service.js View on Github external
value,
      type: R.prop(findDataType(cacheData.dataType), sqlService.TYPES),
      options
    })
  }
  return params
}

/** SQL Service **/
const sqlService = {
  // SQL type-mapping adapter.  Add new types as required.
  TYPES: {
    BigInt: mssql.BigInt,
    Bit: mssql.Bit,
    Char: mssql.Char,
    DateTimeOffset: mssql.DateTimeOffset,
    DateTime: mssql.DateTime,
    DateTime2: mssql.DateTime2,
    Decimal: mssql.Decimal,
    Float: mssql.Float,
    Int: mssql.Int,
    Numeric: mssql.Numeric,
    NVarChar: mssql.NVarChar,
    Real: mssql.Real,
    SmallInt: mssql.SmallInt,
    UniqueIdentifier: mssql.UniqueIdentifier
  }
}

// Name of the admin database
sqlService.adminSchema = '[mtc_admin]'
github DFEAGILEDEVOPS / MTC / tslib / src / tests-integration / sql.service.integration.spec.ts View on Github external
test('datetime is stored with hundred millisecond accuracy', async () => {
    const isoDateTimeValue = '2000-01-01T15:00:00.123'
    const dateToModify = new Date(isoDateTimeValue)
    const sql = `UPDATE mtc_admin.[attendanceCode] SET createdAt=@createdAt
      WHERE code=@code`
    const params = [
      {
        name: 'createdAt',
        type: mssql.DateTimeOffset,
        value: dateToModify
      },
      {
        name: 'code',
        type: mssql.Char,
        value: 'ABSNT'
      }
    ]
    await sut.modify(sql, params)
    const result = await sut.query(`SELECT createdAt FROM
      mtc_admin.attendanceCode WHERE code='ABSNT'`)
    expect(result).toBeDefined()
    const record = result[0]
    expect(record.createdAt).toBeDefined()
    expect(isMoment(record.createdAt)).toBe(true)
    const dbValueAsMoment = moment(record.createdAt)