Version 1.0.1.2 connection.release() in folder talas_v5_DB in all files
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
// /pages/api/talas_v5_DB/gisLines/updateLineCoordinates.js
|
||||||
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// pages/api/addLocation.js
|
// pages/api/talas_v5_DB/pois/addLocation.js
|
||||||
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
|||||||
@@ -6,16 +6,23 @@ import getPool from "../../../utils/mysqlPool"; // Singleton-Pool importieren
|
|||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
const pool = getPool(); // Singleton-Pool verwenden
|
const pool = getPool(); // Singleton-Pool verwenden
|
||||||
|
let connection;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Verbindung abrufen
|
||||||
|
connection = await pool.getConnection();
|
||||||
|
|
||||||
// Ausführen der Datenbankabfrage
|
// Ausführen der Datenbankabfrage
|
||||||
const query = "SELECT idprio, level, name, color FROM prio";
|
const query = "SELECT idprio, level, name, color FROM prio";
|
||||||
const [results] = await pool.query(query);
|
const [results] = await connection.query(query);
|
||||||
|
|
||||||
// Wichtig: Senden Sie die Antwort zurück
|
// Senden Sie die Antwort zurück
|
||||||
res.status(200).json(results); // Nur rows werden zurückgegeben
|
res.status(200).json(results);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Fehler beim Abrufen der API", error);
|
console.error("Fehler beim Abrufen der API", error);
|
||||||
res.status(500).json({ error: "Fehler bei der Abfrage" });
|
res.status(500).json({ error: "Fehler bei der Abfrage" });
|
||||||
|
} finally {
|
||||||
|
// Verbindung freigeben
|
||||||
|
if (connection) connection.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user