ajout de setup_server_debian.sh

This commit is contained in:
2025-03-03 08:47:52 +01:00
parent 2ceb4be24f
commit 2629dd832c
13 changed files with 699 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
class Database {
private $pdo;
public function __construct($config) {
$dsn = "pgsql:host={$config['host']};dbname={$config['dbname']}";
try {
$this->pdo = new PDO($dsn, $config['user'], $config['password'], [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
} catch (PDOException $e) {
die('Connection failed: ' . $e->getMessage());
}
}
public function getDefaultSchema() {
$query = "SELECT current_schema()";
$stmt = $this->pdo->query($query);
return $stmt->fetchColumn();
}
public function getPDO() {
return $this->pdo;
}
}