Fix some typos and docblocks

This commit is contained in:
Timothy Warren 2014-04-22 14:02:54 -04:00
parent d6c0fd23dc
commit 0a64edd453
7 changed files with 178 additions and 120 deletions

View File

@ -31,7 +31,7 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
/** /**
* Reference to the last executed query * Reference to the last executed query
* @var PDOStatement * @var \PDOStatement
*/ */
protected $statement; protected $statement;
@ -49,7 +49,7 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
/** /**
* Reference to util class * Reference to util class
* @var DB_Util * @var Abstract_Util
*/ */
public $util; public $util;
@ -102,6 +102,7 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
* *
* @param string $name * @param string $name
* @param array $args * @param array $args
* @return mixed
*/ */
public function __call($name, $args = array()) public function __call($name, $args = array())
{ {
@ -415,7 +416,7 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/** /**
* Retreives an array of non-user-created tables for * Retrieves an array of non-user-created tables for
* the connection/database * the connection/database
* *
* @return array * @return array
@ -479,7 +480,7 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/** /**
* Method to simplify retreiving db results for meta-data queries * Method to simplify retrieving db results for meta-data queries
* *
* @param string|array|null $query * @param string|array|null $query
* @param bool $filtered_index * @param bool $filtered_index

View File

@ -65,9 +65,9 @@ final class Connection_Manager {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Make sure serialize/deseriaze doesn't work * Make sure serialize/deserialize doesn't work
* @codeCoverageIgnore * @codeCoverageIgnore
* @throws DomainException * @throws \DomainException
*/ */
private function __wakeup() private function __wakeup()
{ {
@ -102,11 +102,11 @@ final class Connection_Manager {
* *
* @param string|array|object $name * @param string|array|object $name
* @return Query_Builder * @return Query_Builder
* @throws InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function get_connection($name = '') public function get_connection($name = '')
{ {
// If the paramater is a string, use it as an array index // If the parameter is a string, use it as an array index
if (is_scalar($name) && isset($this->connections[$name])) if (is_scalar($name) && isset($this->connections[$name]))
{ {
return $this->connections[$name]; return $this->connections[$name];
@ -169,6 +169,7 @@ final class Connection_Manager {
* Parses params into a dsn and option array * Parses params into a dsn and option array
* *
* @param \ArrayObject $params * @param \ArrayObject $params
* @return array
* @throws BadDBDriverException * @throws BadDBDriverException
*/ */
private function parse_params(\ArrayObject $params) private function parse_params(\ArrayObject $params)
@ -177,7 +178,7 @@ final class Connection_Manager {
$dbtype = ($params->type !== 'postgresql') ? $params->type : 'pgsql'; $dbtype = ($params->type !== 'postgresql') ? $params->type : 'pgsql';
// Make sure the class exists // Make sure the class exists
if ( ! class_exists("Query\\Driver\\$dbtype")) if ( ! class_exists("Query\\Driver\\{$dbtype}"))
{ {
throw new BadDBDriverException('Database driver does not exist, or is not supported'); throw new BadDBDriverException('Database driver does not exist, or is not supported');
} }

View File

@ -27,9 +27,9 @@ interface Driver_Interface {
* Constructor/Connection method * Constructor/Connection method
* *
* @param string $dsn * @param string $dsn
* @param [string] $username * @param string $username
* @param [string] $password * @param string $password
* @param [array] $driver_options * @param array $driver_options
* @return void * @return void
*/ */
public function __construct($dsn, $username=NULL, $password=NULL, array $driver_options = array()); public function __construct($dsn, $username=NULL, $password=NULL, array $driver_options = array());
@ -74,7 +74,7 @@ interface Driver_Interface {
* Get a connection attribute for the current db driver * Get a connection attribute for the current db driver
* *
* @param int $attribute * @param int $attribute
* @returm mixed * @return mixed
*/ */
public function getAttribute($attribute); public function getAttribute($attribute);
@ -92,5 +92,53 @@ interface Driver_Interface {
* @return bool * @return bool
*/ */
public function setAttribute($attribute, $value); public function setAttribute($attribute, $value);
/**
* Retrieve column information for the current database table
*
* @param string $table
* @return array
*/
public function get_columns($table);
/**
* Retrieve foreign keys for the table
*
* @param string $table
* @return array
*/
public function get_fks($table);
/**
* Return list of tables for the current database
*
* @return array
*/
public function get_tables();
/**
* Surrounds the string with the databases identifier escape characters
*
* @param mixed $ident
* @return string
*/
public function quote_ident($ident);
/**
* Quote database table name, and set prefix
*
* @param string $table
* @return string
*/
public function quote_table($table);
/**
* Create and execute a prepared statement with the provided parameters
*
* @param string $sql
* @param array $params
* @return \PDOStatement
*/
public function prepare_execute($sql, $params);
} }
// End of driver_interface.php // End of driver_interface.php

View File

@ -26,10 +26,9 @@ interface SQL_Interface {
/** /**
* Get database specific sql for limit clause * Get database specific sql for limit clause
* *
* @abstract
* @param string $sql * @param string $sql
* @param int $limit * @param int $limit
* @param int $offset * @param int|bool $offset
* @return string * @return string
*/ */
public function limit($sql, $limit, $offset=FALSE); public function limit($sql, $limit, $offset=FALSE);
@ -45,7 +44,6 @@ interface SQL_Interface {
/** /**
* Get the sql for random ordering * Get the sql for random ordering
* *
* @abstract
* @return string * @return string
*/ */
public function random(); public function random();

View File

@ -18,7 +18,7 @@ namespace Query;
use \Query\Driver\Driver_Interface; use \Query\Driver\Driver_Interface;
/** /**
* Convienience class for creating sql queries - also the class that * Convenience class for creating sql queries - also the class that
* instantiates the specific db driver * instantiates the specific db driver
* *
* @package Query * @package Query
@ -32,13 +32,13 @@ class Query_Builder implements Query_Builder_Interface {
/** /**
* Compiled 'select' clause * Compiled 'select' clause
* @var type string * @var string
*/ */
protected $select_string = ''; protected $select_string = '';
/** /**
* Compiled 'from' clause * Compiled 'from' clause
* @var type string * @var string
*/ */
protected $from_string; protected $from_string;
@ -279,7 +279,7 @@ class Query_Builder implements Query_Builder_Interface {
* Selects the maximum value of a field from a query * Selects the maximum value of a field from a query
* *
* @param string $field * @param string $field
* @param string $as * @param string|FALSE $as
* @return Query_Builder * @return Query_Builder
*/ */
public function select_max($field, $as=FALSE) public function select_max($field, $as=FALSE)
@ -562,7 +562,7 @@ class Query_Builder implements Query_Builder_Interface {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Do all the repeditive stuff for where/having type methods * Do all the repedative stuff for where/having type methods
* *
* @param mixed $key * @param mixed $key
* @param mixed $val * @param mixed $val
@ -891,7 +891,7 @@ class Query_Builder implements Query_Builder_Interface {
* Set a limit on the current sql statement * Set a limit on the current sql statement
* *
* @param int $limit * @param int $limit
* @param int $offset * @param int|bool $offset
* @return Query_Builder * @return Query_Builder
*/ */
public function limit($limit, $offset=FALSE) public function limit($limit, $offset=FALSE)
@ -973,8 +973,8 @@ class Query_Builder implements Query_Builder_Interface {
* execute current compiled query * execute current compiled query
* *
* @param $table * @param $table
* @param int $limit * @param int|bool $limit
* @param int $offset * @param int|bool $offset
* @return PDOStatement * @return PDOStatement
*/ */
public function get($table='', $limit=FALSE, $offset=FALSE) public function get($table='', $limit=FALSE, $offset=FALSE)

View File

@ -311,7 +311,15 @@ class Table_Builder {
*/ */
public function has_foreign_key($columns, $constraint = NULL) public function has_foreign_key($columns, $constraint = NULL)
{ {
$keys = $this->get_driver()->get_fks($this->name);
foreach($keys as $key)
{
}
return FALSE;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -363,7 +371,7 @@ class Table_Builder {
*/ */
public function get_columns() public function get_columns()
{ {
return $this->driver->get_columns($this->prefix_table($this->name)); return $this->driver->get_columns($this->name);
} }
@ -430,4 +438,4 @@ class Table_Builder {
} }
} }
// End of table_bulider.php // End of table_builder.php

View File

@ -72,6 +72,8 @@ class Firebird extends Abstract_Driver {
* @param string $user * @param string $user
* @param string $pass * @param string $pass
* @param array $options * @param array $options
* @throws \PDOException
* @return void
*/ */
public function __construct($dbpath, $user='SYSDBA', $pass='masterkey', array $options = array()) public function __construct($dbpath, $user='SYSDBA', $pass='masterkey', array $options = array())
{ {
@ -226,7 +228,7 @@ class Firebird extends Abstract_Driver {
* @param string $query * @param string $query
* @param array $options * @param array $options
* @return Firebird_Result * @return Firebird_Result
* @throws PDOException * @throws \PDOException
*/ */
public function prepare($query, $options=array()) public function prepare($query, $options=array())
{ {
@ -355,7 +357,7 @@ class Firebird extends Abstract_Driver {
*/ */
public function errorCode() public function errorCode()
{ {
return fbird_errcode(); return \fbird_errcode();
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------