Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/tedious

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/tedious

TypeScript definitions for tedious

  • 4.0.14
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
decreased by-10.52%
Maintainers
1
Weekly downloads
 
Created

What is @types/tedious?

@types/tedious provides TypeScript type definitions for the 'tedious' package, which is a TDS (Tabular Data Stream) protocol implementation for Node.js. It allows you to connect to and interact with Microsoft SQL Server databases.

What are @types/tedious's main functionalities?

Connecting to a SQL Server

This code demonstrates how to establish a connection to a SQL Server using the 'tedious' package. The configuration object includes server details, authentication options, and database name.

const { Connection } = require('tedious');
const config = {
  server: 'your_server_name',
  authentication: {
    type: 'default',
    options: {
      userName: 'your_username',
      password: 'your_password'
    }
  },
  options: {
    database: 'your_database_name'
  }
};
const connection = new Connection(config);
connection.on('connect', err => {
  if (err) {
    console.error('Connection failed', err);
  } else {
    console.log('Connected');
  }
});

Executing a SQL Query

This code demonstrates how to execute a SQL query using the 'tedious' package. It creates a new Request object with the SQL query and a callback function to handle the results.

const { Request } = require('tedious');
const request = new Request('SELECT * FROM your_table_name', (err, rowCount, rows) => {
  if (err) {
    console.error('Query failed', err);
  } else {
    console.log(`${rowCount} rows returned`);
    rows.forEach(row => {
      console.log(row);
    });
  }
});
connection.execSql(request);

Handling SQL Server Events

This code demonstrates how to handle various events emitted by the SQL Server connection, such as errors and connection closure.

connection.on('error', err => {
  console.error('Connection error', err);
});
connection.on('end', () => {
  console.log('Connection closed');
});

Other packages similar to @types/tedious

FAQs

Package last updated on 07 Nov 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc