- Timestamp:
- 10/03/08 18:15:28 (2 months ago)
- Location:
- lang/php/misc/Hermit/src/Hermit
- Files:
-
- 4 modified
-
HermitParam.php (modified) (1 diff)
-
parameter/HermitMySqlProcedureParameter.php (modified) (1 diff)
-
parameter/HermitProcedureParameter.php (modified) (2 diffs)
-
resultset/HermitMySqlProcedureResultSet.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/php/misc/Hermit/src/Hermit/HermitParam.php
r20492 r20612 5 5 */ 6 6 class 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 } 7 31 public function set($name, $value){ 32 $name = self::accessValue($this, $name); 8 33 $this->$name = $value; 9 34 } 10 35 public function get($name){ 36 $name = self::accessValue($this, $name); 11 37 return $this->$name; 12 38 } -
lang/php/misc/Hermit/src/Hermit/parameter/HermitMySqlProcedureParameter.php
r20492 r20612 30 30 public function bind(PDOStatement $stmt, $value){ 31 31 $param = $value[0]; 32 $param->__init__(); 32 33 foreach($this->bindKeys as $index => $key){ 33 34 if($this->info->typeofIn($key)){ 34 $stmt->bind Param(':' . $key, $param->$key);35 $stmt->bindValue(':' . $key, $param->get($key)); 35 36 } 36 37 } -
lang/php/misc/Hermit/src/Hermit/parameter/HermitProcedureParameter.php
r20492 r20612 30 30 public function bind(PDOStatement $stmt, $value){ 31 31 $param = $value[0]; 32 $param->__init__(); 32 33 $propertyNames = $param->getPropertyNames(); 33 34 … … 38 39 throw new InvalidArgumentException('param ' . $param . ' has not propery: ' . $key . ' instatement: ' . $stmt->queryString); 39 40 } 40 $stmt->bindParam($bindKey, $param-> $key);41 $stmt->bindParam($bindKey, $param->get($key)); 41 42 continue; 42 43 } 43 44 44 45 $paramValue = null; 45 if( isset($param->$key)){46 $paramValue = $param->$key;46 if($param->issetValue($key)){ 47 $paramValue = $param->get($key); 47 48 } 48 49 if(null === $paramValue){ -
lang/php/misc/Hermit/src/Hermit/resultset/HermitMySqlProcedureResultSet.php
r20492 r20612 13 13 } 14 14 $param = $parameter[0]; 15 $param->__init__(); 15 16 $out = $this->procParameter->getOutParameters(); 16 17 foreach($out as $name){ 17 18 $stmt = $pdo->prepare('SELECT @' . $name); 18 $stmt->bindColumn(1, $param->$name);19 19 $stmt->execute(); 20 20 21 $ stmt->fetch(PDO::FETCH_BOUND);21 $param->set($name, $stmt->fetchColumn()); 22 22 $stmt->closeCursor(); 23 23 unset($stmt);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)