| Current Path : /home/smartconb/www/armencom33/administrator/components/com_eyesite/helpers/ |
| Current File : /home/smartconb/www/armencom33/administrator/components/com_eyesite/helpers/db_helper.php |
<?php
/********************************************************************
Product : Eyesite
Date : 1 December 2023
Copyright : Les Arbres Design 2014-2023
Contact : https://www.lesarbresdesign.info
Licence : GNU General Public License
*********************************************************************/
defined('_JEXEC') or die('Restricted Access');
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
if (class_exists("LAE_model"))
return;
class LAE_model extends BaseDatabaseModel
{
var $app;
var $db;
var $ladb_error_text;
var $ladb_error_code;
function __construct()
{
parent::__construct();
$this->app = Factory::getApplication();
$this->db = $this->_db; // make this public
}
//-------------------------------------------------------------------------------
// Execute a SQL query and return true if it worked, false if it failed
//
function ladb_execute($query)
{
try
{
$this->_db->setQuery($query);
$this->_db->execute();
}
catch (RuntimeException $e)
{
$this->ladb_error_text = $e->getMessage();
$this->ladb_error_code = $e->getCode();
return false;
}
return true;
}
//-------------------------------------------------------------------------------
// Get a single value from the database as an object and return it, or false if it failed
//
function ladb_loadResult($query)
{
try
{
$this->_db->setQuery($query);
$result = $this->_db->loadResult();
}
catch (RuntimeException $e)
{
$this->ladb_error_text = $e->getMessage();
$this->ladb_error_code = $e->getCode();
return false;
}
return $result;
}
//-------------------------------------------------------------------------------
// Get a row from the database as an object and return it, or false if it failed
//
function ladb_loadObject($query)
{
try
{
$this->_db->setQuery($query);
$result = $this->_db->loadObject();
}
catch (RuntimeException $e)
{
$this->ladb_error_text = $e->getMessage();
$this->ladb_error_code = $e->getCode();
return false;
}
return $result;
}
//-------------------------------------------------------------------------------
// Get an array of rows from the database and return it, or false if it failed
//
function ladb_loadObjectList($query, $limitstart = 0, $limit = 0)
{
try
{
$this->_db->setQuery($query, $limitstart, $limit);
$result = $this->_db->loadObjectList();
}
catch (RuntimeException $e)
{
$this->ladb_error_text = $e->getMessage();
$this->ladb_error_code = $e->getCode();
return false;
}
return $result;
}
}