/**
  * @phutil-external-symbol function mysql_multi_query
  * @phutil-external-symbol function mysql_fetch_result
  * @phutil-external-symbol function mysql_more_results
  * @phutil-external-symbol function mysql_next_result
  */
 protected function rawQueries(array $raw_queries)
 {
     $conn = $this->requireConnection();
     $results = array();
     if (!function_exists('mysql_multi_query')) {
         foreach ($raw_queries as $key => $raw_query) {
             $results[$key] = $this->processResult($this->rawQuery($raw_query));
         }
         return $results;
     }
     if (!mysql_multi_query(implode('; ', $raw_queries), $conn)) {
         $ex = $this->processResult(false);
         return array_fill_keys(array_keys($raw_queries), $ex);
     }
     $processed_all = false;
     foreach ($raw_queries as $key => $raw_query) {
         $results[$key] = $this->processResult(@mysql_fetch_result($conn));
         if (!mysql_more_results($conn)) {
             $processed_all = true;
             break;
         }
         mysql_next_result($conn);
     }
     if (!$processed_all) {
         throw new Exception("There are some results left in the result set.");
     }
     return $results;
 }
Exemple #2
0
 public function query($SQL)
 {
     if ($SQL !== "") {
         if (stristr($SQL, "call") and stripos($SQL, "call") === 0) {
             @mysql_multi_query($SQL, self::$connection);
             $this->query = @mysql_store_result(self::$connection);
             if (@mysql_more_results(self::$connection)) {
                 @mysql_next_result(self::$connection);
             }
         } else {
             $this->query = mysql_query($SQL, self::$connection);
         }
     }
     return $this->query ? $this->query : false;
 }
Exemple #3
0
<?php

$bogus = 42;
var_dump(mysql_next_result($bogus));
var_dump(mysql_fetch_result($bogus));
var_dump(mysql_more_results($bogus));
var_dump(mysql_multi_query('SELECT 1;', $bogus));