diff options
author | nikrou <nikrou@piwigo.org> | 2010-03-29 18:16:33 +0000 |
---|---|---|
committer | nikrou <nikrou@piwigo.org> | 2010-03-29 18:16:33 +0000 |
commit | a6a3a6e0c271099b6f199c7363eba572fc7b5266 (patch) | |
tree | 25176b040dd1bc2b0ba7e7bbeda5704883c1c798 | |
parent | a37f1fbae1309c44531f36e0109b1f2bfecf2539 (diff) |
Fix some issues with database engines :
- insert into syntax not correct for posgresql or sqlite
- add languages table
- incorrect function for row count (sqlite)
git-svn-id: http://piwigo.org/svn/trunk@5452 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/include/languages.class.php | 10 | ||||
-rw-r--r-- | admin/include/themes.class.php | 13 | ||||
-rw-r--r-- | include/dblayer/functions_pdo-sqlite.inc.php | 2 | ||||
-rw-r--r-- | install.php | 5 | ||||
-rw-r--r-- | install/db/86-database.php | 2 | ||||
-rw-r--r-- | install/piwigo_structure-pdo-sqlite.sql | 13 | ||||
-rw-r--r-- | install/piwigo_structure-pgsql.sql | 14 | ||||
-rw-r--r-- | install/piwigo_structure-sqlite.sql | 13 |
8 files changed, 58 insertions, 14 deletions
diff --git a/admin/include/languages.class.php b/admin/include/languages.class.php index 6f3348c87..db9d17b42 100644 --- a/admin/include/languages.class.php +++ b/admin/include/languages.class.php @@ -78,11 +78,11 @@ class languages break; } - $query = " -INSERT INTO ".LANGUAGES_TABLE." - SET id = '".$language_id."', - name = '".$this->fs_languages[$language_id]."' -;"; + $query = ' +INSERT INTO '.LANGUAGES_TABLE.' + (id, name) + VALUES(\''.$language_id.'\', \''.$this->fs_languages[$language_id].'\') +;'; pwg_query($query); break; diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php index 41ee5f336..cf81fb54e 100644 --- a/admin/include/themes.class.php +++ b/admin/include/themes.class.php @@ -114,12 +114,13 @@ class themes if (empty($errors)) { - $query = " -INSERT INTO ".THEMES_TABLE." - SET id = '".$theme_id."' - , version = '".$this->fs_themes[$theme_id]['version']."' - , name = '".$this->fs_themes[$theme_id]['name']."' -;"; + $query = ' +INSERT INTO '.THEMES_TABLE.' + (id, version, name) + VALUES(\''.$theme_id.'\', + \''.$this->fs_themes[$theme_id]['version'].'\', + \''.$this->fs_themes[$theme_id]['name'].'\') +;'; pwg_query($query); } break; diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php index 33a864980..9d58922dc 100644 --- a/include/dblayer/functions_pdo-sqlite.inc.php +++ b/include/dblayer/functions_pdo-sqlite.inc.php @@ -174,7 +174,7 @@ function pwg_db_changes(PDOStatement $result=null) function pwg_db_num_rows(PDOStatement $result) { - return $result->columnCount(); + return $result->rowCount(); } function pwg_db_fetch_assoc($result) diff --git a/install.php b/install.php index 289a32bf0..92c8d7a0b 100644 --- a/install.php +++ b/install.php @@ -380,7 +380,10 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment) // PWG_CHARSET is required for building the fs_themes array in the // themes class - define('PWG_CHARSET', $pwg_charset); + if (!defined('PWG_CHARSET')) + { + define('PWG_CHARSET', $pwg_charset); + } activate_all_themes(); $insert = array( diff --git a/install/db/86-database.php b/install/db/86-database.php index 5ff78a033..3a736e3e2 100644 --- a/install/db/86-database.php +++ b/install/db/86-database.php @@ -56,7 +56,7 @@ foreach ($themes_to_activate as $theme) { $query = ' INSERT INTO '.PREFIX_TABLE.'themes - SET id = "'.$theme.'" + (id) VALUES(\''.$theme.'\' ;'; pwg_query($query); } diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql index 34d4fa0c4..6b48218c8 100644 --- a/install/piwigo_structure-pdo-sqlite.sql +++ b/install/piwigo_structure-pdo-sqlite.sql @@ -206,6 +206,19 @@ CREATE INDEX "images_i5" ON "piwigo_images" ("date_creation"); CREATE INDEX "images_i1" ON "piwigo_images" ("storage_category_id"); ----------------------------------------------------------------------------- +-- Table structure for table `piwigo_languages` +----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS piwigo_languages; +CREATE TABLE piwigo_languages +( + "id" varchar(64) NOT NULL default '', + "version" varchar(64) NOT NULL default '0', + "name" varchar(64) default NULL, + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------------- -- piwigo_old_permalinks ----------------------------------------------------------------------------- diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql index e3b830eb0..719497ba7 100644 --- a/install/piwigo_structure-pgsql.sql +++ b/install/piwigo_structure-pgsql.sql @@ -253,6 +253,20 @@ CREATE INDEX "images_i5" ON "piwigo_images" ("date_creation"); CREATE INDEX "images_i1" ON "piwigo_images" ("storage_category_id"); ----------------------------------------------------------------------------- +-- Table structure for table `piwigo_languages` +----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS "piwigo_languages"; +CREATE TABLE "piwigo_languages" ( + "id" varchar(64) NOT NULL default '', + "version" varchar(64) NOT NULL default '0', + "name" varchar(64) default NULL, + PRIMARY KEY ("id") +); + +COMMENT ON TABLE "piwigo_languages" IS ''; + +----------------------------------------------------------------------------- -- piwigo_old_permalinks ----------------------------------------------------------------------------- diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql index 34d4fa0c4..6b48218c8 100644 --- a/install/piwigo_structure-sqlite.sql +++ b/install/piwigo_structure-sqlite.sql @@ -206,6 +206,19 @@ CREATE INDEX "images_i5" ON "piwigo_images" ("date_creation"); CREATE INDEX "images_i1" ON "piwigo_images" ("storage_category_id"); ----------------------------------------------------------------------------- +-- Table structure for table `piwigo_languages` +----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS piwigo_languages; +CREATE TABLE piwigo_languages +( + "id" varchar(64) NOT NULL default '', + "version" varchar(64) NOT NULL default '0', + "name" varchar(64) default NULL, + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------------- -- piwigo_old_permalinks ----------------------------------------------------------------------------- |