www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

db.php (486B)


      1 <?php
      2 
      3 $getDBSingleton = null;
      4 
      5 function getDB() {
      6 	global $getDBSingleton;
      7 	
      8 	if (!$getDBSingleton) {
      9 		date_default_timezone_set('Europe/Paris');
     10 		$SQL_DBNAME = (dirname(__FILE__) . "/db");
     11 		if (!$getDBSingleton = new SQlite3($SQL_DBNAME)) {
     12 			throw new Exception("Erreur lors de l'ouverture de la base de données SQLite3", 1);
     13 		}
     14 	}
     15 	return $getDBSingleton;
     16         
     17         }
     18 
     19 function closeDB() {
     20 	global $getDBSingleton;
     21 
     22 	if ($getDBSingleton) $getDBSingleton->close();
     23 }
     24 
     25 ?>