| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/araltecservicios/src/Database/ |
Upload File : |
<?php
namespace Mosaico\Database;
class DB
{
private $adaptor;
/**
* Constructor
*/
public function __construct(
string $driver,
string $hostname,
string $username,
string $password,
string $database,
int $port = 3306
) {
$class = 'Mosaico\Database\Drivers\\' . $driver;
if (class_exists($class)) {
$this->adaptor = new $class($hostname, $username, $password, $database, $port);
} else {
throw new \Exception('Error: Could not load database adaptor ' . $driver . '!');
}
}
/**
* Query
*/
public function query(string $sql)
{
return $this->adaptor->query($sql);
}
/**
* Escape
* @return string returns escaped value
*/
public function escape(string $value)
{
return $this->adaptor->escape($value);
}
/**
* Count Affected
*
* Gets the total number of affected rows from the last query
*
* @return int returns the total number of affected rows.
*/
public function countAffected()
{
return $this->adaptor->countAffected();
}
/**
* Get Last ID
*
* Get the last ID gets the primary key that was returned after creating a row in a table.
*
* @return int returns last ID
*/
public function getLastId()
{
return $this->adaptor->getLastId();
}
/**
* Is Connected
*
* Checks if a DB connection is active.
*/
public function isConnected()
{
return $this->adaptor->isConnected();
}
}