Made it so class does query counting. Cleaned up errors.

git-svn-id: http://svn.automattic.com/wordpress/trunk@563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-12-04 19:02:21 +00:00
parent 523033062d
commit e1114fe2bb
1 changed files with 11 additions and 7 deletions

View File

@ -31,12 +31,14 @@
if ( ! $this->dbh ) if ( ! $this->dbh )
{ {
$this->print_error("<ol id='error'> $this->print_error("<div id='error'>
<li><strong>Error establishing a database connection!</strong></li> <p><strong>Error establishing a database connection!</strong></p>
<ul>
<li>Are you sure you have the correct user/password?</li> <li>Are you sure you have the correct user/password?</li>
<li>Are you sure that you have typed the correct hostname?</li> <li>Are you sure that you have typed the correct hostname?</li>
<li>Are you sure that the database server is running?</li> <li>Are you sure that the database server is running?</li>
</ol>"); </ul>
</div>");
} }
@ -90,10 +92,10 @@
if ( $this->show_errors ) if ( $this->show_errors )
{ {
// If there is an error then take note of it // If there is an error then take note of it
print "<ol id='error'> print "<div id='error'>
<li><strong>SQL/DB Error --</strong></li> <p><strong>SQL/DB Error:</strong><br />
<li>[<font color=000077>$str</font>]</li> [<span style='color: #007;'>$str</span>]</p>
</ol>"; </div>";
} }
else else
{ {
@ -145,6 +147,7 @@
// Perform the query via std mysql_query function.. // Perform the query via std mysql_query function..
$this->result = mysql_query($query, $this->dbh); $this->result = mysql_query($query, $this->dbh);
++$this->querycount;
// If there was an insert, delete or update see how many rows were affected // If there was an insert, delete or update see how many rows were affected
// (Also, If there there was an insert take note of the insert_id // (Also, If there there was an insert take note of the insert_id
@ -157,6 +160,7 @@
if ( preg_match("/^\\s*$word /i",$query) ) if ( preg_match("/^\\s*$word /i",$query) )
{ {
$this->rows_affected = mysql_affected_rows(); $this->rows_affected = mysql_affected_rows();
$this->querybump();
// This gets the insert ID // This gets the insert ID
if ( $word == 'insert' || $word == 'replace' ) if ( $word == 'insert' || $word == 'replace' )