Merge in Query changes

This commit is contained in:
Timothy Warren 2012-05-03 13:27:47 -04:00
parent 327ba4bf6f
commit b9a4cab29b
9 changed files with 28 additions and 28 deletions

View File

@ -50,7 +50,7 @@ foreach(pdo_drivers() as $d)
{ {
$dir = QDRIVER_PATH.$d; $dir = QDRIVER_PATH.$d;
if (is_dir($dir)) if(is_dir($dir))
{ {
array_map('do_include', glob($dir.'/*.php')); array_map('do_include', glob($dir.'/*.php'));
} }

View File

@ -90,7 +90,7 @@ abstract class DB_PDO extends PDO {
// Prepare the sql // Prepare the sql
$query = $this->prepare($sql); $query = $this->prepare($sql);
if ( ! (is_object($query) || is_resource($query))) if( ! (is_object($query) || is_resource($query)))
{ {
$this->get_last_error(); $this->get_last_error();
return FALSE; return FALSE;
@ -100,7 +100,7 @@ abstract class DB_PDO extends PDO {
$this->statement =& $query; $this->statement =& $query;
if ( ! (is_array($data) || is_object($data))) if( ! (is_array($data) || is_object($data)))
{ {
trigger_error("Invalid data argument"); trigger_error("Invalid data argument");
return FALSE; return FALSE;
@ -109,14 +109,14 @@ abstract class DB_PDO extends PDO {
// Bind the parameters // Bind the parameters
foreach($data as $k => $value) foreach($data as $k => $value)
{ {
if (is_numeric($k)) if(is_numeric($k))
{ {
$k++; $k++;
} }
$res = $query->bindValue($k, $value); $res = $query->bindValue($k, $value);
if ( ! $res) if( ! $res)
{ {
trigger_error("Parameter not successfully bound"); trigger_error("Parameter not successfully bound");
return FALSE; return FALSE;

View File

@ -39,7 +39,7 @@ class Settings {
*/ */
public static function &get_instance() public static function &get_instance()
{ {
if ( ! isset(self::$instance)) if( ! isset(self::$instance))
{ {
$name = __CLASS__; $name = __CLASS__;
self::$instance = new $name(); self::$instance = new $name();
@ -63,7 +63,7 @@ class Settings {
$path = SETTINGS_DIR.'/settings.json'; $path = SETTINGS_DIR.'/settings.json';
if ( ! is_file($path)) if( ! is_file($path))
{ {
//Create the file! //Create the file!
touch($path); touch($path);
@ -75,7 +75,7 @@ class Settings {
} }
// Add the DB object under the settings if it doesn't already exist // Add the DB object under the settings if it doesn't already exist
if ( ! isset($this->current->dbs)) if( ! isset($this->current->dbs))
{ {
$this->current->dbs = new stdClass(); $this->current->dbs = new stdClass();
} }
@ -122,7 +122,7 @@ class Settings {
public function __set($key, $val) public function __set($key, $val)
{ {
//Don't allow direct db config changes //Don't allow direct db config changes
if ($key == "dbs") if($key == "dbs")
{ {
return FALSE; return FALSE;
} }
@ -146,7 +146,7 @@ class Settings {
return FALSE; return FALSE;
} }
if ( ! isset($this->current->dbs->{$name})) if( ! isset($this->current->dbs->{$name}))
{ {
$params['name'] = $name; $params['name'] = $name;
@ -215,7 +215,7 @@ class Settings {
*/ */
public function remove_db($name) public function remove_db($name)
{ {
if ( ! isset($this->current->dbs->{$name})) if( ! isset($this->current->dbs->{$name}))
{ {
return FALSE; return FALSE;
} }

View File

@ -169,7 +169,7 @@ class Firebird extends DB_PDO {
*/ */
public function beginTransaction() public function beginTransaction()
{ {
if (($this->trans = fbird_trans($this->conn)) !== NULL) if(($this->trans = fbird_trans($this->conn)) !== NULL)
{ {
return TRUE; return TRUE;
} }
@ -231,7 +231,7 @@ class Firebird extends DB_PDO {
*/ */
public function quote($str, $param_type = NULL) public function quote($str, $param_type = NULL)
{ {
if (is_numeric($str)) if(is_numeric($str))
{ {
return $str; return $str;
} }

View File

@ -56,7 +56,7 @@ class Firebird_Util extends DB_Util {
// ) // )
foreach($fields as $colname => $type) foreach($fields as $colname => $type)
{ {
if (is_numeric($colname)) if(is_numeric($colname))
{ {
$colname = $type; $colname = $type;
} }
@ -65,7 +65,7 @@ class Firebird_Util extends DB_Util {
$column_array[$colname]['type'] = ($type !== $colname) ? $type : ''; $column_array[$colname]['type'] = ($type !== $colname) ? $type : '';
} }
if ( ! empty($constraints)) if( ! empty($constraints))
{ {
foreach($constraints as $col => $const) foreach($constraints as $col => $const)
{ {
@ -130,7 +130,7 @@ class Firebird_Util extends DB_Util {
public function backup_data($exclude=array(), $system_tables=FALSE) public function backup_data($exclude=array(), $system_tables=FALSE)
{ {
// Determine which tables to use // Determine which tables to use
if ($system_tables == TRUE) if($system_tables == TRUE)
{ {
$tables = array_merge($this->get_system_tables(), $this->get_tables()); $tables = array_merge($this->get_system_tables(), $this->get_tables());
} }
@ -140,7 +140,7 @@ class Firebird_Util extends DB_Util {
} }
// Filter out the tables you don't want // Filter out the tables you don't want
if ( ! empty($exclude)) if( ! empty($exclude))
{ {
$tables = array_diff($tables, $exclude); $tables = array_diff($tables, $exclude);
} }
@ -170,7 +170,7 @@ class Firebird_Util extends DB_Util {
$row = array_values($row); $row = array_values($row);
// Quote values as needed by type // Quote values as needed by type
if (stripos($t, 'RDB$') === FALSE) if(stripos($t, 'RDB$') === FALSE)
{ {
$row = array_map(array(&$this, 'quote'), $row); $row = array_map(array(&$this, 'quote'), $row);
$row = array_map('trim', $row); $row = array_map('trim', $row);

View File

@ -56,7 +56,7 @@ class MySQL_Util extends DB_Util {
// ) // )
foreach($columns as $colname => $type) foreach($columns as $colname => $type)
{ {
if (is_numeric($colname)) if(is_numeric($colname))
{ {
$colname = $type; $colname = $type;
} }
@ -65,7 +65,7 @@ class MySQL_Util extends DB_Util {
$column_array[$colname]['type'] = ($type !== $colname) ? $type : ''; $column_array[$colname]['type'] = ($type !== $colname) ? $type : '';
} }
if ( ! empty($constraints)) if( ! empty($constraints))
{ {
foreach($constraints as $col => $const) foreach($constraints as $col => $const)
{ {
@ -141,7 +141,7 @@ class MySQL_Util extends DB_Util {
$tables = $this->get_tables(); $tables = $this->get_tables();
// Filter out the tables you don't want // Filter out the tables you don't want
if ( ! empty($exclude)) if( ! empty($exclude))
{ {
$tables = array_diff($tables, $exclude); $tables = array_diff($tables, $exclude);
} }

View File

@ -32,7 +32,7 @@ class PgSQL_SQL extends DB_SQL {
{ {
$sql .= " LIMIT {$limit}"; $sql .= " LIMIT {$limit}";
if (is_numeric($offset)) if(is_numeric($offset))
{ {
$sql .= " OFFSET {$offset}"; $sql .= " OFFSET {$offset}";
} }

View File

@ -53,7 +53,7 @@ class PgSQL_Util extends DB_Util {
// ) // )
foreach($columns as $colname => $type) foreach($columns as $colname => $type)
{ {
if (is_numeric($colname)) if(is_numeric($colname))
{ {
$colname = $type; $colname = $type;
} }
@ -62,7 +62,7 @@ class PgSQL_Util extends DB_Util {
$column_array[$colname]['type'] = ($type !== $colname) ? $type : ''; $column_array[$colname]['type'] = ($type !== $colname) ? $type : '';
} }
if ( ! empty($constraints)) if( ! empty($constraints))
{ {
foreach($constraints as $col => $const) foreach($constraints as $col => $const)
{ {
@ -128,7 +128,7 @@ class PgSQL_Util extends DB_Util {
$tables = $this->get_tables(); $tables = $this->get_tables();
// Filter out the tables you don't want // Filter out the tables you don't want
if ( ! empty($exclude)) if( ! empty($exclude))
{ {
$tables = array_diff($tables, $exclude); $tables = array_diff($tables, $exclude);
} }

View File

@ -55,7 +55,7 @@ class SQLite_Util extends DB_Util {
// ) // )
foreach($columns as $colname => $type) foreach($columns as $colname => $type)
{ {
if (is_numeric($colname)) if(is_numeric($colname))
{ {
$colname = $type; $colname = $type;
} }
@ -64,7 +64,7 @@ class SQLite_Util extends DB_Util {
$column_array[$colname]['type'] = ($type !== $colname) ? $type : ''; $column_array[$colname]['type'] = ($type !== $colname) ? $type : '';
} }
if ( ! empty($constraints)) if( ! empty($constraints))
{ {
foreach($constraints as $col => $const) foreach($constraints as $col => $const)
{ {
@ -117,7 +117,7 @@ class SQLite_Util extends DB_Util {
// Get a list of all the objects // Get a list of all the objects
$sql = 'SELECT "name" FROM "sqlite_master"'; $sql = 'SELECT "name" FROM "sqlite_master"';
if ( ! empty($excluded)) if( ! empty($excluded))
{ {
$sql .= ' WHERE NOT IN("'.implode('","', $excluded).'")'; $sql .= ' WHERE NOT IN("'.implode('","', $excluded).'")';
} }