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

db-info

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

db-info

Node.js relational database information utility

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
186
decreased by-50.27%
Maintainers
1
Weekly downloads
 
Created
Source

db-info

db-info is a utility module which provides a database independent way of getting database metadata.

The following databases are currently supported:

  • sqlite3 - via: node-sqlite3
  • mysql - via: node-mysql
  • PostgreSQL - via: node-postgres
  • Oracle - via: node-oracle

Quick Examples

var dbinfo = require("db-info");

dbinfo.getInfo({
  driver: 'mysql',
  user: 'root',
  password: 'root',
  database: 'test'
}, function(err, result) {
  /* result = {
    tables: {
      person: {
        name: 'person',
        columns: {
          'id': { name: 'id', notNull: true, primaryKey: true, type: 'integer', length: '11' },
          'name': { name: 'name', notNull: true, type: 'varchar', length: '255' },
          'email': { name: 'email', notNull: false, type: 'varchar', length: '100' },
          'age': { name: 'age', notNull: false, type: 'integer', length: '11' }
        }
      }
    }
  } */
});

Download

You can install using Node Package Manager (npm):

npm install async

Documentation

Command Line

db-info --driver=pg --connectionString=--connectionString=tcp://test:test@localhost/test

getInfo(opts, callback)

Gets the metadata from a database.

Arguments

  • opts - A hash of options.
  • driver - can be either "mysql", "sqlite3", "db-oracle", or "pg" (PostgreSQL)
  • db - if db is passed in this connection will be used instead of making a new connection.
  • other - will be passed to the drivers connect.
  • callback(err, result) - Callback called once complete. result will contain a hash containing all the tables along with column information.

Example

var db = new sqlite3.Database(':memory:');

dbinfo.getInfo({
  driver: 'sqlite3',
  db: db
}, function(err, result) {
});

Keywords

FAQs

Package last updated on 02 Apr 2012

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