DboPostgres Class Reference

Inheritance diagram for DboPostgres:

DboSource DataSource Object

List of all members.


Public Member Functions

 _execute ($sql)
 begin (&$model)
 boolean ($data, $quote=true)
 column ($real)
 commit (&$model)
 connect ()
describe (&$model)
 disconnect ()
 fetchResult ()
 fields (&$model, $alias=null, $fields=array(), $quote=true)
 getEncoding ()
 insertMulti ($table, $fields, $values)
 lastAffected ()
 lastError ()
 lastInsertId ($source, $field= 'id')
 lastNumRows ()
 length ($real)
 limit ($limit, $offset=null)
 listSources ()
 resultSet (&$results)
 rollback (&$model)
 setEncoding ($enc)
 value ($data, $column=null)

Public Attributes

 $_baseConfig
 $_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 122 of file dbo_postgres.php.

Referenced by connect().

DboPostgres::begin ( &$  model  ) 

Begin a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions).

Reimplemented from DataSource.

Definition at line 262 of file dbo_postgres.php.

References DboSource::execute().

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 548 of file dbo_postgres.php.

References $data.

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 436 of file dbo_postgres.php.

References limit(), and DboSource::name().

Referenced by describe().

DboPostgres::commit ( &$  model  ) 

Commit a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).

Reimplemented from DataSource.

Definition at line 280 of file dbo_postgres.php.

References DboSource::execute().

DboPostgres::connect (  ) 

Connects to the database using options in the given configuration array.

Returns:
True if successfully connected.

Definition at line 86 of file dbo_postgres.php.

References DataSource::$config, _execute(), 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 161 of file dbo_postgres.php.

References column(), DboSource::fetchAll(), DboSource::fullTableName(), length(), DboSource::name(), and value().

DboPostgres::disconnect (  ) 

Disconnects from database.

Returns:
boolean True if the database could be disconnected, else false

Definition at line 110 of file dbo_postgres.php.

DboPostgres::fetchResult (  ) 

Fetches the next row from the current result set

Returns:
unknown

Definition at line 526 of file dbo_postgres.php.

References DboSource::$index.

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 375 of file dbo_postgres.php.

References DboSource::$alias, and DboSource::name().

DboPostgres::getEncoding (  ) 

Gets the database encoding

Returns:
string The database encoding

Definition at line 578 of file dbo_postgres.php.

DboPostgres::insertMulti ( table,
fields,
values 
)

Inserts multiple values into a join table

Parameters:
string $table
string $fields
array $values

Reimplemented from DboSource.

Definition at line 588 of file dbo_postgres.php.

References DboSource::query().

DboPostgres::lastAffected (  ) 

Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.

Returns:
int Number of affected rows

Definition at line 321 of file dbo_postgres.php.

DboPostgres::lastError (  ) 

Returns a formatted error message from previous database operation.

Returns:
string Error message

Definition at line 308 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:
int

Definition at line 348 of file dbo_postgres.php.

References $data, DboSource::fetchRow(), and DboSource::rawQuery().

DboPostgres::lastNumRows (  ) 

Returns number of rows in previous resultset. If no previous resultset exists, this returns false.

Returns:
int Number of rows in resultset

Definition at line 334 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 484 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:
int $limit Limit of results returned
int $offset Offset from which to start results
Returns:
string SQL limit/offset statement

Reimplemented from DboSource.

Definition at line 414 of file dbo_postgres.php.

Referenced by column().

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 130 of file dbo_postgres.php.

References DboSource::fetchAll(), and DboSource::name().

DboPostgres::resultSet ( &$  results  ) 

Enter description here...

Parameters:
unknown_type $results

Definition at line 502 of file dbo_postgres.php.

References DboSource::$index.

DboPostgres::rollback ( &$  model  ) 

Rollback a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).

Reimplemented from DataSource.

Definition at line 296 of file dbo_postgres.php.

References DboSource::execute().

DboPostgres::setEncoding ( enc  ) 

Sets the database encoding

Parameters:
mixed $enc Database encoding
Returns:
boolean True on success, false on failure

Definition at line 570 of file dbo_postgres.php.

Referenced by connect().

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 212 of file dbo_postgres.php.

References $data.

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 43 of file dbo_postgres.php.

DboPostgres::$_sequenceMap = array()

Definition at line 80 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 55 of file dbo_postgres.php.

DboPostgres::$description = "PostgreSQL DBO Driver"

Reimplemented from DboSource.

Definition at line 41 of file dbo_postgres.php.

DboPostgres::$endQuote = '"'

Reimplemented from DboSource.

Definition at line 73 of file dbo_postgres.php.

DboPostgres::$startQuote = '"'

Reimplemented from DboSource.

Definition at line 71 of file dbo_postgres.php.


The documentation for this class was generated from the following file: