New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

promisified-tedious

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promisified-tedious

A promisified layer over Tedious package

latest
Source
npmnpm
Version
0.5.1
Version published
Weekly downloads
97
-9.35%
Maintainers
1
Weekly downloads
 
Created
Source

promisified-tedious

A promisified layer over Tedious package

Usage Example

import {Connection, Request, TYPES} from 'promisified-tedious';

async function getUser(username) {
  const conn = new Connection({ /* configuration */ });

  try {
    await conn.connect();
  } catch(err) {
    console.error(err);
    return;
  }
  
  try {
    const request = new Request('SELECT * FROM [dbo].[users] WHERE [username] = @user');
    
    request.addParameter('user', TYPES.VarChar, 'admin');

    const result = await conn.execSql(request);
    
    const user = result[0];
  
  } catch(err) {
    console.error(err);
  } finally {
    await conn.close();
  }
}

Installation

npm i promisified-tedious

Version

Version 0.5.x uses tedious@14.3.x

Documentation

This package tries to provide the same interface as the Tedious package.

All callback parameters are removed.

Please refer to the official Tedious documentation for more details.

Transaction

const conn; // Connection

await conn.beginTransaction();

await conn.saveTransaction();

await conn.commitTransaction();

await conn.rollbackTransaction();

Request

const conn; // Connection

const request = new Request('SELECT 1 AS n FROM [dbo].[numbers]');

await conn.execSql(request); // [ { n: 1 } ]

Bulk Load

const conn; // Connection

const bulk = conn.newBulkLoad('[dbo].[users]', {keepNulls: true});

bulk.addColumn('username', TYPES.VarChar, {nullable: false});
bulk.addColumn('password', TYPES.VarChar, {nullable: false});

await conn.execBulkLoad(bulk, [ {username: 'admin', password: 'qwerty'} ]);

Tedious license

Copyright (c) 2010-2021 Mike D Pilsbury

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

more details about the license

Keywords

tedious

FAQs

Package last updated on 04 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts