Skip to content

always on encryption

Compare
Choose a tag to compare
@TimelordUK TimelordUK released this 30 Nov 23:01
· 305 commits to master since this release
d32dd51

new promise to cancel a query from returned Query

  it('use promise on query to cancel', async function handler () {
    const conn = env.theConnection
    const waitsql = env.waitForSql(20)
    const q = conn.query(waitsql)
    const err = await q.promises.cancel()
    assert(err.message.includes('Operation canceled'))
  })

new promise to call on a fetched procedure

    await createProc(spName)
    const msg = 'hello world'
    const proc = await env.theConnection.promises.getProc(spName)
    const res = await proc.promises.call({
      param: msg
    })

image

improved typings and JSDoc in index.d.ts - part 1 this will be continued in future releases, any contributions from TS typings experts very much welcome.

any changes must be compatible with current typescript test code

i.e. npm run build must compile

npm run build
> msnodesqlv8@3.0.0 build
> tsc


msnodesqlv8 git(master) node .\dist\samples\typescript\builder.js
IF OBJECT_ID('dbo.tmpTableBuilder', 'U') IS NOT NULL DROP TABLE dbo.tmpTableBuilder;
CREATE TABLE dbo.tmpTableBuilder ([id] int , [col_a] int NOT NULL, [col_b] varchar (100) NOT NULL, [col_c] int NOT NULL, [col_d] int NOT NULL, [col_e] varchar (100) NOT NULL)
[
    {
        "id": 0,
        "col_a": 0,
        "col_b": "str_0",
        "col_c": 1,
        "col_d": -1,
        "col_e": "str2_0"
    },
    {
        "id": 1,
        "col_a": 5,
        "col_b": "str_1",
        "col_c": 2,
        "col_d": 0,
        "col_e": "str2_1"
    },
    {
        "id": 2,
        "col_a": 10,
        "col_b": "str_2",
        "col_c": 3,
        "col_d": 1,
        "col_e": "str2_2"
    },
    {
        "id": 3,
        "col_a": 15,
        "col_b": "str_3",
        "col_c": 4,
        "col_d": 2,
        "col_e": "str2_3"
    },
    {
        "id": 4,
        "col_a": 20,
        "col_b": "str_4",
        "col_c": 5,
        "col_d": 3,
        "col_e": "str2_4"
    }
]
CREATE TYPE dbo.tmpTableBuilderType AS TABLE ([id] int , [col_a] int , [col_b] varchar (100) , [col_c] int , [col_d] int , [col_e] varchar (100) )
create or alter procedure dbo.tmpTableBuilder_tvp_inserter
    (
      @tvp dbo.tmpTableBuilderType READONLY
    )
    AS
    BEGIN
      set nocount on
      INSERT INTO dbo.tmpTableBuilder
      (
        [id],
                [col_a],
                [col_b],
                [col_c],
                [col_d],
                [col_e]
      )
      SELECT
        [id],
                [col_a],
                [col_b],
                [col_c],
                [col_d],
                [col_e]
      n FROM @tvp tvp
    END
id 0 equals true
id 1 equals true
id 2 equals true
id 3 equals true
id 4 equals true
done

#265

always on encryption now working on stored proc and bound table calls - please see tests\encrypt.js

e.g with table below

CREATE TABLE node.dbo.test_encrpted_table (
[id] int IDENTITY(1,1) NOT NULL, [field] int ENCRYPTED WITH 
     (COLUMN_ENCRYPTION_KEY = [CEK_Auto1],   
     ENCRYPTION_TYPE = Deterministic, 
    ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256'))
    const table = await conn.promises.getTable('test_encrpted_table')
    const v = 
[
  {
    field: 12345,
  },
]
    await table.promises.insert(v)
   

electron v22 binaries included