🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mysqldesc

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysqldesc

Describe mysql database. Get table names, column specs as a json object.

1.1.4
latest
Source
npm
Version published
Weekly downloads
22
29.41%
Maintainers
1
Weekly downloads
 
Created
Source

mysqldesc

Build Status Code Climate Code Coverage npm Version

Describe mysql database. Get table names, column specs as a json object.

Installation

npm install mysqldesc --save-dev

Usage

Describe database data.

var mysqldesc = require('mysqldesc');

// Mysql connect config.
var config = {
    user: 'root',
    password: 'my_password',
    host: 'localhost',
    database: 'my_db'
};
// Desc connected database
mysqldesc(config, function (err, data) {
    console.log("structure=" + JSON.stringify(data, null, 4));
});

This will result like:

structure = { // Tables in "my_db" database.
    "TEST_PERSON": { // Columns in "TEST_PERSON" table.
        "PersonID": { // Spec of "TEST_PERSON.PersonID" column.
            "Type": "int(11)",
            "Null": "YES",
            "Key": "",
            "Default": null,
            "Extra": ""
        },
        "LastName": {
            "Type": "varchar(255)",
            "Null": "YES",
            "Key": "",
            "Default": null,
            "Extra": ""
        }
    },
    "TEST_SHOP": {
        /*...*/
    }
};

API

SignatureDescription
mysqldesc(config, callback)Describe tables in the connected database.
mysqldesc(config, databaseName, callback)Describe tables in a specific database.
mysqldesc(config, databaseName, tableName, callback)Describe a specific table.
mysqldesc.keyColumnUsage(config, callback)Describe key column usage in the connected database.
mysqldesc.keyColumnUsage(config, databaseName, callback)Describe key column usage in a specific database.
mysqldesc.keyColumnUsage(config, databaseName, tableName, callback)Describe key column usage in a specific table.

Tips

Connection Options

mysqldesc uses node-mysql as connector. For more advanced setting, see the node-mysql documents about Connection options

License

This software is released under the MIT License.

  • node-mysql

Keywords

mysql

FAQs

Package last updated on 22 Apr 2017

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