<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* Merged with new SQL Layer by Quake                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (stristr(htmlentities($_SERVER['PHP_SELF']), "sql_layer.php")) {
    Header("Location: ../index.php");
    die();
}

if(!defined("SQL_LAYER")) {
  require_once("db/db.php");
}

class ResultSet {
    var $result;
    var $total_rows;
    var $fetched_rows;

    function set_result( $res ) {
        $this->result = $res;
    }

    function get_result() {
        return $this->result;
    }

    function set_total_rows( $rows ) {
        $this->total_rows = $rows;
    }

    function get_total_rows() {
        return $this->total_rows;
    }

    function set_fetched_rows( $rows ) {
        $this->fetched_rows = $rows;
    }

    function get_fetched_rows() {
        return $this->fetched_rows;
    }

    function increment_fetched_rows() {
        $this->fetched_rows++;
    }
}

function sql_logout($id)
{
global $db;
  return $db->sql_close($id);
}

function sql_query($query, $id="")
{
global $db;
  return $db->sql_query($query);
}

function sql_num_rows($res)
{
global $db;
  return $db->sql_numrows($res);
}

function sql_fetch_row(&$res, $nr=0)
{
global $db;
  return $db->sql_fetchrow($res);
}

function sql_fetch_array(&$res, $nr=0)
{
global $db;
  return $db->sql_fetchrow($res);
}

function sql_fetch_object(&$res, $nr=0) {
global $db;
  $message = 'The function sql_fetch_object is not supported anymore!';
  $message .= '<br>Please start using $db->sql_fetchrow';
  return die($message);
}

function sql_free_result($res) {
global $db;
  return $db->sql_freeresult($res);
}

?>
