Docblock updates
This commit is contained in:
parent
80595dfbbe
commit
2f16b616ef
@ -448,7 +448,7 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
|
|||||||
*/
|
*/
|
||||||
public function get_fks($table)
|
public function get_fks($table)
|
||||||
{
|
{
|
||||||
return $this->driver_query($this->sql->fk_list($this->prefix_table($table)), FALSE);
|
return $this->driver_query($this->sql->fk_list($table), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -109,6 +109,8 @@ abstract class Abstract_Util {
|
|||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drop the selected table
|
* Drop the selected table
|
||||||
@ -120,6 +122,8 @@ abstract class Abstract_Util {
|
|||||||
{
|
{
|
||||||
return 'DROP TABLE IF EXISTS '.$this->quote_table($name);
|
return 'DROP TABLE IF EXISTS '.$this->quote_table($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an SQL file with the database table structure
|
* Return an SQL file with the database table structure
|
||||||
@ -128,6 +132,8 @@ abstract class Abstract_Util {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract public function backup_structure();
|
abstract public function backup_structure();
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an SQL file with the database data as insert statements
|
* Return an SQL file with the database data as insert statements
|
||||||
|
@ -67,9 +67,9 @@ class Table_Builder {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param [string] $name
|
* @param string $name
|
||||||
* @param [array] $options
|
* @param array $options
|
||||||
* @param [Driver_Interface] $driver
|
* @param Driver_Interface $driver
|
||||||
* @return Table_Builder
|
* @return Table_Builder
|
||||||
*/
|
*/
|
||||||
public function __construct($name = '', $options = array(), Driver_Interface $driver = NULL)
|
public function __construct($name = '', $options = array(), Driver_Interface $driver = NULL)
|
||||||
@ -91,9 +91,9 @@ class Table_Builder {
|
|||||||
/**
|
/**
|
||||||
* Alias to constructor
|
* Alias to constructor
|
||||||
*
|
*
|
||||||
* @param [string] $name
|
* @param string $name
|
||||||
* @param [array] $options
|
* @param array $options
|
||||||
* @param [\Query\Driver\Driver_Interface] $driver
|
* @param Driver_Interface $driver
|
||||||
* @return Table_Builder
|
* @return Table_Builder
|
||||||
*/
|
*/
|
||||||
public function __invoke($name = '', $options = array(), Driver_Interface $driver = NULL)
|
public function __invoke($name = '', $options = array(), Driver_Interface $driver = NULL)
|
||||||
@ -106,7 +106,7 @@ class Table_Builder {
|
|||||||
/**
|
/**
|
||||||
* Set the reference to the current database driver
|
* Set the reference to the current database driver
|
||||||
*
|
*
|
||||||
* @param \Query\Driver\Driver_Interface $driver
|
* @param Driver_Interface $driver
|
||||||
* @return Table_Builder
|
* @return Table_Builder
|
||||||
*/
|
*/
|
||||||
public function set_driver(Driver_Interface $driver = NULL)
|
public function set_driver(Driver_Interface $driver = NULL)
|
||||||
@ -123,7 +123,7 @@ class Table_Builder {
|
|||||||
/**
|
/**
|
||||||
* Get the current DB Driver
|
* Get the current DB Driver
|
||||||
*
|
*
|
||||||
* @return \Query\Driver_Interface
|
* @return Driver_Interface
|
||||||
*/
|
*/
|
||||||
public function get_driver()
|
public function get_driver()
|
||||||
{
|
{
|
||||||
@ -152,6 +152,12 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified column name from the current table
|
||||||
|
*
|
||||||
|
* @param string $column_name
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function remove_column($column_name)
|
public function remove_column($column_name)
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@ -159,6 +165,13 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename the specified column on the current table
|
||||||
|
*
|
||||||
|
* @param string $old_name
|
||||||
|
* @param string $new_name
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function rename_column($old_name, $new_name)
|
public function rename_column($old_name, $new_name)
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@ -166,6 +179,14 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the specified column on the current table
|
||||||
|
*
|
||||||
|
* @param string $column_name
|
||||||
|
* @param string $new_column_type
|
||||||
|
* @param array $options
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function change_column($column_name, $new_column_type, $options = array())
|
public function change_column($column_name, $new_column_type, $options = array())
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@ -173,6 +194,13 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the column currently exists on the current table
|
||||||
|
*
|
||||||
|
* @param string $column_name
|
||||||
|
* @param array $options
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function has_column($column_name, $options = array())
|
public function has_column($column_name, $options = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -182,6 +210,13 @@ class Table_Builder {
|
|||||||
// ! Index Methods
|
// ! Index Methods
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an index to the current table
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
* @param array $options
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function add_index($columns, $options = array())
|
public function add_index($columns, $options = array())
|
||||||
{
|
{
|
||||||
$col = new Table_Index($columns, $options);
|
$col = new Table_Index($columns, $options);
|
||||||
@ -192,6 +227,12 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an index from the current table
|
||||||
|
* @param array $columns
|
||||||
|
* @param array $options
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function remove_index($columns, $options = array())
|
public function remove_index($columns, $options = array())
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@ -199,6 +240,12 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an index by its name from the current table
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function remove_index_by_name($name)
|
public function remove_index_by_name($name)
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@ -206,6 +253,13 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the current table has an index on the specified columns
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
* @param array $options
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function has_index($columns, $options = array())
|
public function has_index($columns, $options = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -215,6 +269,15 @@ class Table_Builder {
|
|||||||
// ! Foreign Key Methods
|
// ! Foreign Key Methods
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a foreign key to the current table
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
* @param string $referenced_table
|
||||||
|
* @param array $referenced_columns
|
||||||
|
* @param array $options
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function add_foreign_key($columns, $referenced_table, $referenced_columns = array('id'), $options = array())
|
public function add_foreign_key($columns, $referenced_table, $referenced_columns = array('id'), $options = array())
|
||||||
{
|
{
|
||||||
$key = new Table_Foreign_Key($columns, $referenced_table, $referenced_columns, $options);
|
$key = new Table_Foreign_Key($columns, $referenced_table, $referenced_columns, $options);
|
||||||
@ -225,13 +288,27 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop the foreign key from the current table
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
* @param string $constraint
|
||||||
|
* @return \Query\Table\Table_Builder
|
||||||
|
*/
|
||||||
public function drop_foreign_key($columns, $constraint = NULL)
|
public function drop_foreign_key($columns, $constraint = NULL)
|
||||||
{
|
{
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the current table has the specified foreign key
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
* @param string $constraint
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function has_foreign_key($columns, $constraint = NULL)
|
public function has_foreign_key($columns, $constraint = NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -241,6 +318,11 @@ class Table_Builder {
|
|||||||
// ! Table-wide methods
|
// ! Table-wide methods
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the current table exists
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function exists()
|
public function exists()
|
||||||
{
|
{
|
||||||
$tables = $this->driver->get_tables();
|
$tables = $this->driver->get_tables();
|
||||||
@ -249,6 +331,11 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop the current table
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function drop()
|
public function drop()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -256,6 +343,12 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename the current table
|
||||||
|
*
|
||||||
|
* @param string $new_table_name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function rename($new_table_name)
|
public function rename($new_table_name)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -263,9 +356,14 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of columns for the current table
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function get_columns()
|
public function get_columns()
|
||||||
{
|
{
|
||||||
|
return $this->driver->get_columns($this->prefix_table($this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -273,6 +371,11 @@ class Table_Builder {
|
|||||||
// ! Action methods
|
// ! Action methods
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the table from the previously set options
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->reset();
|
$this->reset();
|
||||||
@ -280,6 +383,11 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the current table with the changes made
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
$this->reset();
|
$this->reset();
|
||||||
@ -287,6 +395,11 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the changes made to the table
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
($this->exists())
|
($this->exists())
|
||||||
@ -296,6 +409,11 @@ class Table_Builder {
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the state of the table builder
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function reset()
|
public function reset()
|
||||||
{
|
{
|
||||||
$skip = array(
|
$skip = array(
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<target>docs</target>
|
<target>docs</target>
|
||||||
</transformer>
|
</transformer>
|
||||||
<transformations>
|
<transformations>
|
||||||
<template name="responsive" />
|
<template name="clean" />
|
||||||
</transformations>
|
</transformations>
|
||||||
<files>
|
<files>
|
||||||
<directory>.</directory>
|
<directory>.</directory>
|
||||||
|
Loading…
Reference in New Issue
Block a user