cvs: bugtracker /includes/database mysql.php mysqli.php

From: Date: Wed, 20 Aug 2008 09:44:58 +0000
Subject: cvs: bugtracker /includes/database mysql.php mysqli.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-2470@lists.php.net to get a copy of this message
bcarlyon Wed Aug 20 09:44:58 2008 UTC Modified files: /bugtracker/includes/database mysql.php mysqli.php Log: Tidied up http://cvs.php.net/viewvc.cgi/bugtracker/includes/database/mysql.php?r1=1.1&r2=1.2&diff_format=u Index: bugtracker/includes/database/mysql.php diff -u bugtracker/includes/database/mysql.php:1.1 bugtracker/includes/database/mysql.php:1.2 --- bugtracker/includes/database/mysql.php:1.1 Wed Aug 13 20:18:10 2008 +++ bugtracker/includes/database/mysql.php Wed Aug 20 09:44:58 2008 @@ -37,7 +37,7 @@ * @author Barry Carlyon <bcarlyon@php.net> * @copyright 2004-2008 Barry Carlyon * @license http://www.opensource.org/licenses/bsd-license.php BSD License -* @version CVS: $Id: mysql.php,v 1.1 2008/08/13 20:18:10 bcarlyon Exp $ +* @version CVS: $Id: mysql.php,v 1.2 2008/08/20 09:44:58 bcarlyon Exp $ * @link http://gsoc.barrycarlyon.servegame.org/ */ @@ -124,29 +124,3 @@ } } -//////////////////////////////////////////////////////////////////////////// - -/* -function getdata($query) { - //make a database connection - - global $database; - if (!($connection = @ mysql_connect($database['host'], $database['user'], $database['password']))) - { - return "offline"; - } - else - { - if (!(mysql_select_db($database['name']))) - showerror(); - if(!($result = @ mysql_query ($query, $connection))) - showerror(); - } - return $result; -} - -function showerror() { - print("Error " . mysql_errno() . " : ". mysql_error()); -} -*/ - http://cvs.php.net/viewvc.cgi/bugtracker/includes/database/mysqli.php?r1=1.1&r2=1.2&diff_format=u Index: bugtracker/includes/database/mysqli.php diff -u bugtracker/includes/database/mysqli.php:1.1 bugtracker/includes/database/mysqli.php:1.2 --- bugtracker/includes/database/mysqli.php:1.1 Wed Aug 13 20:18:10 2008 +++ bugtracker/includes/database/mysqli.php Wed Aug 20 09:44:58 2008 @@ -37,7 +37,7 @@ * @author Barry Carlyon <bcarlyon@php.net> * @copyright 2004-2008 Barry Carlyon * @license http://www.opensource.org/licenses/bsd-license.php BSD License -* @version CVS: $Id: mysqli.php,v 1.1 2008/08/13 20:18:10 bcarlyon Exp $ +* @version CVS: $Id: mysqli.php,v 1.2 2008/08/20 09:44:58 bcarlyon Exp $ * @link http://gsoc.barrycarlyon.servegame.org/ */ @@ -57,14 +57,8 @@ { return 'offline'; } + // store the connection id for things like total rows and affected rows $this->connect_id = $connection; -/* - if (! @ mysqli_select_db($this->name)) - { - //no db name connect - return 'offline'; - } -*/ return ($connection); } function protect_data($data) @@ -76,16 +70,13 @@ if (!$query) { global $content; - $content .= '<div id="error">No Query</div>'; + trigger_error('The Database was asked a question, but no question was given', E_USER_ERROR); return; } $query = str_replace(array('"NOW()"',"'NOW()'"),'NOW()',$query); -// $query = mysqli_real_escape_string($this->connect_id,$query); $this->query = $query; -$this->query_count ++; -//global $content; -//$content .= '<br />I did a query! ' . $query . ' - ' . $this->query_count . '<br />'; + $this->query_count ++; if(!($result = @ mysqli_query ($this->connect_id,$query))) { @@ -118,12 +109,11 @@ return mysqli_fetch_array($result); } function handle_error($error = '') { - global $content; - $content .= '<div id="error">Error ' . mysqli_errno($this->connect_id) . " : ". mysqli_error($this->connect_id) . ' - ' . $this->query . '</div>'; - return; + trigger_error('Error ' . mysqli_errno($this->connect_id) . " : ". mysqli_error($this->connect_id) . ' - ' . $this->query . ' -- ' . $error, E_USER_ERROR); } function close() { @ mysqli_close($this->connect_id); + return; } }

« previous php.webmaster (#2470) next »