Beispiel #1
0
 function fetchAll()
 {
     if (!$this->DB) {
         return;
     }
     $data = $this->Statement->result_metadata();
     $out = array();
     $fields = array();
     if (!$data) {
         return null;
     }
     $length = 0;
     while (null != ($field = mysqli_fetch_field($data))) {
         $fields[] =& $out[$field->name];
         $length += $field->length;
     }
     call_user_func_array(array($this->Statement, "bind_result"), $fields);
     $output = array();
     $count = 0;
     //FIXME: store_result is needed, but using it causes crash
     if ($length >= 1000000) {
         if (!$this->Statement->store_result()) {
             throw new \Exception("Store_Result error on MySQLi prepared statement : " . $this->Statement->get_warnings());
         }
     }
     while ($this->Statement->fetch()) {
         foreach ($out as $k => $v) {
             $output[$count][$k] = $v;
         }
         $count++;
     }
     $this->Statement->free_result();
     return $count == 0 ? null : $output;
 }