0.1.7 • Published 1 year ago

simpler-mysql v0.1.7

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
1 year ago

Simpler-Mysql

A package made to make your life easyer when dealing with MYSQL!

How to work with:

$ var sMysql = require('simpler-mysql');

$ sMysql.config(host, user, password, database));
// sMysql.config also takes the port as a last parameter, but if not given, it will fall into 3306 (MySQL Default)

Whit this done you have two options: The first is to work with single-queries connection, the library will connect to the database, do the transation and close the connection.

$ sMysql.query('SQL_STATEMENT');
// OR 
$ sMysql.query( 'SQL_WITH_PREPARE_?_STATEMENT_?' , [ arg1 , arg2 ] );

The second way is to connect, execute any amount of queries and then close the connection.

$ sMysql.connect();
// THEN  
$ sMysql.query( 'SQL_WITH_PREPARE_?_STATEMENT_?_1' , [ arg1 , arg2 ] );
$ sMysql.query( 'SQL_WITH_PREPARE_?_STATEMENT_?_2' , [ arg1 , arg2 ] );
$ sMysql.query( 'SQL_WITH_PREPARE_?_STATEMENT_?_3' , [ arg1 , arg2 ] );
// THEN
$ sMysql.close();

Note: If you leave the connection open, it will overload your database with unecessary connections and maybe causing it to crash!


Fixes 0.1.7 Version

 - Connection now tries 3 times and logs error in chat. ;

Fixes 0.1.6 Version

 - General fixes ;

Fixes 0.1.5 Version

 - Read.me instructions , use sMysql.query() instead of sMysql.execute() but ;

Fixes 0.1.4 Version

 - sMysql.execute( 'SQL_WITH_PREPARE_?_STATEMENT_?_1' , [ arg1 , arg2 ] );
    Always closing connection even when using 
    
    $ sMysql.connect();
    $ sMysql.close();

Fixes 0.1.3 Version

 - Consecutive calls, breaking connection on sMysql.query();
0.1.7

1 year ago

0.1.6

3 years ago

0.1.5

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago