Show
Ignore:
Timestamp:
10/02/08 18:12:10 (3 months ago)
Author:
nowelium
Message:

mysql の procedure サポートは終わり。
General error: 2014 Cannot execute queries while other unbuffered queries are active. とかは、PDOのPDO::MYSQL_ATTR_USE_BUFFERED_QUERY をいくら設定してもダメなので、少し逃げ。一端切断すればなんとかなるけど、Datasource設定とかは管理外なので、やらない。
multi rows は 2次元配列で。

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/php/misc/Hermit/src/Hermit/resultset/HermitProcedureResultSet.php

    r20417 r20492  
    44 * @author nowelium 
    55 */ 
    6 class HermitProcedureResultSet implements HermitResultSet, HermitParameterBind { 
     6class HermitProcedureResultSet implements HermitResultSet { 
    77    protected $procParameter; 
    88    public function __construct(HermitProcedureParameter $procParameter){ 
     
    1010    } 
    1111    public function execute(HermitStatement $stmt, HermitValueType $type){ 
     12        if($stmt->columnCount() < 1){ 
     13            $stmt->closeCursor(); 
     14            unset($stmt); 
     15            return null; 
     16        } 
    1217        $type->apply($stmt); 
    1318 
    14         if($stmt->columnCount() < 1){ 
    15             return null; 
    16         } 
     19//        $rows = array(); 
     20//        while($row = $stmt->fetch()){ 
     21//            $rows[] = $row; 
     22//        } 
     23//        if(!$stmt->nextRowset()){ 
     24//            return $rows; 
     25//        } 
     26// 
     27//        $results = array(); 
     28//        $results[] = $rows; 
     29//        do { 
     30//            $rows = array(); 
     31//            while($row = $stmt->fetch()){ 
     32//                $rows[] = $row; 
     33//            } 
     34//            $results[] = $rows; 
     35//        } while($stmt->nextRowset()); 
     36// 
     37//        $stmt->closeCursor(); 
     38//        unset($stmt); 
     39//        return $results; 
    1740 
     41        // multiresult so always to array[array] 
    1842        $results = array(); 
    1943        do { 
    20             $row = $stmt->fetch(); 
    21             if(false === $row){ 
    22                 break; 
     44            $rows = array(); 
     45            while($row = $stmt->fetch()){ 
     46                $rows[] = $row; 
    2347            } 
    24             $results[] = $row; 
     48            $results[] = $rows; 
    2549        } while($stmt->nextRowset()); 
     50         
     51        $stmt->closeCursor(); 
     52        unset($stmt); 
    2653        return $results; 
    2754    } 
    28     public function bindParameter(PDO $pdo, array $parameter){ 
    29     } 
    3055}