Ignore:
Timestamp:
2010/03/11 10:35:11 (14 years ago)
Author:
kajiwara
Message:

正式版にナイトリービルド版をマージしてみるテスト

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tmp/version-2_5-test/data/module/DB/mssql.php

    r15532 r18609  
    1919 * @author     Sterling Hughes <sterling@php.net> 
    2020 * @author     Daniel Convissor <danielc@php.net> 
    21  * @copyright  1997-2005 The PHP Group 
     21 * @copyright  1997-2007 The PHP Group 
    2222 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    2323 * @version    CVS: $Id$ 
     
    3636 * These methods overload the ones declared in DB_common. 
    3737 * 
     38 * DB's mssql driver is only for Microsfoft SQL Server databases. 
     39 * 
     40 * If you're connecting to a Sybase database, you MUST specify "sybase" 
     41 * as the "phptype" in the DSN. 
     42 * 
     43 * This class only works correctly if you have compiled PHP using 
     44 * --with-mssql=[dir_to_FreeTDS]. 
     45 * 
    3846 * @category   Database 
    3947 * @package    DB 
    4048 * @author     Sterling Hughes <sterling@php.net> 
    4149 * @author     Daniel Convissor <danielc@php.net> 
    42  * @copyright  1997-2005 The PHP Group 
     50 * @copyright  1997-2007 The PHP Group 
    4351 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    44  * @version    Release: @package_version@ 
     52 * @version    Release: 1.7.14RC1 
    4553 * @link       http://pear.php.net/package/DB 
    4654 */ 
     
    9098    // XXX Add here error codes ie: 'S100E' => DB_ERROR_SYNTAX 
    9199    var $errorcode_map = array( 
     100        102   => DB_ERROR_SYNTAX, 
    92101        110   => DB_ERROR_VALUE_COUNT_ON_ROW, 
    93102        155   => DB_ERROR_NOSUCHFIELD, 
     103        156   => DB_ERROR_SYNTAX, 
    94104        170   => DB_ERROR_SYNTAX, 
    95105        207   => DB_ERROR_NOSUCHFIELD, 
    96106        208   => DB_ERROR_NOSUCHTABLE, 
    97107        245   => DB_ERROR_INVALID_NUMBER, 
     108        319   => DB_ERROR_SYNTAX, 
     109        321   => DB_ERROR_NOSUCHFIELD, 
     110        325   => DB_ERROR_SYNTAX, 
     111        336   => DB_ERROR_SYNTAX, 
    98112        515   => DB_ERROR_CONSTRAINT_NOT_NULL, 
    99113        547   => DB_ERROR_CONSTRAINT, 
     114        1018  => DB_ERROR_SYNTAX, 
     115        1035  => DB_ERROR_SYNTAX, 
    100116        1913  => DB_ERROR_ALREADY_EXISTS, 
     117        2209  => DB_ERROR_SYNTAX, 
     118        2223  => DB_ERROR_SYNTAX, 
     119        2248  => DB_ERROR_SYNTAX, 
     120        2256  => DB_ERROR_SYNTAX, 
     121        2257  => DB_ERROR_SYNTAX, 
    101122        2627  => DB_ERROR_CONSTRAINT, 
    102123        2714  => DB_ERROR_ALREADY_EXISTS, 
     124        3607  => DB_ERROR_DIVZERO, 
    103125        3701  => DB_ERROR_NOSUCHTABLE, 
     126        7630  => DB_ERROR_SYNTAX, 
    104127        8134  => DB_ERROR_DIVZERO, 
     128        9303  => DB_ERROR_SYNTAX, 
     129        9317  => DB_ERROR_SYNTAX, 
     130        9318  => DB_ERROR_SYNTAX, 
     131        9331  => DB_ERROR_SYNTAX, 
     132        9332  => DB_ERROR_SYNTAX, 
     133        15253 => DB_ERROR_SYNTAX, 
    105134    ); 
    106135 
     
    245274    function simpleQuery($query) 
    246275    { 
    247         $ismanip = DB::isManip($query); 
     276        $ismanip = $this->_checkManip($query); 
    248277        $this->last_query = $query; 
    249278        if (!@mssql_select_db($this->_db, $this->connection)) { 
     
    317346        } 
    318347        if ($fetchmode & DB_FETCHMODE_ASSOC) { 
    319             $arr = @mssql_fetch_array($result, MSSQL_ASSOC); 
     348            $arr = @mssql_fetch_assoc($result); 
    320349            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) { 
    321350                $arr = array_change_key_case($arr, CASE_LOWER); 
     
    354383    function freeResult($result) 
    355384    { 
    356         return @mssql_free_result($result); 
     385        return is_resource($result) ? mssql_free_result($result) : false; 
    357386    } 
    358387 
     
    484513    function affectedRows() 
    485514    { 
    486         if (DB::isManip($this->last_query)) { 
     515        if ($this->_last_query_manip) { 
    487516            $res = @mssql_query('select @@rowcount', $this->connection); 
    488517            if (!$res) { 
     
    538567                } 
    539568            } elseif (!DB::isError($result)) { 
    540                 $result =& $this->query("SELECT @@IDENTITY FROM $seqname"); 
     569                $result = $this->query("SELECT IDENT_CURRENT('$seqname')"); 
     570                if (DB::isError($result)) { 
     571                    /* Fallback code for MS SQL Server 7.0, which doesn't have 
     572                     * IDENT_CURRENT. This is *not* safe for concurrent 
     573                     * requests, and really, if you're using it, you're in a 
     574                     * world of hurt. Nevertheless, it's here to ensure BC. See 
     575                     * bug #181 for the gory details.*/ 
     576                    $result = $this->query("SELECT @@IDENTITY FROM $seqname"); 
     577                } 
    541578                $repeat = 0; 
    542579            } else { 
     
    746783 
    747784        for ($i = 0; $i < $count; $i++) { 
     785            if ($got_string) { 
     786                $flags = $this->_mssql_field_flags($result, 
     787                        @mssql_field_name($id, $i)); 
     788                if (DB::isError($flags)) { 
     789                    return $flags; 
     790                } 
     791            } else { 
     792                $flags = ''; 
     793            } 
     794 
    748795            $res[$i] = array( 
    749796                'table' => $got_string ? $case_func($result) : '', 
     
    751798                'type'  => @mssql_field_type($id, $i), 
    752799                'len'   => @mssql_field_length($id, $i), 
    753                 // We only support flags for table 
    754                 'flags' => $got_string 
    755                            ? $this->_mssql_field_flags($result, 
    756                                                        @mssql_field_name($id, $i)) 
    757                            : '', 
     800                'flags' => $flags, 
    758801            ); 
    759802            if ($mode & DB_TABLEINFO_ORDER) { 
     
    806849 
    807850            // get unique and primary keys 
    808             $res = $this->getAll("EXEC SP_HELPINDEX[$table]", DB_FETCHMODE_ASSOC); 
     851            $res = $this->getAll("EXEC SP_HELPINDEX $table", DB_FETCHMODE_ASSOC); 
     852            if (DB::isError($res)) { 
     853                return $res; 
     854            } 
    809855 
    810856            foreach ($res as $val) { 
     
    829875 
    830876            // get auto_increment, not_null and timestamp 
    831             $res = $this->getAll("EXEC SP_COLUMNS[$table]", DB_FETCHMODE_ASSOC); 
     877            $res = $this->getAll("EXEC SP_COLUMNS $table", DB_FETCHMODE_ASSOC); 
     878            if (DB::isError($res)) { 
     879                return $res; 
     880            } 
    832881 
    833882            foreach ($res as $val) { 
Note: See TracChangeset for help on using the changeset viewer.