DboPostgres Class Reference

Public Member Functions | |
| _execute ($sql) | |
| boolean ($data, $quote=true) | |
| buildColumn ($column) | |
| buildIndex ($indexes, $table=null) | |
| column ($real) | |
| connect () | |
| & | describe (&$model) |
| disconnect () | |
| fetchResult () | |
| fields (&$model, $alias=null, $fields=array(), $quote=true) | |
| getEncoding () | |
| getSequence ($table, $field= 'id') | |
| lastAffected () | |
| lastError () | |
| lastInsertId ($source, $field= 'id') | |
| lastNumRows () | |
| length ($real) | |
| limit ($limit, $offset=null) | |
| listSources () | |
| name ($data) | |
| renderStatement ($type, $data) | |
| resultSet (&$results) | |
| setEncoding ($enc) | |
| truncate ($table, $reset=0) | |
| value ($data, $column=null) | |
Public Attributes | |
| $_baseConfig | |
| $_commands | |
| $_sequenceMap = array() | |
| $columns | |
| $description = "PostgreSQL DBO Driver" | |
| $endQuote = '"' | |
| $startQuote = '"' | |
Detailed Description
Definition at line 39 of file dbo_postgres.php.
Member Function Documentation
| DboPostgres::_execute | ( | $ | sql | ) |
Executes given SQL statement.
- Parameters:
-
string $sql SQL statement
- Returns:
- resource Result resource identifier
Definition at line 151 of file dbo_postgres.php.
Referenced by connect().
| DboPostgres::boolean | ( | $ | data, | |
| $ | quote = true | |||
| ) |
Translates between PHP boolean values and PostgreSQL boolean values
- Parameters:
-
mixed $data Value to be translated boolean $quote True to quote value, false otherwise
- Returns:
- mixed Converted boolean value
Definition at line 574 of file dbo_postgres.php.
| DboPostgres::buildColumn | ( | $ | column | ) |
Generate a Postgres-native column schema string
- Parameters:
-
array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), where options can be 'default', 'length', or 'key'.
- Returns:
- string
Reimplemented from DboSource.
Definition at line 609 of file dbo_postgres.php.
References $out.
| DboPostgres::buildIndex | ( | $ | indexes, | |
| $ | table = null | |||
| ) |
Format indexes for create table
- Parameters:
-
array $indexes string $table
- Returns:
- string
Reimplemented from DboSource.
Definition at line 631 of file dbo_postgres.php.
References $out.
| DboPostgres::column | ( | $ | real | ) |
Converts database-layer column types to basic types
- Parameters:
-
string $real Real database-layer column type (i.e. "varchar(255)")
- Returns:
- string Abstract column type (i.e. "string")
Reimplemented from DataSource.
Definition at line 457 of file dbo_postgres.php.
Referenced by describe().
| DboPostgres::connect | ( | ) |
Connects to the database using options in the given configuration array.
- Returns:
- True if successfully connected.
Definition at line 108 of file dbo_postgres.php.
References DataSource::$config, _execute(), config(), and setEncoding().
| & DboPostgres::describe | ( | &$ | model | ) |
Returns an array of the fields in given table name.
- Parameters:
-
string $tableName Name of database table to inspect
- Returns:
- array Fields in table. Keys are name and type
Definition at line 190 of file dbo_postgres.php.
References column(), DboSource::fetchAll(), DboSource::fullTableName(), length(), name(), and value().
| DboPostgres::disconnect | ( | ) |
Disconnects from database.
- Returns:
- boolean True if the database could be disconnected, else false
Definition at line 134 of file dbo_postgres.php.
References DboSource::hasResult().
| DboPostgres::fetchResult | ( | ) |
Fetches the next row from the current result set
- Returns:
- unknown
Definition at line 552 of file dbo_postgres.php.
| DboPostgres::fields | ( | &$ | model, | |
| $ | alias = null, |
|||
| $ | fields = array(), |
|||
| $ | quote = true | |||
| ) |
Generates the fields list of an SQL query.
- Parameters:
-
Model $model string $alias Alias tablename mixed $fields
- Returns:
- array
Reimplemented from DboSource.
Definition at line 397 of file dbo_postgres.php.
| DboPostgres::getEncoding | ( | ) |
Gets the database encoding
- Returns:
- string The database encoding
Definition at line 599 of file dbo_postgres.php.
| DboPostgres::getSequence | ( | $ | table, | |
| $ | field = 'id' | |||
| ) |
Gets the associated sequence for the given table/field
- Parameters:
-
mixed $table Either a full table name (with prefix) as a string, or a model object string $field Name of the ID database field. Defaults to "id"
- Returns:
- string The associated sequence name from the sequence map, defaults to "{$table}_{$field}_seq"
Definition at line 345 of file dbo_postgres.php.
| DboPostgres::lastAffected | ( | ) |
Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
- Returns:
- integer Number of affected rows
Definition at line 306 of file dbo_postgres.php.
| DboPostgres::lastError | ( | ) |
Returns a formatted error message from previous database operation.
- Returns:
- string Error message
Definition at line 293 of file dbo_postgres.php.
| DboPostgres::lastInsertId | ( | $ | source, | |
| $ | field = 'id' | |||
| ) |
Returns the ID generated from the previous INSERT operation.
- Parameters:
-
string $source Name of the database table string $field Name of the ID database field. Defaults to "id"
- Returns:
- integer
Definition at line 333 of file dbo_postgres.php.
| DboPostgres::lastNumRows | ( | ) |
Returns number of rows in previous resultset. If no previous resultset exists, this returns false.
- Returns:
- integer Number of rows in resultset
Definition at line 319 of file dbo_postgres.php.
| DboPostgres::length | ( | $ | real | ) |
Gets the length of a database-native column description, or null if no length
- Parameters:
-
string $real Real database-layer column type (i.e. "varchar(255)")
- Returns:
- int An integer representing the length of the column
Reimplemented from DboSource.
Definition at line 510 of file dbo_postgres.php.
Referenced by describe().
| DboPostgres::limit | ( | $ | limit, | |
| $ | offset = null | |||
| ) |
Returns a limit statement in the correct format for the particular database.
- Parameters:
-
integer $limit Limit of results returned integer $offset Offset from which to start results
- Returns:
- string SQL limit/offset statement
Reimplemented from DboSource.
Definition at line 435 of file dbo_postgres.php.
| DboPostgres::listSources | ( | ) |
Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
- Returns:
- array Array of tablenames in the database
Definition at line 159 of file dbo_postgres.php.
References config(), DboSource::fetchAll(), and name().
| DboPostgres::name | ( | $ | data | ) |
Prepares field names to be quoted by parent
- Parameters:
-
string $data
- Returns:
- string SQL field
Reimplemented from DboSource.
Definition at line 386 of file dbo_postgres.php.
Referenced by describe(), and listSources().
| DboPostgres::renderStatement | ( | $ | type, | |
| $ | data | |||
| ) |
Overrides DboSource::renderStatement to handle schema generation with Postgres-style indexes
- Parameters:
-
string $type array $data
- Returns:
- string
Reimplemented from DboSource.
Definition at line 660 of file dbo_postgres.php.
| DboPostgres::resultSet | ( | &$ | results | ) |
Enter description here...
- Parameters:
-
unknown_type $results
Definition at line 528 of file dbo_postgres.php.
| DboPostgres::setEncoding | ( | $ | enc | ) |
Sets the database encoding
- Parameters:
-
mixed $enc Database encoding
- Returns:
- boolean True on success, false on failure
Definition at line 591 of file dbo_postgres.php.
Referenced by connect().
| DboPostgres::truncate | ( | $ | table, | |
| $ | reset = 0 | |||
| ) |
Deletes all the records in a table and drops all associated auto-increment sequences
- Parameters:
-
mixed $table A string or model class representing the table to be truncated integer $reset If -1, sequences are dropped, if 0 (default), sequences are reset, and if 1, sequences are not modified
- Returns:
- boolean SQL TRUNCATE TABLE statement, false if not applicable. public
Definition at line 364 of file dbo_postgres.php.
| DboPostgres::value | ( | $ | data, | |
| $ | column = null | |||
| ) |
Returns a quoted and escaped string of $data for use in an SQL statement.
- Parameters:
-
string $data String to be prepared for use in an SQL statement string $column The column into which this data will be inserted
- Returns:
- string Quoted and escaped
- Todo:
- Add logic that formats/escapes data based on column type
Reimplemented from DboSource.
Definition at line 250 of file dbo_postgres.php.
Referenced by describe().
Member Data Documentation
| DboPostgres::$_baseConfig |
Initial value:
array(
'connect' => 'pg_pconnect',
'persistent' => true,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'cake',
'schema' => 'public',
'port' => 5432,
'encoding' => ''
)
Reimplemented from DataSource.
Definition at line 65 of file dbo_postgres.php.
| DboPostgres::$_commands |
| DboPostgres::$_sequenceMap = array() |
Definition at line 102 of file dbo_postgres.php.
| DboPostgres::$columns |
Initial value:
array(
'primary_key' => array('name' => 'serial NOT NULL'),
'string' => array('name' => 'varchar', 'limit' => '255'),
'text' => array('name' => 'text'),
'integer' => array('name' => 'integer', 'formatter' => 'intval'),
'float' => array('name' => 'float', 'formatter' => 'floatval'),
'datetime' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'),
'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
'binary' => array('name' => 'bytea'),
'boolean' => array('name' => 'boolean'),
'number' => array('name' => 'numeric'),
'inet' => array('name' => 'inet')
)
Definition at line 77 of file dbo_postgres.php.
| DboPostgres::$description = "PostgreSQL DBO Driver" |
| DboPostgres::$endQuote = '"' |
| DboPostgres::$startQuote = '"' |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/datasources/dbo/dbo_postgres.php