aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/dblayer/functions_mysql.inc.php10
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php9
-rw-r--r--include/dblayer/functions_pgsql.inc.php9
-rw-r--r--include/dblayer/functions_sqlite.inc.php9
4 files changed, 28 insertions, 9 deletions
diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php
index 6c8248f92..6ada73a59 100644
--- a/include/dblayer/functions_mysql.inc.php
+++ b/include/dblayer/functions_mysql.inc.php
@@ -32,14 +32,18 @@ define('DB_RANDOM_FUNCTION', 'RAND');
*
*/
-function pwg_db_connect($host, $user, $password, $database)
+function pwg_db_connect($host, $user, $password, $database=null, $die=true)
{
- $link = mysql_connect($host, $user, $password) or my_error('mysql_connect', false);
- mysql_select_db($database, $link) or my_error('mysql_select_db', false);
+ $link = @mysql_connect($host, $user, $password) or my_error('mysql_connect', $die);
return $link;
}
+function pwg_select_db($database, $link, $die=true)
+{
+ return @mysql_select_db($database, $link) or my_error('mysql_select_db', $die);
+}
+
function pwg_db_check_charset()
{
defined('PWG_CHARSET') and defined('DB_CHARSET')
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index dc326c220..aba554341 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -33,7 +33,7 @@ define('DB_RANDOM_FUNCTION', 'RANDOM');
*
*/
-function pwg_db_connect($host, $user, $password, $database)
+function pwg_db_connect($host, $user, $password, $database, $die=true)
{
global $conf;
@@ -42,7 +42,7 @@ function pwg_db_connect($host, $user, $password, $database)
try {
$link = new PDO($db_file);
} catch (Exception $e) {
- my_error('sqlite::open', true);
+ my_error('sqlite::open', $die);
}
$link->sqliteCreateFunction('now', 'pwg_now', 0);
@@ -56,6 +56,11 @@ function pwg_db_connect($host, $user, $password, $database)
return $link;
}
+function pwg_select_db($database=null, $link=null, $die=null)
+{
+ return true;
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/dblayer/functions_pgsql.inc.php b/include/dblayer/functions_pgsql.inc.php
index 64e59544e..fe350d090 100644
--- a/include/dblayer/functions_pgsql.inc.php
+++ b/include/dblayer/functions_pgsql.inc.php
@@ -33,7 +33,7 @@ define('DB_RANDOM_FUNCTION', 'RANDOM');
*
*/
-function pwg_db_connect($host, $user, $password, $database)
+function pwg_db_connect($host, $user, $password, $database, $die=true)
{
$connection_string = '';
if (strpos($host,':') !== false)
@@ -49,11 +49,16 @@ function pwg_db_connect($host, $user, $password, $database)
$user,
$password,
$database);
- $link = pg_connect($connection_string) or my_error('pg_connect', false);
+ $link = pg_connect($connection_string) or my_error('pg_connect', $die);
return $link;
}
+function pwg_select_db($database=null, $link=null, $die=null)
+{
+ return true;
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index 17ef6d576..ce426b9e0 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)
+function pwg_db_connect($host, $user, $password, $database, $die=true)
{
global $conf;
@@ -50,7 +50,7 @@ function pwg_db_connect($host, $user, $password, $database)
try {
$link = new SQLite3($db_file, $sqlite_open_mode);
} catch (Exception $e) {
- my_error('sqlite::open', true);
+ my_error('sqlite::open', $die);
}
$link->createFunction('now', 'pwg_now', 0);
@@ -64,6 +64,11 @@ function pwg_db_connect($host, $user, $password, $database)
return $link;
}
+function pwg_select_db($database=null, $link=null, $die=null)
+{
+ return true;
+}
+
function pwg_db_check_charset()
{
return true;