PHP Класс Ruckusing_Adapter_PgSQL_Base, ruckusing-migrations

Наследование: extends Ruckusing_Adapter_Base, implements Ruckusing_Adapter_Interface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( array $dsn, Ruckusing_Util_Logger $logger ) : Ruckusing_Adapter_PgSQL_Base Creates an instance of Ruckusing_Adapter_PgSQL_Base
__toString ( ) : string Return a message displaying the current version
add_column ( string $table_name, string $column_name, string $type, array $options = [] ) : boolean Add a column
add_column_options ( string $type, array $options, boolean $performing_change = false ) : string Add column options
add_index ( string $table_name, string $column_name, array $options = [] ) : boolean Add an index
add_timestamps ( string $table_name, string $created_column_name, string $updated_column_name ) : boolean Add timestamps
change_column ( string $table_name, string $column_name, string $type, array $options = [] ) : boolean Change a column
column_definition ( string $column_name, string $type, array $options = null ) : string Column definition
column_info ( string $table, string $column ) : array Get a column info
commit_transaction ( ) Commit Transaction
create_database ( string $db, array $options = [] ) : boolean Create database cannot run in a transaction block so if we're in a transaction than commit it, do our thing and then re-invoke the transaction
create_schema_version_table ( ) Create the schema table, if necessary
create_table ( string $table_name, array $options = [] ) : boolean | Ruckusing_Adapter_PgSQL_TableDefinition Create table
database_exists ( string $db ) : boolean Check if a db exists
drop_database ( string $db ) : boolean Drop a database
drop_table ( string $tbl ) : boolean Drop table
execute ( $query )
execute_ddl ( string $ddl ) : boolean Use this method for non-SELECT queries Or anything where you dont necessarily expect a result string, e.g. DROPs, CREATEs, etc.
get_database_name ( ) : string Get the current db name
has_index ( string $table_name, string $column_name, array $options = [] ) : boolean Check an index
identifier ( string $string ) : string Quote a string
indexes ( string $table_name ) : array Return all indexes of a table
multi_query ( string $queries ) : boolean Execute several queries
native_database_types ( ) : array Get the column native types
pk_and_sequence_for ( string $table ) : array Returns a table's primary key and belonging sequence.
primary_keys ( string $table_name ) : array get primary keys
query ( string $query ) : boolean Wrapper to execute a query
quote ( string $value, string $column = null ) : string Quote a string
quote_column_name ( string $string ) : string Quote column name
quote_string ( string $string ) : string Escape a string for mysql
quote_table_name ( string $string ) : string Quote table name
remove_column ( string $table_name, string $column_name ) : boolean Drop a column
remove_index ( string $table_name, string $column_name, array $options = [] ) : boolean Drop an index
remove_timestamps ( string $table_name, string $created_column_name, string $updated_column_name ) : boolean Remove timestamps
remove_version ( string $version ) : boolean remove a version
rename_column ( string $table_name, string $column_name, string $new_column_name ) : boolean Rename a column
rename_table ( string $name, string $new_name ) : boolean Renames a table.
rollback_transaction ( ) Rollback Transaction
schema ( string $output_file ) : integer | FALSE Dump the complete schema of the DB. This is really just all of the CREATE TABLE statements for all of the tables in the DB.
select_all ( string $query ) : array Select all
select_one ( string $query ) : array Select one
set_current_version ( string $version ) : boolean Set current version
start_transaction ( ) Start Transaction
supports_migrations ( ) : boolean Check support for migrations
table_exists ( string $tbl, boolean $reload_tables = false ) : boolean Check if a table exists
type_to_sql ( string $type, array $options = [] ) : string Convert type to sql

Приватные методы

