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

sp-mysql

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sp-mysql

super-project moudle for mysql operate.

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

sp-mysql

super-project moudle for mysql operate.

Usage

Init

Config More: https://github.com/mysqljs/mysql#connection-options

import spMysql from 'sp-mysql'

const config = {
    host: '127.0.0.1',
    port: '3306',
    user: 'xxxx',
    password: 'xxxx',
    database: 'db_name'
}

const mysql = new spMysql(config)


Query



let sql = 'SELECT 1 + 1 AS Test'
let [result] = await mysql.query(sql)

// result 查询结果并保护下面数据
// { affectedRows, insertId } = result

Debug

Use debug for log.

设置环境变量

set DEBUG=*             # 全部信息
set DEBUG=MySQL*        # MySQL相关信息,包括(info\log\errro)
set DEBUG=MySQL:info    # info信息
set DEBUG=MySQL:log     # log信息,执行sql
set DEBUG=MySQL:error   # error错误信息

Test Connection

mysql.testConnect()

// console => MySQL:info DB ['db_name'] connected √
//         => MySQL:info DB ['db_name'] connect failed X

Keywords

mysql

FAQs

Package last updated on 10 Nov 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