Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/license.php *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/license.php *
|
* $Id: db_pgsql.php 5828 2012-05-08 16:06:16Z Tomm $
| * $Id$
|
*/
class DB_PgSQL
| */
class DB_PgSQL
|
Zeile 143 | Zeile 143 |
---|
* @var float */ public $query_time = 0;
|
* @var float */ public $query_time = 0;
|
| /** * The last result run on the database (needed for affected_rows) * * @var resource */ public $last_result;
|
/** * Connect to the database server.
| /** * Connect to the database server.
|
Zeile 199 | Zeile 206 |
---|
foreach($connections[$type] as $single_connection) { $connect_function = "pg_connect";
|
foreach($connections[$type] as $single_connection) { $connect_function = "pg_connect";
|
if($single_connection['pconnect'])
| if(isset($single_connection['pconnect']))
|
{ $connect_function = "pg_pconnect"; }
| { $connect_function = "pg_pconnect"; }
|
Zeile 272 | Zeile 279 |
---|
/** * Query the database.
|
/** * Query the database.
|
* * @param string The query SQL. * @param boolean 1 if hide errors, 0 if not.
| * * @param string The query SQL. * @param boolean 1 if hide errors, 0 if not.
|
* @param integer 1 if executes on slave database, 0 if not. * @return resource The query data. */
| * @param integer 1 if executes on slave database, 0 if not. * @return resource The query data. */
|
Zeile 282 | Zeile 289 |
---|
{ global $pagestarttime, $db, $mybb;
|
{ global $pagestarttime, $db, $mybb;
|
$string = preg_replace("#LIMIT ([0-9]+),([ 0-9]+)#i", "LIMIT $2 OFFSET $1", $string);
| $string = preg_replace("#LIMIT (\s*)([0-9]+),(\s*)([0-9]+)$#im", "LIMIT $4 OFFSET $2", trim($string));
|
$this->last_query = $string;
| $this->last_query = $string;
|
Zeile 321 | Zeile 328 |
---|
$query_time = $this->get_execution_time(); $this->query_time += $query_time; $this->query_count++;
|
$query_time = $this->get_execution_time(); $this->query_time += $query_time; $this->query_count++;
|
| $this->last_result = $query;
|
if($mybb->debug_mode) {
| if($mybb->debug_mode) {
|
Zeile 339 | Zeile 347 |
---|
function write_query($query, $hide_errors=0) { return $this->query($query, $hide_errors, 1);
|
function write_query($query, $hide_errors=0) { return $this->query($query, $hide_errors, 1);
|
}
| }
|
/** * Explain a query on the database. *
| /** * Explain a query on the database. *
|
Zeile 356 | Zeile 364 |
---|
"<tr>\n". "<td colspan=\"8\" style=\"background-color: #ccc;\"><strong>#".$this->query_count." - Select Query</strong></td>\n". "</tr>\n".
|
"<tr>\n". "<td colspan=\"8\" style=\"background-color: #ccc;\"><strong>#".$this->query_count." - Select Query</strong></td>\n". "</tr>\n".
|
"<tr>\n". "<td colspan=\"8\" style=\"background-color: #fefefe;\"><span style=\"font-family: Courier; font-size: 14px;\">".$string."</span></td>\n". "</tr>\n".
| "<tr>\n". "<td colspan=\"8\" style=\"background-color: #fefefe;\"><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n". "</tr>\n".
|
"<tr style=\"background-color: #efefef;\">\n". "<td><strong>Info</strong></td>\n". "</tr>\n";
| "<tr style=\"background-color: #efefef;\">\n". "<td><strong>Info</strong></td>\n". "</tr>\n";
|
Zeile 373 | Zeile 381 |
---|
$this->explain .= "<tr>\n". "<td colspan=\"8\" style=\"background-color: #fff;\">Query Time: ".$qtime."</td>\n".
|
$this->explain .= "<tr>\n". "<td colspan=\"8\" style=\"background-color: #fff;\">Query Time: ".$qtime."</td>\n".
|
"</tr>\n".
| "</tr>\n".
|
"</table>\n". "<br />\n"; }
| "</table>\n". "<br />\n"; }
|
Zeile 385 | Zeile 393 |
---|
"</tr>\n". "<tr style=\"background-color: #fefefe;\">\n". "<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".
|
"</tr>\n". "<tr style=\"background-color: #fefefe;\">\n". "<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".
|
"</tr>\n".
| "</tr>\n".
|
"<tr>\n". "<td bgcolor=\"#ffffff\">Query Time: ".$qtime."</td>\n". "</tr>\n".
| "<tr>\n". "<td bgcolor=\"#ffffff\">Query Time: ".$qtime."</td>\n". "</tr>\n".
|
Zeile 396 | Zeile 404 |
---|
$this->querylist[$this->query_count]['query'] = $string; $this->querylist[$this->query_count]['time'] = $qtime; }
|
$this->querylist[$this->query_count]['query'] = $string; $this->querylist[$this->query_count]['time'] = $qtime; }
|
|
|
/** * Return a result array for a query. *
| /** * Return a result array for a query. *
|
Zeile 405 | Zeile 413 |
---|
* @param constant The type of array to return. * @return array The array of results. */
|
* @param constant The type of array to return. * @return array The array of results. */
|
function fetch_array($query)
| function fetch_array($query, $resulttype=PGSQL_ASSOC)
|
{
|
{
|
$array = pg_fetch_assoc($query);
| switch($resulttype) { case PGSQL_NUM: case PGSQL_BOTH: break; default: $resulttype = PGSQL_ASSOC; break; }
$array = pg_fetch_array($query, NULL, $resulttype);
|
return $array; }
| return $array; }
|
Zeile 569 | Zeile 588 |
---|
*/ function affected_rows() {
|
*/ function affected_rows() {
|
return pg_affected_rows($this->current_link);
| return pg_affected_rows($this->last_result);
|
}
/**
| }
/**
|