Skip to content

Commit

Permalink
Change spaces to tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Nov 19, 2024
1 parent 8ae22ac commit 1e68929
Showing 1 changed file with 69 additions and 69 deletions.
138 changes: 69 additions & 69 deletions system/libs/pot/OTS_DB_MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,49 +53,49 @@ class OTS_DB_MySQL extends OTS_Base_DB
* @param array $params Connection parameters.
* @throws PDOException On PDO operation error.
*/
public function __construct($params)
{
$user = null;
$password = null;
$dns = array();

// host:port support
if( strpos(':', $params['host']) !== false)
{
$host = explode(':', $params['host'], 2);

$params['host'] = $host[0];
$params['port'] = $host[1];
}

if( isset($params['database']) )
{
$dns[] = 'dbname=' . $params['database'];
}

if( isset($params['user']) )
{
$user = $params['user'];
}

if( isset($params['password']) )
{
$password = $params['password'];
}

if( isset($params['prefix']) )
{
$this->prefix = $params['prefix'];
}

if( isset($params['log']) && $params['log'] )
{
$this->logged = true;
}

if( !isset($params['persistent']) ) {
$params['persistent'] = false;
}
public function __construct($params)
{
$user = null;
$password = null;
$dns = array();

// host:port support
if( strpos(':', $params['host']) !== false)
{
$host = explode(':', $params['host'], 2);

$params['host'] = $host[0];
$params['port'] = $host[1];
}

if( isset($params['database']) )
{
$dns[] = 'dbname=' . $params['database'];
}

if( isset($params['user']) )
{
$user = $params['user'];
}

if( isset($params['password']) )
{
$password = $params['password'];
}

if( isset($params['prefix']) )
{
$this->prefix = $params['prefix'];
}

if( isset($params['log']) && $params['log'] )
{
$this->logged = true;
}

if( !isset($params['persistent']) ) {
$params['persistent'] = false;
}

global $config;
$cache = Cache::getInstance();
Expand Down Expand Up @@ -144,10 +144,10 @@ public function __construct($params)
}

parent::__construct('mysql:' . implode(';', $dns), $user, $password, $driverAttributes);
}
}

public function __destruct()
{
{
global $config;

$cache = Cache::getInstance();
Expand Down Expand Up @@ -176,10 +176,10 @@ public function __destruct()
* @param string $name Field name.
* @return string Quoted name.
*/
public function fieldName($name)
{
return '`' . $name . '`';
}
public function fieldName($name)
{
return '`' . $name . '`';
}

/**
* LIMIT/OFFSET clause for queries.
Expand All @@ -188,26 +188,26 @@ public function fieldName($name)
* @param int|bool $offset Number of rows to be skipped before applying query effects (false if no offset).
* @return string LIMIT/OFFSET SQL clause for query.
*/
public function limit($limit = false, $offset = false)
{
// by default this is empty part
$sql = '';

if($limit !== false)
{
$sql = ' LIMIT ';

// OFFSET has no effect if there is no LIMIT
if($offset !== false)
{
$sql .= $offset . ', ';
}

$sql .= $limit;
}

return $sql;
}
public function limit($limit = false, $offset = false)
{
// by default this is empty part
$sql = '';

if($limit !== false)
{
$sql = ' LIMIT ';

// OFFSET has no effect if there is no LIMIT
if($offset !== false)
{
$sql .= $offset . ', ';
}

$sql .= $limit;
}

return $sql;
}

public function hasTable($name) {
if(isset($this->has_table_cache[$name])) {
Expand Down

0 comments on commit 1e68929

Please sign in to comment.