Changeset 5192


Ignore:
Timestamp:
Mar 19, 2010, 8:39:15 PM (14 years ago)
Author:
nikrou
Message:

Fix some sql issues :

  • permalink that use if() syntax
  • add tables themes for other database engines that mysql
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/permalinks.php

    r5075 r5192  
    9999  WHERE permalink="'.$_GET['delete_permanent'].'"
    100100  LIMIT 1';
    101   pwg_query($query);
    102   if (pwg_db_affected_rows()==0)
     101  $result = pwg_query($query);
     102  if (pwg_db_changes($result)==0)
    103103    array_push($page['errors'], l10n('Cannot delete the old permalink !'));
    104104}
     
    109109$query = '
    110110SELECT
    111   id,
    112   '.pwg_db_concat(array('id', '\' - \'', 'name', 'IF(permalink IS NULL, \'\', \' √\')')).' AS name,
     111  id, permalink,
     112  '.pwg_db_concat(array('id', '\' - \'', 'name')).' AS name,
    113113  uppercats, global_rank
    114114FROM '.CATEGORIES_TABLE;
  • trunk/include/dblayer/functions_mysql.inc.php

    r5036 r5192  
    125125function pwg_db_changes($result)
    126126{
    127   return mysql_affected_rows($result);
     127  return mysql_affected_rows();
    128128}
    129129
     
    462462{
    463463  $string = implode($array, ',');
    464   return 'CONCAT(\''. $string.'\')';
     464  return 'CONCAT('. $string.')';
    465465}
    466466
  • trunk/include/functions_category.inc.php

    r5178 r5192  
    312312  foreach ($categories as $category)
    313313  {
     314    if (!empty($category['permalink']))
     315    {
     316      $category['name'] .= ' √';
     317    }
    314318    if ($fullname)
    315319    {
  • trunk/install/piwigo_structure-pdo-sqlite.sql

    r5123 r5192  
    342342
    343343-----------------------------------------------------------------------------
     344-- piwigo_themes
     345-----------------------------------------------------------------------------
     346
     347DROP TABLE IF EXISTS "piwigo_themes" CASCADE;
     348CREATE TABLE "piwigo_themes"
     349(
     350  "id" varchar(64) default '' NOT NULL,
     351  "version" varchar(64) NOT NULL default '0',
     352  "name" varchar(64) default NULL,
     353  PRIMARY KEY  ("id")
     354);
     355
     356-----------------------------------------------------------------------------
    344357-- piwigo_upgrade
    345358-----------------------------------------------------------------------------
  • trunk/install/piwigo_structure-pgsql.sql

    r5123 r5192  
    416416
    417417-----------------------------------------------------------------------------
     418-- piwigo_themes
     419-----------------------------------------------------------------------------
     420
     421DROP TABLE IF EXISTS "piwigo_themes" CASCADE;
     422CREATE TABLE "piwigo_themes"
     423(
     424  "id" varchar(64) default '' NOT NULL,
     425  "version" varchar(64) NOT NULL default '0',
     426  "name" varchar(64) default NULL,
     427  PRIMARY KEY  ("id")
     428);
     429
     430COMMENT ON TABLE "piwigo_themes" IS '';
     431
     432-----------------------------------------------------------------------------
    418433-- piwigo_upgrade
    419434-----------------------------------------------------------------------------
  • trunk/install/piwigo_structure-sqlite.sql

    r5123 r5192  
    342342
    343343-----------------------------------------------------------------------------
     344-- piwigo_themes
     345-----------------------------------------------------------------------------
     346
     347DROP TABLE IF EXISTS "piwigo_themes" CASCADE;
     348CREATE TABLE "piwigo_themes"
     349(
     350  "id" varchar(64) default '' NOT NULL,
     351  "version" varchar(64) NOT NULL default '0',
     352  "name" varchar(64) default NULL,
     353  PRIMARY KEY  ("id")
     354);
     355
     356-----------------------------------------------------------------------------
    344357-- piwigo_upgrade
    345358-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.