Jedaii_Competitive_Script/database.js
2024-08-17 00:46:46 +02:00

36 lines
719 B
JavaScript

// database.js
const mysql = require('mysql2/promise');
const dbConfig = {
host: "95.217.113.161",
user: "Likima",
password: "27As$r0q1",
database: "jedaiito",
charset: "utf8"
};
const pool = mysql.createPool({
...dbConfig,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
});
async function updatePlayerElo(player) {
const connection = await pool.getConnection();
try {
const updateQuery = `
UPDATE players
SET elo = ?
WHERE guid = ?
`;
await connection.query(updateQuery, [player.elo, player.guid]);
} finally {
connection.release();
}
}
module.exports = {
updatePlayerElo,
};