From 8e03e68d687015b5cd8c9d3857e1a1d007252afa Mon Sep 17 00:00:00 2001 From: canyonknight Date: Sun, 3 Feb 2013 16:26:28 +0000 Subject: Add database wrapper class and new connection method Uses the Singleton pattern to ensure all queries use the same database connection that is released upon script completion. All database connections should now be called with DB::connect() and not db_connect(). Signed-off-by: canyonknight Signed-off-by: Lukas Fleischer --- web/lib/DB.class.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 web/lib/DB.class.php (limited to 'web/lib/DB.class.php') diff --git a/web/lib/DB.class.php b/web/lib/DB.class.php new file mode 100644 index 0000000..0975989 --- /dev/null +++ b/web/lib/DB.class.php @@ -0,0 +1,28 @@ +exec("SET NAMES 'utf8' COLLATE 'utf8_general_ci';"); + } catch (PDOException $e) { + die('Error - Could not connect to AUR database'); + } + } + + return self::$dbh; + } +} -- cgit v1.2.3-70-g09d2