Метод Описание
beginTransaction ( ) Start transaction
change_column_default ( string $table_name, string $column_name, string $default ) : boolean Change column default
change_column_null ( string $table_name, string $column_name, string $null, string $default = null ) : boolean Change column null
commit ( ) Commit a transaction
connect ( string $dsn ) Connect to the db
db_connect ( string $dsn ) : boolean Connect to the db
determine_query_type ( string $query ) : integer Check query type
inTransaction ( ) : boolean Check if in transaction
isError ( boolean $o ) : boolean Delegate to PEAR
is_select ( $query_type )
is_sql_method_call ( string $str ) : boolean Detect whether or not the string represents a function call and if so do not wrap it in single-quotes, otherwise do wrap in single quotes.
load_tables ( boolean $reload = true ) Initialize an array of table names
rollback ( ) Rollback a transaction

Описание методов

__construct() публичный Метод

Creates an instance of Ruckusing_Adapter_PgSQL_Base
public __construct ( array $dsn, Ruckusing_Util_Logger $logger ) : Ruckusing_Adapter_PgSQL_Base
$dsn array The current dsn being used
$logger Ruckusing_Util_Logger the current logger
Результат Ruckusing_Adapter_PgSQL_Base

__toString() публичный Метод

Return a message displaying the current version
public __toString ( ) : string
Результат string

add_column() публичный Метод

Add a column
public add_column ( string $table_name, string $column_name, string $type, array $options = [] ) : boolean
$table_name string the table name
$column_name string the column name
$type string the column type
$options array column options
Результат boolean

add_column_options() публичный Метод

Add column options
public add_column_options ( string $type, array $options, boolean $performing_change = false ) : string
$type string the native type
$options array
$performing_change boolean
Результат string

add_index() публичный Метод

Add an index
public add_index ( string $table_name, string $column_name, array $options = [] ) : boolean
$table_name string the table name
$column_name string the column name
$options array index options
Результат boolean

add_timestamps() публичный Метод

Add timestamps
public add_timestamps ( string $table_name, string $created_column_name, string $updated_column_name ) : boolean
$table_name string The table name
$created_column_name string Created at column name
$updated_column_name string Updated at column name
Результат boolean

change_column() публичный Метод

Change a column
public change_column ( string $table_name, string $column_name, string $type, array $options = [] ) : boolean
$table_name string the table name
$column_name string the column name
$type string the column type
$options array column options
Результат boolean

column_definition() публичный Метод

Column definition
public column_definition ( string $column_name, string $type, array $options = null ) : string
$column_name string the column name
$type string the type of the column
$options array column options
Результат string

column_info() публичный Метод

Get a column info
public column_info ( string $table, string $column ) : array
$table string the table name
$column string the column name
Результат array

commit_transaction() публичный Метод

Commit Transaction
public commit_transaction ( )

create_database() публичный Метод

Create database cannot run in a transaction block so if we're in a transaction than commit it, do our thing and then re-invoke the transaction
public create_database ( string $db, array $options = [] ) : boolean
$db string the db name
$options array
Результат boolean

create_schema_version_table() публичный Метод

Create the schema table, if necessary

create_table() публичный Метод

Create table
public create_table ( string $table_name, array $options = [] ) : boolean | Ruckusing_Adapter_PgSQL_TableDefinition
$table_name string the table name
$options array the options
Результат boolean | Ruckusing_Adapter_PgSQL_TableDefinition

database_exists() публичный Метод

Check if a db exists
public database_exists ( string $db ) : boolean
$db string the db name
Результат boolean

drop_database() публичный Метод

Drop a database
public drop_database ( string $db ) : boolean
$db string the db name
Результат boolean

drop_table() публичный Метод

Drop table
public drop_table ( string $tbl ) : boolean
$tbl string the table name
Результат boolean

execute() публичный Метод

public execute ( $query )

execute_ddl() публичный Метод

Use this method for non-SELECT queries Or anything where you dont necessarily expect a result string, e.g. DROPs, CREATEs, etc.
public execute_ddl ( string $ddl ) : boolean
$ddl string query to run
Результат boolean

get_database_name() публичный Метод

Get the current db name
public get_database_name ( ) : string
Результат string

