From 4773d7a35052df4683b0445c08feae609764bfb0 Mon Sep 17 00:00:00 2001 From: nikrou Date: Sun, 21 Mar 2010 22:51:36 +0000 Subject: Feature 1255 : only one function use exceptions to deal with differents possible errors git-svn-id: http://piwigo.org/svn/trunk@5236 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/dblayer/functions_sqlite.inc.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'include/dblayer/functions_sqlite.inc.php') diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php index ce426b9e0..7f02a06d1 100644 --- a/include/dblayer/functions_sqlite.inc.php +++ b/include/dblayer/functions_sqlite.inc.php @@ -33,7 +33,7 @@ define('DB_RANDOM_FUNCTION', 'RANDOM'); * */ -function pwg_db_connect($host, $user, $password, $database, $die=true) +function pwg_db_connect($host, $user, $password, $database) { global $conf; @@ -47,10 +47,11 @@ function pwg_db_connect($host, $user, $password, $database, $die=true) { $sqlite_open_mode = SQLITE3_OPEN_READWRITE; } - try { - $link = new SQLite3($db_file, $sqlite_open_mode); - } catch (Exception $e) { - my_error('sqlite::open', $die); + + $link = new SQLite3($db_file, $sqlite_open_mode); + if (!$link) + { + throw new Exception('Connection to server succeed, but it was impossible to connect to database'); } $link->createFunction('now', 'pwg_now', 0); @@ -64,11 +65,6 @@ function pwg_db_connect($host, $user, $password, $database, $die=true) return $link; } -function pwg_select_db($database=null, $link=null, $die=null) -{ - return true; -} - function pwg_db_check_charset() { return true; -- cgit v1.2.3