Exemple #1
0
 protected function _parseInput($str, &$p, $for = '')
 {
     $result = parent::_parseInput($str, $p);
     foreach ($result as $key => $v) {
         if (isset($this->_items[$key])) {
             $result[$key] = $this->_items[$key]->input($v, $for);
         } else {
             // Extra column in hstore must not break the program execution!
             $result[$key] = null;
             //throw new DB_Type_Exception_Common($this, "input", "unexpected key", $key);
         }
     }
     return $result;
 }
Exemple #2
0
    ["a"]=>
    string(1) "1"
    ["b"]=>
    string(1) "d"
  }
  [1]=>
  array(2) {
    ["a"]=>
    string(1) "3"
    ["b"]=>
    string(1) "e"
  }
}
*/
// ================================= Hstore itemsInput =================================
$parser = new DB_Type_Pgsql_Hstore(new DB_Type_Pgsql_Hstore(new DB_Type_String()));
$hstore_result = array("first" => "a => NULL, b => value", "second" => "a => value, b => NULL");
echo "\n\n";
$input = $parser->input($hstore_result);
var_dump($input);
/*
array(2) {
  ["first"]=>
  array(2) {
    ["a"]=>
    NULL
    ["b"]=>
    string(5) "value"
  }
  ["second"]=>
  array(2) {