Napoleonic Political Magnificence

execsql

0.0.3 • Public • Published

execsql

An npm project. Node.js Execute you *.sql file which contains multiple sql statements. Usate: init database.

Usage

As a CLI tool

  1. Make sure that you have execsql installed globally

    npm install -g execsql
  2. Configure your db access for the first time

    execsql -c "localhost" "root" "root"
  • Execute a bunch of sql statements

    execsql "use db_cam; delete from admin;"
  • Execute a .sql file

    execsql -f ./db.sql

As a Node dependency

  1. Make sure that you have execsql installed locally

    npm install execsql
  2. Require and use

    var execsql = require('execsql'),
        dbConfig = {
            host: 'localhost',
            user: 'root',
            password: 'root'
        },
        sql = 'use db_cam;',
        sqlFile = __dirname + '/db.sql';
    execsql.config(dbConfig)
        .exec(sql)
        .execFile(sqlFile, function(err, results){
            console.log(results);
        }).end();

install

npm i execsql

Downloadsweekly downloads

188

version

0.0.3

license

BSD-2-Clause

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability