Exemplo n.º 1
0
 public function F_query($block, $query)
 {
     $params = array_map(create_function('$x', 'return $x->F_to_s(NULL)->__STRING;'), array_slice(func_get_args(), 2));
     if (count($params) === 1 && is_a($params[0], 'F_Array')) {
         $params = $params->__ARRAY;
     }
     $stmt = $this->__PDO->prepare($query->F_to_s(NULL)->__STRING);
     if (!$stmt->execute($params)) {
         $err = F_PDOError::SF_new(NULL, F_String::__from_string("An error occurred in PDO#query"));
         $err->__INFO = $this->F_error_info(NULL);
         throw new ErrorCarrier($err);
     }
     if ($block !== NULL) {
         return $block(NULL, F_PDOResults::__from_stmt($stmt));
     }
     return F_PDOResults::__from_stmt($stmt);
 }
Exemplo n.º 2
0
 public function F_query($block, $query, $paramarray = NULL)
 {
     if ($paramarray === NULL) {
         $params = array();
     } else {
         if (is_a($paramarray, 'F_Array')) {
             $params = array_map('__marshal2php', $paramarray->__ARRAY);
         } else {
             $params = array_map('__marshal2php', array_slice(func_get_args(), 2));
         }
     }
     $stmt = $this->__PDO->prepare($query->F_to_s(NULL)->__STRING);
     if (!$stmt->execute($params)) {
         $err = F_PDOError::SF_new(NULL, F_String::__from_string("An error occurred in PDO#query"));
         $err->__INFO = $this->F_error_info(NULL);
         throw new ErrorCarrier($err);
     }
     if ($block !== NULL) {
         return $block(NULL, F_PDOResults::__from_stmt($stmt));
     }
     return F_PDOResults::__from_stmt($stmt);
 }