has_index() публичный Метод

Check an index
public has_index ( string $table_name, string $column_name, array $options = [] ) : boolean
$table_name string the table name
$column_name string the column name
$options array index options
Результат boolean

identifier() публичный Метод

Quote a string
public identifier ( string $string ) : string
$string string the string
Результат string

indexes() публичный Метод

Return all indexes of a table
public indexes ( string $table_name ) : array
$table_name string the table name
Результат array

multi_query() публичный Метод

Execute several queries
public multi_query ( string $queries ) : boolean
$queries string queries to run
Результат boolean

native_database_types() публичный Метод

Get the column native types
public native_database_types ( ) : array
Результат array

pk_and_sequence_for() публичный Метод

Returns a table's primary key and belonging sequence.
public pk_and_sequence_for ( string $table ) : array
$table string the table name
Результат array

primary_keys() публичный Метод

get primary keys
public primary_keys ( string $table_name ) : array
$table_name string the table name
Результат array

query() публичный Метод

Wrapper to execute a query
public query ( string $query ) : boolean
$query string query to run
Результат boolean

quote() публичный Метод

Quote a string
public quote ( string $value, string $column = null ) : string
$value string the string
$column string the column
Результат string

quote_column_name() публичный Метод

Quote column name
public quote_column_name ( string $string ) : string
$string string the string
Результат string

quote_string() публичный Метод

Escape a string for mysql
public quote_string ( string $string ) : string
$string string the string
Результат string

quote_table_name() публичный Метод

Quote table name
public quote_table_name ( string $string ) : string
$string string the string
Результат string

remove_column() публичный Метод

Drop a column
public remove_column ( string $table_name, string $column_name ) : boolean
$table_name string the table name
$column_name string the column name
Результат boolean

remove_index() публичный Метод

Drop an index
public remove_index ( string $table_name, string $column_name, array $options = [] ) : boolean
$table_name string the table name
$column_name string the column name
$options array index options
Результат boolean

remove_timestamps() публичный Метод

Remove timestamps
public remove_timestamps ( string $table_name, string $created_column_name, string $updated_column_name ) : boolean
$table_name string The table name
$created_column_name string Created at column name
$updated_column_name string Updated at column name
Результат boolean

remove_version() публичный Метод

remove a version
public remove_version ( string $version ) : boolean
$version string the version
Результат boolean

rename_column() публичный Метод

Rename a column
public rename_column ( string $table_name, string $column_name, string $new_column_name ) : boolean
$table_name string the table name
$column_name string the column name
$new_column_name string the new column name
Результат boolean

rename_table() публичный Метод

Also renames a table's primary key sequence if the sequence name matches the Ruckusing Migrations default.
public rename_table ( string $name, string $new_name ) : boolean
$name string the current table name
$new_name string the new table name
Результат boolean

rollback_transaction() публичный Метод

Rollback Transaction

schema() публичный Метод

NOTE: this does NOT include any INSERT statements or the actual data
public schema ( string $output_file ) : integer | FALSE
$output_file string the filepath to output to
Результат integer | FALSE

select_all() публичный Метод

Select all
public select_all ( string $query ) : array
$query string query to run
Результат array

select_one() публичный Метод

Select one
public select_one ( string $query ) : array
$query string query to run
Результат array

set_current_version() публичный Метод

Set current version
public set_current_version ( string $version ) : boolean
$version string the version
Результат boolean

start_transaction() публичный Метод

Start Transaction
public start_transaction ( )

supports_migrations() публичный Метод

Check support for migrations
public supports_migrations ( ) : boolean
Результат boolean

table_exists() публичный Метод

Check if a table exists
public table_exists ( string $tbl, boolean $reload_tables = false ) : boolean
$tbl string the table name
$reload_tables boolean reload table or not
Результат boolean

type_to_sql() публичный Метод

Convert type to sql
public type_to_sql ( string $type, array $options = [] ) : string
$type string the native type
$options array
Результат string