1.3.2 • Published 7 years ago

@gdksoftware/mysql v1.3.2

Weekly downloads
6
License
ISC
Repository
bitbucket
Last release
7 years ago

@gdksoftware/mysql

This is a wrapper for the mysql package. It makes it easier to connect and execute queries. It supports both common Javascript and TypeScript as well. One of the advantages is that you don't have to think about ending the connection with the database. The query command will do this automatically for you.

Installation

npm install @gdksoftware/mysql
yarn add @gdksoftware/mysql
bower install @gdksoftware/mysql --save

Usage

Javascript

const MySQL = require('@gdksoftware/mysql');

let db = new MySQL({
    host: 'localhost',
    user: 'root',
    password: 'pwd',
    port: '3306',
    database: 'mydb'
})


// Query without parameters
db.query('SELECT * FROM user').then((rows) => {
  
  // Do something with the given rows
}, (err) => {

  // Handle the exception
})

TypeScript

The import differs For TypeScript, but you can use it like the common Javascript example.

import MySQL from '@gdksoftware/mysql';

// Query with parameters
let userid = 100
db.query('SELECT * FROM user WHERE id = ?', [userid]).then((rows) => {
  
  // Do something with the given rows
}, (err) => {

  // Handle the exception
})

Package built by GDK Software NL / GDK Software UK

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago