eZPublish  4.4
eZPostgreSQLDB Class Reference

The eZPostgreSQLDB class provides PostgreSQL database functions. More...

+ Inheritance diagram for eZPostgreSQLDB:
+ Collaboration diagram for eZPostgreSQLDB:

Public Member Functions

 arrayQuery ($sql, $params=array(), $server=false)
 
 availableDatabases ()
 
 beginQuery ()
 
 bindingType ()
 
 bindVariable ($value, $fieldDef=false)
 
 close ()
 
 commitQuery ()
 
 concatString ($strings=array())
 
 correctSequenceValues ()
 
 createDatabase ($dbName)
 
 databaseName ()
 
 databaseServerVersion ()
 
 escapeString ($str)
 
 eZPostgreSQLDB ($parameters)
 
 eZTableList ($server=eZDBInterface::SERVER_MASTER)
 
 isCharsetSupported ($charset)
 
 lastSerialID ($table=false, $column= 'id')
 Returns the last serial ID generated with an auto increment field. More...
 
 lock ($table)
 
 md5 ($str)
 
 query ($sql, $server=false)
 
 relationCount ($relationType=eZDBInterface::RELATION_TABLE)
 
 relationCounts ($relationMask)
 
 relationList ($relationType=eZDBInterface::RELATION_TABLE)
 
 relationMatchRegexp ($relationType)
 
 removeDatabase ($dbName)
 
 removeRelation ($relationName, $relationType)
 
 rollbackQuery ()
 
 setError ()
 
 supportedRelationTypeMask ()
 
 supportedRelationTypes ()
 
 unlock ()
 
- Public Member Functions inherited from eZDBInterface
 attribute ($name)
 
 attributes ()
 
 availableDatabases ()
 
 begin ()
 
 beginQuery ()
 
 bitAnd ($arg1, $arg2)
 
 bitOr ($arg1, $arg2)
 
 charset ()
 
 checkCharset ($charset, &$currentCharset)
 
 commit ()
 
 commitQuery ()
 
 connectRetryCount ()
 
 connectRetryWaitTime ()
 
 createTempTable ($createTableQuery= '', $server=self::SERVER_SLAVE)
 
 databaseClientVersion ()
 
 databaseServerVersion ()
 
 dropTempTable ($dropTableQuery= '', $server=self::SERVER_SLAVE)
 
 dropTempTableList ($tableList, $server=self::SERVER_SLAVE)
 
 errorMessage ()
 
 errorNumber ()
 
 eZDBInterface ($parameters)
 
 generateFailedTransactionStack ()
 
 generateSQLINStatement ($elements, $columnName= '', $not=false, $unique=true, $type=false)
 This function can be used to create a SQL IN statement to be used in a WHERE clause: More...
 
 generateUniqueTempTableName ($pattern, $randomizeIndex=false, $server=self::SERVER_SLAVE)
 
 hasAttribute ($name)
 
 hasRequiredServerVersion ($minVersion, $name=false)
 
 implodeWithTypeCast ($glue, &$pieces, $type)
 
 insertFile ($path, $sqlFile, $usePathType=true)
 
 invalidateTransaction ()
 
 isCharsetSupported ($charset)
 
 isTransactionValid ()
 
 rollback ()
 
 rollbackQuery ()
 
 setIsSQLOutputEnabled ($enabled)
 
 socketPath ()
 
 supportsDefaultValuesInsertion ()
 
 transactionCounter ()
 
 usesBuiltinEncoding ()
 
 useShortNames ()
 
 version ()
 

Private Member Functions

 relationKind ($relationType)
 
 subString ($string, $from, $len=null)
 

Additional Inherited Members

- Public Attributes inherited from eZDBInterface
 $Charset
 The charset used for the current database. More...
 
 $ConnectRetries
 The number of times to retry a connection if it fails. More...
 
 $DB
 The current database name. More...
 
 $DBConnection
 The current connection, false if not connection has been made. More...
 
 $DBWriteConnection
 Contains the write database connection if used. More...
 
 $EndTime
 The end time of the tiemr. More...
 
 $ErrorMessage
 The database error message of the last executed function. More...
 
 $ErrorNumber = 0
 The database error message number of the last executed function. More...
 
 $InputTextCodec
 
 $IsConnected = false
 Contains true if we're connected to the database backend. More...
 
 $NumQueries = 0
 Contains number of queries sended to DB. More...
 
 $OutputSQL
 Setting if SQL queries should be sent to debug output. More...
 
 $OutputTextCodec
 Instance of a textcodec which handles text conversion, may not be set if no builtin encoding is used. More...
 
 $Password
 Stores the database connection password. More...
 
 $Port
 Contains the current port. More...
 
 $RecordError = true
 If true then ErrorMessage and ErrorNumber get filled. More...
 
 $Server
 Contains the current server. More...
 
 $SlaveDB
 The slave database name. More...
 
 $SlavePassword
 The slave database user password. More...
 
 $SlavePort
 The slave server port. More...
 
 $SlaveServer
 The slave server name. More...
 
 $SlaveUser
 The slave database user. More...
 
 $SocketPath
 The socket path, used by MySQL. More...
 
 $StartTime
 The start time of the timer. More...
 
 $TimeTaken
 The total number of milliseconds the timer took. More...
 
 $TransactionCounter
 The transaction counter, 0 means no transaction. More...
 
 $TransactionIsValid
 Flag which tells if a transaction is considered valid or not A transaction will be made invalid if SQL errors occur. More...
 
 $UseBuiltinEncoding
 True if a builtin encoder is to be used, this means that all input/output text is converted. More...
 
 $UsePersistentConnection = false
 If true then the database connection should be persistent. More...
 
 $User
 Stores the database connection user. More...
 
 $UserSlaveServer
 Contains true if slave servers are enabled. More...
 
const BINDING_NAME = 1
 
const BINDING_NO = 0
 
const BINDING_ORDERED = 2
 
const ERROR_MISSING_EXTENSION = 1
 
const RELATION_INDEX = 4
 
const RELATION_INDEX_BIT = 16
 
const RELATION_MASK = 31
 
const RELATION_NONE = 0
 
const RELATION_SEQUENCE = 1
 
const RELATION_SEQUENCE_BIT = 2
 
const RELATION_TABLE = 0
 
const RELATION_TABLE_BIT = 1
 
const RELATION_TRIGGER = 2
 
const RELATION_TRIGGER_BIT = 4
 
const RELATION_VIEW = 3
 
const RELATION_VIEW_BIT = 8
 
const SERVER_MASTER = 1
 
const SERVER_SLAVE = 2
 
- Protected Member Functions inherited from eZDBInterface
 isConnected ()
 
 relationName ($relationType)
 
 reportError ()
 

Detailed Description

The eZPostgreSQLDB class provides PostgreSQL database functions.

eZPostgreSQLDB implementes PostgreSQLDB specific database code.

See Also
eZDB

Member Function Documentation

eZPostgreSQLDB::arrayQuery (   $sql,
  $params = array(),
  $server = false 
)
virtual

Executes an SQL query and returns the result as an array of accociative arrays.

Parameters
$sqlSQL query to execute.
$paramsAssociative array containing extra parameters, can contain:
  • offset - The offset of the query.
  • limit - The limit of the query.
  • column - Limit returned row arrays to only contain this column.
$serverWhich server to execute the query on, either eZDBInterface::SERVER_MASTER or eZDBInterface::SERVER_SLAVE

An example would be:

$db->arrayQuery( 'SELECT * FROM eztable', array( 'limit' => 10, 'offset' => 5 ) );

Implements eZDBInterface.

Referenced by correctSequenceValues(), eZTableList(), relationCount(), relationCounts(), and relationList().

eZPostgreSQLDB::availableDatabases ( )
eZPostgreSQLDB::beginQuery ( )

The query to start the transaction.

eZPostgreSQLDB::bindingType ( )
virtual

Returns type of binding used in database plugin.

Implements eZDBInterface.

eZPostgreSQLDB::bindVariable (   $value,
  $fieldDef = false 
)
virtual

Binds variable.

Implements eZDBInterface.

eZPostgreSQLDB::close ( )
virtual

Will close the database connection.

Implements eZDBInterface.

eZPostgreSQLDB::commitQuery ( )

The query to commit the transaction.

eZPostgreSQLDB::concatString (   $strings = array())
virtual
Returns
a sql-expression(string) to concatenate strings.

Implements eZDBInterface.

eZPostgreSQLDB::correctSequenceValues ( )

Sets PostgreSQL sequence values to the maximum values used in the corresponding columns.

