/**
  * @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;
 }
function db_fetch_result($result)
{
    if (DB_TYPE == 'mysql') {
        return mysql_fetch_result($result);
    } elseif (DB_TYPE == 'postgres') {
        return pg_fetch_result($result);
    }
}
Ejemplo n.º 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));