aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-05-07 00:34:56 +0000
committerplegall <plg@piwigo.org>2010-05-07 00:34:56 +0000
commit48ab33321212614bb37e180f17c84139665de7d1 (patch)
treec550ae73be0cd1a75187fb7f9d0d4dbef298c8f9 /include/dblayer
parenta56af865c572bd1f9853b2d858df648e154e764e (diff)
bug 1648 fixed: add the pwg_db_check_version functions for pdo-sqlite, sqlite
and pgsql, also make the $pwg_db_link global in the install_db_connect function so that it can be used in SQLite functions. bug fixed: with pdo-sqlite, pwg_db_num_rows always returns 0, so when initializing user data, it tries to insert the same row twice. git-svn-id: http://piwigo.org/svn/trunk@6090 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/dblayer')
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php17
-rw-r--r--include/dblayer/functions_pgsql.inc.php15
-rw-r--r--include/dblayer/functions_sqlite.inc.php15
3 files changed, 46 insertions, 1 deletions
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index bc782074a..d59e3b510 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -21,7 +21,7 @@
// | USA. |
// +-----------------------------------------------------------------------+
-define('REQUIRED_PDO-SQLITE_VERSION', '3.0.0');
+define('REQUIRED_PDO_SQLITE_VERSION', '3.0.0');
define('DB_ENGINE', 'SQLite');
define('DB_REGEX_OPERATOR', 'REGEXP');
@@ -55,6 +55,21 @@ function pwg_db_connect($host, $user, $password, $database)
return $link;
}
+function pwg_db_check_version()
+{
+ $current_version = pwg_get_db_version();
+ if (version_compare($current_version, REQUIRED_PDO_SQLITE_VERSION, '<'))
+ {
+ fatal_error(
+ sprintf(
+ 'your database version is too old, you have "%s" and you need at least "%s"',
+ $current_version,
+ REQUIRED_PDO_SQLITE_VERSION
+ )
+ );
+ }
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/dblayer/functions_pgsql.inc.php b/include/dblayer/functions_pgsql.inc.php
index df1ce2649..5e05fb16a 100644
--- a/include/dblayer/functions_pgsql.inc.php
+++ b/include/dblayer/functions_pgsql.inc.php
@@ -60,6 +60,21 @@ function pwg_db_connect($host, $user, $password, $database)
}
}
+function pwg_db_check_version()
+{
+ $current_version = pwg_get_db_version();
+ if (version_compare($current_version, REQUIRED_PGSQL_VERSION, '<'))
+ {
+ fatal_error(
+ sprintf(
+ 'your database version is too old, you have "%s" and you need at least "%s"',
+ $current_version,
+ REQUIRED_PGSQL_VERSION
+ )
+ );
+ }
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index 48bb5fd89..5c8f76a9c 100644
--- a/include/dblayer/functions_sqlite.inc.php
+++ b/include/dblayer/functions_sqlite.inc.php
@@ -64,6 +64,21 @@ function pwg_db_connect($host, $user, $password, $database)
return $link;
}
+function pwg_db_check_version()
+{
+ $current_version = pwg_get_db_version();
+ if (version_compare($current_version, REQUIRED_SQLITE_VERSION, '<'))
+ {
+ fatal_error(
+ sprintf(
+ 'your database version is too old, you have "%s" and you need at least "%s"',
+ $current_version,
+ REQUIRED_SQLITE_VERSION
+ )
+ );
+ }
+}
+
function pwg_db_check_charset()
{
return true;