You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
//const pool = require("./connect");
|
|
import {createConnection, QueryError, RowDataPacket} from 'mysql2';
|
|
|
|
/*const Pool = mysql.createPool({
|
|
host: process.env.HOST,
|
|
user: process.env.DATABASE,
|
|
database: process.env.DATABASE,
|
|
password: process.env.PASSWORD,
|
|
waitForConnections: true,
|
|
connectionLimit: 10,
|
|
queueLimit: 0
|
|
});*/
|
|
|
|
//interface definitionInterface{
|
|
// (message:string):void;
|
|
//}
|
|
|
|
const connection = createConnection({
|
|
host: process.env.HOST,
|
|
user: process.env.DATABASE,
|
|
database: process.env.DATABASE,
|
|
password: process.env.PASSWORD,
|
|
waitForConnections: true,
|
|
connectionLimit: 10,
|
|
queueLimit: 0
|
|
});
|
|
|
|
connection.query('SELECT * FROM `members` WHERE 1', (err: QueryError, rows: RowDataPacket[]) => {
|
|
console.log('The solution is: ', rows);
|
|
});
|
|
|
|
/*export default function Select(sql: string, callback: definitionInterface) {
|
|
pool.getConnection(function(err, conn) {
|
|
conn.query(sql , function(err, rows) {
|
|
callback(rows);
|
|
});
|
|
pool.releaseConnection(conn);
|
|
})
|
|
|
|
}*/ |