eZPostgreSQLDB::createDatabase (   $dbName)
virtual

Create a new database

Implements eZDBInterface.

eZPostgreSQLDB::databaseName ( )
virtual

Returns the name of driver, this is used to determine the name of the database type. For instance multiple implementations of the MySQL database will all return 'mysql'.

Implements eZDBInterface.

eZPostgreSQLDB::databaseServerVersion ( )
eZPostgreSQLDB::escapeString (   $str)
virtual

Will escape a string so it's ready to be inserted in the database.

Implements eZDBInterface.

eZPostgreSQLDB::eZPostgreSQLDB (   $parameters)

Creates a new eZPostgreSQLDB object and connects to the database.

eZPostgreSQLDB::eZTableList (   $server = eZDBInterface::SERVER_MASTER)
virtual
Returns
existing ez publish tables in database

Implements eZDBInterface.

eZPostgreSQLDB::isCharsetSupported (   $charset)
eZPostgreSQLDB::lastSerialID (   $table = false,
  $column = 'id' 
)
virtual

Returns the last serial ID generated with an auto increment field.

In this case that means the current value of the sequence assigned $table

Parameters
string$table
string$column
Returns
int The most recent value for the sequence

Implements eZDBInterface.

eZPostgreSQLDB::lock (   $table)
virtual

Locks a table

Implements eZDBInterface.

eZPostgreSQLDB::md5 (   $str)
virtual
Returns
a sql-expression(string) to generate a md5 sum of the string.

Implements eZDBInterface.

eZPostgreSQLDB::query (   $sql,
  $server = false 
)
virtual

Execute a query on the global MySQL database link. If it returns an error, the script is halted and the attempted SQL query and MySQL error message are printed.

Parameters
$sqlSQL query to execute.

Implements eZDBInterface.

Referenced by arrayQuery(), availableDatabases(), beginQuery(), commitQuery(), correctSequenceValues(), createDatabase(), lock(), removeDatabase(), removeRelation(), and rollbackQuery().

eZPostgreSQLDB::relationCount (   $relationType = eZDBInterface::RELATION_TABLE)
virtual
Returns
the number of relation objects in the database for the relation type $relationType.

Implements eZDBInterface.

eZPostgreSQLDB::relationCounts (   $relationMask)
virtual
Returns
the relation count for all relation types in the mask $relationMask.

Implements eZDBInterface.

eZPostgreSQLDB::relationKind (   $relationType)
private
eZPostgreSQLDB::relationList (   $relationType = eZDBInterface::RELATION_TABLE)
virtual
Returns
the relation names in the database as an array for the relation type $relationType.

Implements eZDBInterface.

eZPostgreSQLDB::relationMatchRegexp (   $relationType)
virtual
Returns
A regexp (PCRE) that can be used to filter out certain relation elements. If no special regexp is provided it will return false.
Parameters
$relationTypeThe type which needs to be filtered, this allows one regexp per type.

An example, will only match tables that start with 'ez'.

return "#^ez#";
Note
This function is currently used by the eZDBTool class to remove relation elements of a specific kind (Most likely eZ Publish related elements).

Implements eZDBInterface.

eZPostgreSQLDB::removeDatabase (   $dbName)
virtual

Removes a database

Implements eZDBInterface.

eZPostgreSQLDB::removeRelation (   $relationName,
  $relationType 
)
virtual

Tries to remove the relation type $relationType named $relationName

Returns
true if successful

Implements eZDBInterface.

eZPostgreSQLDB::rollbackQuery ( )

The query to cancel the transaction.

eZPostgreSQLDB::setError ( )
virtual

Sets the error message and error message number

Implements eZDBInterface.

Referenced by createDatabase(), query(), and removeDatabase().

eZPostgreSQLDB::subString (   $string,
  $from,
  $len = null 
)
privatevirtual
Returns
a sql-expression(string) to get substring.

Implements eZDBInterface.

eZPostgreSQLDB::supportedRelationTypeMask ( )
virtual
Returns
a mask of the relation type it supports.

Implements eZDBInterface.

eZPostgreSQLDB::supportedRelationTypes ( )
virtual
Returns
an array of the relation types.

Implements eZDBInterface.

Referenced by relationCounts().

eZPostgreSQLDB::unlock ( )
virtual

Releases table locks.

Implements eZDBInterface.


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