Changeset 5452


Ignore:
Timestamp:
Mar 29, 2010, 8:16:33 PM (11 years ago)
Author:
nikrou
Message:

Fix some issues with database engines :

  • insert into syntax not correct for posgresql or sqlite
  • add languages table
  • incorrect function for row count (sqlite)
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/languages.class.php

    r5371 r5452  
    7979        }
    8080
    81         $query = "
    82 INSERT INTO ".LANGUAGES_TABLE."
    83   SET id = '".$language_id."',
    84       name = '".$this->fs_languages[$language_id]."'
    85 ;";
     81        $query = '
     82INSERT INTO '.LANGUAGES_TABLE.'
     83  (id, name)
     84  VALUES(\''.$language_id.'\', \''.$this->fs_languages[$language_id].'\')
     85;';
    8686        pwg_query($query);
    8787        break;
  • trunk/admin/include/themes.class.php

    r5446 r5452  
    115115        if (empty($errors))
    116116        {
    117           $query = "
    118 INSERT INTO ".THEMES_TABLE."
    119   SET id = '".$theme_id."'
    120     , version = '".$this->fs_themes[$theme_id]['version']."'
    121     , name = '".$this->fs_themes[$theme_id]['name']."'
    122 ;";
     117          $query = '
     118INSERT INTO '.THEMES_TABLE.'
     119  (id, version, name)
     120  VALUES(\''.$theme_id.'\',
     121         \''.$this->fs_themes[$theme_id]['version'].'\',
     122         \''.$this->fs_themes[$theme_id]['name'].'\')
     123;';
    123124          pwg_query($query);
    124125        }
  • trunk/include/dblayer/functions_pdo-sqlite.inc.php

    r5236 r5452  
    175175function pwg_db_num_rows(PDOStatement $result)
    176176{
    177   return $result->columnCount();
     177  return $result->rowCount();
    178178}
    179179
  • trunk/install.php

    r5408 r5452  
    381381    // PWG_CHARSET is required for building the fs_themes array in the
    382382    // themes class
    383     define('PWG_CHARSET', $pwg_charset);
     383    if (!defined('PWG_CHARSET'))
     384    {
     385      define('PWG_CHARSET', $pwg_charset);
     386    }
    384387    activate_all_themes();
    385388
  • trunk/install/db/86-database.php

    r5196 r5452  
    5757  $query = '
    5858INSERT INTO '.PREFIX_TABLE.'themes
    59   SET id = "'.$theme.'"
     59  (id) VALUES(\''.$theme.'\'
    6060;';
    6161  pwg_query($query);
  • trunk/install/piwigo_structure-pdo-sqlite.sql

    r5192 r5452  
    207207
    208208-----------------------------------------------------------------------------
     209-- Table structure for table `piwigo_languages`
     210-----------------------------------------------------------------------------
     211
     212DROP TABLE IF EXISTS piwigo_languages;
     213CREATE TABLE piwigo_languages
     214(
     215  "id" varchar(64) NOT NULL default '',
     216  "version" varchar(64) NOT NULL default '0',
     217  "name" varchar(64) default NULL,
     218  PRIMARY KEY  ("id")
     219);
     220
     221-----------------------------------------------------------------------------
    209222-- piwigo_old_permalinks
    210223-----------------------------------------------------------------------------
  • trunk/install/piwigo_structure-pgsql.sql

    r5192 r5452  
    254254
    255255-----------------------------------------------------------------------------
     256-- Table structure for table `piwigo_languages`
     257-----------------------------------------------------------------------------
     258
     259DROP TABLE IF EXISTS "piwigo_languages";
     260CREATE TABLE "piwigo_languages" (
     261  "id" varchar(64) NOT NULL default '',
     262  "version" varchar(64) NOT NULL default '0',
     263  "name" varchar(64) default NULL,
     264  PRIMARY KEY  ("id")
     265);
     266
     267COMMENT ON TABLE "piwigo_languages" IS '';
     268
     269-----------------------------------------------------------------------------
    256270-- piwigo_old_permalinks
    257271-----------------------------------------------------------------------------
  • trunk/install/piwigo_structure-sqlite.sql

    r5192 r5452  
    207207
    208208-----------------------------------------------------------------------------
     209-- Table structure for table `piwigo_languages`
     210-----------------------------------------------------------------------------
     211
     212DROP TABLE IF EXISTS piwigo_languages;
     213CREATE TABLE piwigo_languages
     214(
     215  "id" varchar(64) NOT NULL default '',
     216  "version" varchar(64) NOT NULL default '0',
     217  "name" varchar(64) default NULL,
     218  PRIMARY KEY  ("id")
     219);
     220
     221-----------------------------------------------------------------------------
    209222-- piwigo_old_permalinks
    210223-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.