the rest of the included code
class/database/mysql.php
<?php
// $Id: mysql.php,v 1.12 2003/07/11 02:05:35 half-dead Exp $
// Original Author: Half-Dead
// Author Website : http://www.e-xoops.com
// License Type : Proprietary: See /manual/LICENSES/E-Xoops.txt
// ------------------------------------------------------------------------- //
if ( !defined("SQL_LAYER") ) {
define("SQL_LAYER", "mysql");
include_once(XOOPS_ROOT_PATH."/class/database.php");
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
class Database extends AbsDatabase {
var $db_connect;
var $query_log;
//----------------------------------------------------------------------------------------//
function connect($server, $user, $pass, $persistent=0) {
!empty($persistent) ? $this->db_connect = mysql_pconnect($server, $user, $pass) : $this->db_connect = mysql_connect($server, $user, $pass);
return $this->db_connect;
}
//----------------------------------------------------------------------------------------//
function select_db($db) {
return mysql_select_db($db, $this->db_connect);
}
//----------------------------------------------------------------------------------------//
function close() {
return mysql_close($this->db_connect);
}
//------------------------------------------------------------------------------------------//
function query($sql, $limit=0, $start=0) {
if ( ($this->debug & 8) || ($this->debug & 16) ) {
$this->query_log[] = $sql;
} else {
$this->query_log[] = 0;
}
if ( !empty($limit) ) {
if (empty($start)) {
$start = 0;
}
$sql = $sql. " LIMIT ".intval($start).",".intval($limit)."";
}
if ($this->debug & 16) {
if ( function_exists('xdebug_call_function') ) {
if ( function_exists('xdebug_call_class') ) {
if ($caller_class = xdebug_call_class()) {
$output = "<b>".$caller_class." ::</b> ";
}
}
$output .= "<b>".xdebug_call_function()."()</b><br />";
}
$output .= count($this->query_log).": ".$sql;
$this->bg = ($this->bg == 'bg3') ? $this->bg = 'bg1' : $this->bg = 'bg3';
echo "<div align='left' style='border-top:1px dashed #003030; padding: 3px;' class='".$this->bg."'>".$output."</div>";
}
$result = mysql_query($sql, $this->db_connect);
return $result;
}
//---------------------------------------------------------------------------------------//
/**
* Depracted, use $db->query()
*/
function queryF($sql, $limit=0, $start=0) {
$result = $this->query($sql, $limit, $start);
return $result;
}
//------------------------------------------------------------------------------------------//
// query should be rewritten to include this;
function genId($sequence) {
return 0;
}
//------------------------------------------------------------------------------------------//
function affected_rows() {
$result = mysql_affected_rows($this->db_connect);
return $result;
}
//------------------------------------------------------------------------------------------//
function num_rows($resource) {
$result = mysql_num_rows($resource);
return $result;
}
//------------------------------------------------------------------------------------------//
function num_fields($resource) {
$result = mysql_num_fields($resource);
return $result;
}
//------------------------------------------------------------------------------------------//
function field_name($resource, $index) {
$result = mysql_field_name($resource, $index);
return $result;
}
//------------------------------------------------------------------------------------------//
function field_type($resource, $offset) {
$result = mysql_field_type($resource, $offset);
return $result;
}
//------------------------------------------------------------------------------------------//
function fetch_array($resource) {
$result = mysql_fetch_array($resource);
return $result;
}
//------------------------------------------------------------------------------------------//
function fetch_object($resource) {
$result = mysql_fetch_object($resource);
return $result;
}
//------------------------------------------------------------------------------------------//
function fetch_row($resource) {
$result = mysql_fetch_row($resource);
return $result;
}
//------------------------------------------------------------------------------------------//
function insert_id() {
$result = mysql_insert_id($this->db_connect);
return $result;
}
//------------------------------------------------------------------------------------------//
function error() {
if ($this->debug & 1) {
$result = mysql_errno($this->db_connect) . ": " . mysql_error($this->db_connect);
return $result;
}
}
//------------------------------------------------------------------------------------------//
} // END CLASS
//------------------------------------------------------------------------------------------//
} // END DEFINE
?>