Refactor class.Product.php and class.S.php for improved code readability and maintainability
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Medoo database framework
|
||||
* http://medoo.in
|
||||
* Version 0.9.7
|
||||
*
|
||||
*
|
||||
* Copyright 2014, Angel Lai
|
||||
* Released under the MIT license
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ class gdb
|
||||
|
||||
protected $option = array();
|
||||
|
||||
// Variable
|
||||
// Variable
|
||||
protected $logs = array();
|
||||
|
||||
public function __construct($options = null)
|
||||
@@ -131,7 +131,7 @@ class gdb
|
||||
}
|
||||
|
||||
$this->pdo = new PDO(
|
||||
$dsn,
|
||||
$dsn,
|
||||
$this->username,
|
||||
$this->password,
|
||||
$this->option
|
||||
@@ -148,14 +148,14 @@ class gdb
|
||||
}
|
||||
|
||||
public function query($query)
|
||||
{
|
||||
{
|
||||
array_push($this->logs, $query);
|
||||
|
||||
return $this->pdo->query($query);
|
||||
}
|
||||
|
||||
public function exec($query)
|
||||
{
|
||||
{
|
||||
array_push($this->logs, $query);
|
||||
|
||||
return $this->pdo->exec($query);
|
||||
@@ -199,7 +199,10 @@ class gdb
|
||||
}
|
||||
}
|
||||
|
||||
return implode($stack, ',');
|
||||
if ( is_array( $stack ) )
|
||||
return implode( ',', $stack );
|
||||
else
|
||||
return $stack;
|
||||
}
|
||||
|
||||
protected function array_quote($array)
|
||||
@@ -318,11 +321,11 @@ class gdb
|
||||
}
|
||||
|
||||
$value = '%' . $value . '%';
|
||||
|
||||
|
||||
$wheres[] = $column . ' LIKE ' . $this->fn_quote($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (in_array($operator, array('>', '>=', '<', '<=')))
|
||||
{
|
||||
if (is_numeric($value))
|
||||
@@ -835,7 +838,7 @@ class gdb
|
||||
if (isset($data[0]))
|
||||
{
|
||||
$column = $where == null ? $join : $column;
|
||||
|
||||
|
||||
if (is_string($column) && $column != '*')
|
||||
{
|
||||
return $data[ 0 ][ $column ];
|
||||
|
||||
Reference in New Issue
Block a user