www

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

db.inc (521B)


      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"); // .. parce que db.inc est dans un sous-dossier.
     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 function closeDB() {
     19 	global $getDBSingleton;
     20 
     21 	if ($getDBSingleton) $getDBSingleton->close();
     22 }
     23 
     24 ?>