add more mysql stuff

This commit is contained in:
2023-07-12 09:06:29 +02:00
parent 865141d945
commit fbedf9e95e
13 changed files with 105 additions and 65 deletions

View File

@@ -1,15 +1,40 @@
const mysql = require( 'promise-mysql' );
/*
* libreevent - mysqldb.js
*
* Created by Janis Hutz 07/12/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
const mysql = require( 'mysql' );
const db = require( './db.js' );
// If the connection does not work for you, you will need to add your ip
// to the whitelist of the database
class SQLDB {
constructor () {
this.sqlconnection = mysql.createConnection( {
host: 'janishutz.com',
port: '3306',
user: 'janishut_libreeventTest',
password: '^PVgj&xkaQKmMDCgz&2^aCaYxc7nCS#*%7%',
connectionLimit: 200
this.sqlConnection = mysql.createConnection( db.getJSONDataSync( '/config/db.config.secret.json' ) );
}
connect () {
this.sqlConnection.connect( function( err ) {
if ( err ) {
console.error( 'error connecting: ' + err.stack );
return;
}
return 'connection';
} );
}
disconnect () {
this.sqlConnection.end();
}
async setupDB () {
this.sqlConnection.query( '' );
}
}
module.exports = SQLDB;