Ignore:
Timestamp:
2013/08/02 13:22:57 (11 years ago)
Author:
Seasoft
Message:

#2322 (セッションのGC処理がエラーとなる)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/module/MDB2/Driver/Datatype/mysql.php

    r20764 r23022  
    4444// +----------------------------------------------------------------------+ 
    4545// 
    46 // $Id: mysql.php,v 1.65 2008/02/22 19:23:49 quipo Exp $ 
     46// $Id: mysql.php 327310 2012-08-27 15:16:18Z danielc $ 
    4747// 
    4848 
     
    9090 
    9191    // }}} 
     92    // {{{ getDeclaration() 
     93 
     94    /** 
     95     * Obtain DBMS specific SQL code portion needed to declare 
     96     * of the given type 
     97     * 
     98     * @param string $type  type to which the value should be converted to 
     99     * @param string $name  name the field to be declared. 
     100     * @param string $field definition of the field 
     101     * 
     102     * @return string DBMS-specific SQL code portion that should be used to 
     103     *                declare the specified field. 
     104     * @access public 
     105     */ 
     106    function getDeclaration($type, $name, $field) 
     107    { 
     108        // MySQL DDL syntax forbids combining NOT NULL with DEFAULT NULL. 
     109        // To get a default of NULL for NOT NULL columns, omit it. 
     110        if (   isset($field['notnull']) 
     111            && !empty($field['notnull']) 
     112            && array_key_exists('default', $field) // do not use isset() here! 
     113            && null === $field['default'] 
     114        ) { 
     115            unset($field['default']); 
     116        } 
     117        return parent::getDeclaration($type, $name, $field); 
     118    } 
     119 
     120    // }}} 
    92121    // {{{ getTypeDeclaration() 
    93122 
     
    117146    function getTypeDeclaration($field) 
    118147    { 
    119         $db =& $this->getDBInstance(); 
    120         if (PEAR::isError($db)) { 
     148        $db = $this->getDBInstance(); 
     149        if (MDB2::isError($db)) { 
    121150            return $db; 
    122151        } 
     
    180209            return 'DATETIME'; 
    181210        case 'float': 
    182             return 'DOUBLE'; 
     211            $l = ''; 
     212            if (!empty($field['length'])) { 
     213                $l = '(' . $field['length']; 
     214                if (!empty($field['scale'])) { 
     215                    $l .= ',' . $field['scale']; 
     216                } 
     217                $l .= ')'; 
     218            } 
     219            return 'DOUBLE' . $l; 
    183220        case 'decimal': 
    184221            $length = !empty($field['length']) ? $field['length'] : 18; 
     
    220257    function _getIntegerDeclaration($name, $field) 
    221258    { 
    222         $db =& $this->getDBInstance(); 
    223         if (PEAR::isError($db)) { 
     259        $db = $this->getDBInstance(); 
     260        if (MDB2::isError($db)) { 
    224261            return $db; 
    225262        } 
     
    237274        $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; 
    238275        $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED'; 
     276        if (empty($default) && empty($notnull)) { 
     277            $default = ' DEFAULT NULL'; 
     278        } 
    239279        $name = $db->quoteIdentifier($name, true); 
    240280        return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc; 
     
    309349    function _getDecimalDeclaration($name, $field) 
    310350    { 
    311         $db =& $this->getDBInstance(); 
    312         if (PEAR::isError($db)) { 
     351        $db = $this->getDBInstance(); 
     352        if (MDB2::isError($db)) { 
    313353            return $db; 
    314354        } 
     
    347387    function matchPattern($pattern, $operator = null, $field = null) 
    348388    { 
    349         $db =& $this->getDBInstance(); 
    350         if (PEAR::isError($db)) { 
     389        $db = $this->getDBInstance(); 
     390        if (MDB2::isError($db)) { 
    351391            return $db; 
    352392        } 
    353393 
    354394        $match = ''; 
    355         if (!is_null($operator)) { 
    356             $field = is_null($field) ? '' : $field.' '; 
     395        if (null !== $operator) { 
     396            $field = (null === $field) ? '' : $field.' '; 
    357397            $operator = strtoupper($operator); 
    358398            switch ($operator) { 
     
    361401                $match = $field.'LIKE '; 
    362402                break; 
     403            case 'NOT ILIKE': 
     404                $match = $field.'NOT LIKE '; 
     405                break; 
    363406            // case sensitive 
    364407            case 'LIKE': 
    365408                $match = $field.'LIKE BINARY '; 
     409                break; 
     410            case 'NOT LIKE': 
     411                $match = $field.'NOT LIKE BINARY '; 
    366412                break; 
    367413            default: 
     
    505551            $type[] = 'float'; 
    506552            $unsigned = preg_match('/ unsigned/i', $field['type']); 
     553            if ($decimal !== false) { 
     554                $length = $length.','.$decimal; 
     555            } 
    507556            break; 
    508557        case 'unknown': 
     
    532581            break; 
    533582        default: 
    534             $db =& $this->getDBInstance(); 
    535             if (PEAR::isError($db)) { 
     583            $db = $this->getDBInstance(); 
     584            if (MDB2::isError($db)) { 
    536585                return $db; 
    537586            } 
Note: See TracChangeset for help on using the changeset viewer.