Commit a123dfe7 authored by tbrehm's avatar tbrehm
Browse files

Updated mysql database library to support replication.

parent a78dfc66
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -28,13 +27,12 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class db
{
class db
{
var $dbHost = ""; // hostname of the MySQL server
var $dbName = ""; // logical database name on that server
var $dbUser = ""; // database authorized user
var $dbPass = ""; // user's password
var $dbCharset = ""; // what charset comes and goes to mysql: utf8 / latin1
var $linkId = 0; // last result of mysql_connect()
var $queryId = 0; // last result of mysql_query()
var $record = array(); // last record fetched
......@@ -42,7 +40,7 @@ class db
var $currentRow; // current row number
var $errorNumber = 0; // last error number
var $errorMessage = ""; // last error message
var $errorLocation = ""; // last error location
var $errorLocation = "";// last error location
var $show_error_messages = false;
// constructor
......@@ -54,7 +52,6 @@ class db
$this->dbName = $conf["db_database"];
$this->dbUser = $conf["db_user"];
$this->dbPass = $conf["db_password"];
$this->dbCharset = $conf["db_charset"];
//$this->connect();
}
......@@ -81,7 +78,6 @@ class db
$this->updateError('DB::connect()<br />mysql_connect');
return false;
}
$this->queryId = @mysql_query('SET NAMES '.$this->dbCharset, $this->linkId);
}
return true;
}
......@@ -227,13 +223,23 @@ class db
}
}
function closeConn() {
public function closeConn()
{
if($this->linkId)
{
mysql_close($this->linkId);
return true;
} else { return false; }
}
function freeResult() {
public function freeResult($query)
{
if(mysql_free_result($query))
{
return true;
} else {
return false;
}
}
function delete() {
......@@ -484,6 +490,6 @@ class db
}
}
}
}
?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment