Changeset 20612

Show
Ignore:
Timestamp:
10/03/08 18:15:28 (3 months ago)
Author:
nowelium
Message:
 
Location:
lang/php/misc/Hermit/src/Hermit
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/php/misc/Hermit/src/Hermit/HermitParam.php

    r20492 r20612  
    55 */ 
    66class HermitParam extends stdClass { 
     7    private $__accessKeys__; 
     8    protected static function accessKeys(HermitParam $target){ 
     9        $ref = new ReflectionObject($target); 
     10        return array_flip($ref->getConstants()); 
     11    } 
     12    protected static function accessValue(HermitParam $target, $name){ 
     13        $target->checkAccessKey(); 
     14        if(isset($target->__accessKeys__[$name])){ 
     15            $name = preg_replace('/_KEY$/', '', $target->__accessKeys__[$name]); 
     16        } 
     17        return $name; 
     18    } 
     19    public function __init__(){ 
     20        $this->__accessKeys__ = self::accessKeys($this); 
     21    } 
     22    public function checkAccessKey(){ 
     23        if(null === $this->__accessKeys__){ 
     24            $this->__accessKeys__ = self::accessKeys($this); 
     25        } 
     26    } 
     27    public function issetValue($name){ 
     28        $name = self::accessValue($this, $name); 
     29        return isset($this->$name); 
     30    } 
    731    public function set($name, $value){ 
     32        $name = self::accessValue($this, $name); 
    833        $this->$name = $value; 
    934    } 
    1035    public function get($name){ 
     36        $name = self::accessValue($this, $name); 
    1137        return $this->$name; 
    1238    } 
  • lang/php/misc/Hermit/src/Hermit/parameter/HermitMySqlProcedureParameter.php

    r20492 r20612  
    3030    public function bind(PDOStatement $stmt, $value){ 
    3131        $param = $value[0]; 
     32        $param->__init__(); 
    3233        foreach($this->bindKeys as $index => $key){ 
    3334            if($this->info->typeofIn($key)){ 
    34                 $stmt->bindParam(':' . $key, $param->$key); 
     35                $stmt->bindValue(':' . $key, $param->get($key)); 
    3536            } 
    3637        } 
  • lang/php/misc/Hermit/src/Hermit/parameter/HermitProcedureParameter.php

    r20492 r20612  
    3030    public function bind(PDOStatement $stmt, $value){ 
    3131        $param = $value[0]; 
     32        $param->__init__(); 
    3233        $propertyNames = $param->getPropertyNames(); 
    3334 
     
    3839                    throw new InvalidArgumentException('param ' . $param . ' has not propery: ' . $key . ' instatement: ' . $stmt->queryString); 
    3940                } 
    40                 $stmt->bindParam($bindKey, $param->$key); 
     41                $stmt->bindParam($bindKey, $param->get($key)); 
    4142                continue; 
    4243            } 
    4344             
    4445            $paramValue = null; 
    45             if(isset($param->$key)){ 
    46                 $paramValue =  $param->$key; 
     46            if($param->issetValue($key)){ 
     47                $paramValue = $param->get($key); 
    4748            } 
    4849            if(null === $paramValue){ 
  • lang/php/misc/Hermit/src/Hermit/resultset/HermitMySqlProcedureResultSet.php

    r20492 r20612  
    1313        } 
    1414        $param = $parameter[0]; 
     15        $param->__init__(); 
    1516        $out = $this->procParameter->getOutParameters(); 
    1617        foreach($out as $name){ 
    1718            $stmt = $pdo->prepare('SELECT @' . $name); 
    18             $stmt->bindColumn(1, $param->$name); 
    1919            $stmt->execute(); 
    2020 
    21             $stmt->fetch(PDO::FETCH_BOUND); 
     21            $param->set($name, $stmt->fetchColumn()); 
    2222            $stmt->closeCursor(); 
    2323            unset($stmt);