Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
eZPostgreSQLDB Class Reference
Database abstraction layer

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

Inheritance diagram for eZPostgreSQLDB:

## Public Member Functions
| __construct ( $parameters)
| availableDatabases ()
| databaseName ()
| bindingType ()
| bindVariable ( $value, $fieldDef=false)
| query ( $sql, $server=false)
| arrayQuery ( $sql, $params=array(), $server=false)
| concatString ( $strings=array())
| md5 ( $str)
| supportedRelationTypeMask ()
| supportedRelationTypes ()
| relationCounts ( $relationMask)
| relationCount ( $relationType=eZDBInterface::RELATION_TABLE)
| relationList ( $relationType=eZDBInterface::RELATION_TABLE)
| eZTableList ( $server=eZDBInterface::SERVER_MASTER)
| relationMatchRegexp ( $relationType)
| removeRelation ( $relationName, $relationType)
| lock ( $table)
| unlock ()
| beginQuery ()
| commitQuery ()
| rollbackQuery ()
| lastSerialID ( $table=false, $column='id')
| setError ()
| escapeString ( $str)
| close ()
| createDatabase ( $dbName)
| removeDatabase ( $dbName)
| isCharsetSupported ( $charset)
| databaseServerVersion ()
| correctSequenceValues ()
Public Member Functions inherited from eZDBInterface
| attributes ()
| hasAttribute ( $name)
| attribute ( $name)
| checkCharset ( $charset, &$currentCharset)
| prepareSqlQuery (&$fd, &$buffer)
| insertFile ( $path, $sqlFile, $usePathType=true)
| reportQuery ( $class, $sql, $numRows, $timeTaken, $asDebug=false)
| setIsSQLOutputEnabled ( $enabled)
| startTimer ()
| endTimer ()
| startTime ()
| endTime ()
| timeTaken ()
| socketPath ()
| connectRetryCount ()
| connectRetryWaitTime ()
| useShortNames ()
| bitAnd ( $arg1, $arg2)
| bitOr ( $arg1, $arg2)
| hasRequiredServerVersion ( $minVersion, $name=false)
| databaseClientVersion ()
| charset ()
| usesBuiltinEncoding ()
| begin ()
| commit ()
| rollback ()
| generateFailedTransactionStack ()
| generateFailedTransactionStackEntry ( $stack, $indentCount)
| generateTraceEntry ( $entry)
| invalidateTransaction ()
| reportError ()
| isTransactionValid ()
| transactionCounter ()
| relationName ( $relationType)
| implodeWithTypeCast ( $glue, &$pieces, $type)
| isConnected ()
| createTempTable ( $createTableQuery='', $server=self::SERVER_SLAVE)
| dropTempTable ( $dropTableQuery='', $server=self::SERVER_SLAVE)
| dropTempTableList ( $tableList, $server=self::SERVER_SLAVE)
| errorMessage ()
| errorNumber ()
| generateUniqueTempTableName ( $pattern, $randomizeIndex=false, $server=self::SERVER_SLAVE)
| version ()
| generateSQLINStatement ( $elements, $columnName='', $not=false, $unique=true, $type=false)
| supportsDefaultValuesInsertion ()
| setErrorHandling ( $errorHandling)
| truncateString ( $string, $maxLength, $fieldName, $truncationSuffix='')
| countStringSize ( $string)

## Static Public Member Functions
static | connectString ( $server=null, $port=null, $db=null, $user=null, $password=null)

## Private Member Functions
| subString ( $string, $from, $len=null)
| relationKind ( $relationType)

## Additional Inherited Members
Public Attributes inherited from eZDBInterface
const | BINDING_NO = 0
const | BINDING_NAME = 1
const | BINDING_ORDERED = 2
const | RELATION_TABLE = 0
const | RELATION_SEQUENCE = 1
const | RELATION_TRIGGER = 2
const | RELATION_VIEW = 3
const | RELATION_INDEX = 4
const | RELATION_TABLE_BIT = 1
const | RELATION_SEQUENCE_BIT = 2
const | RELATION_TRIGGER_BIT = 4
const | RELATION_VIEW_BIT = 8
const | RELATION_INDEX_BIT = 16
const | RELATION_NONE = 0
const | RELATION_MASK = 31
const | ERROR_MISSING_EXTENSION = 1
const | SERVER_MASTER = 1
const | SERVER_SLAVE = 2
const | MAX_INT = 2147483647
const | MIN_INT = -2147483648
| $Server
| $Port
| $SocketPath
| $DB
| $DBConnection
| $DBWriteConnection
| $User
| $Password
| $Charset
| $ConnectRetries
| $OutputTextCodec
| $InputTextCodec
| $UseBuiltinEncoding
| $OutputSQL
| $IsConnected = false
| $NumQueries = 0
| $StartTime
| $EndTime
| $TimeTaken
| $ErrorMessage
| $ErrorNumber = 0
| $RecordError = true
| $UsePersistentConnection = false
| $UseSlaveServer
| $SlaveDB
| $SlaveServer
| $SlavePort
| $SlaveUser
| $SlavePassword
| $TransactionCounter
| $TransactionIsValid
| $TransactionStackTree
| $IsInternalCharset
| $SlowSQLTimeout
| $QueryAnalysisOutput
| $AttributeVariableMap
Protected Attributes inherited from eZDBInterface
| $errorHandling = eZDB::ERROR_HANDLING_STANDARD

## Detailed Description

The eZPostgreSQLDB class provides PostgreSQL database functions.

eZPostgreSQLDB implementes PostgreSQLDB specific database code.

See also
  eZDB

Definition at line 20 of file ezpostgresqldb.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZPostgreSQLDB::__construct | ( |  | $parameters | ) |

Creates a new eZPostgreSQLDB object and connects to the database.

Parameters

  array | $parameters |

Exceptions

  eZDBNoConnectionException |

Reimplemented from eZDBInterface.

Definition at line 28 of file ezpostgresqldb.php.

References eZDBInterface\$DB, eZDBInterface\$Password, eZDBInterface\$Port, eZDBInterface\$Server, eZDBInterface\$User, eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), eZDBInterface\connectRetryCount(), eZDBInterface\connectRetryWaitTime(), connectString(), eZDebug\createAccumulatorGroup(), eZDBInterface\ERROR_MISSING_EXTENSION, eZDebug\HANDLE_EXCEPTION, setError(), eZDebug\setHandleType(), eZDebugSetting\writeDebug(), eZDebug\writeError(), and eZDebug\writeWarning().

## Member Function Documentation

## ◆ arrayQuery()

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

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

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

Parameters

  string | $sql | SQL query to execute.
  array | $params | Associative 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.
  int | bool | $server | Which server to execute the query on, either eZDBInterface::SERVER_MASTER or eZDBInterface::SERVER_SLAVE

Returns
  array

Reimplemented from eZDBInterface.

Definition at line 244 of file ezpostgresqldb.php.

References eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), eZDBInterface\isConnected(), and query().

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

## ◆ availableDatabases()

eZPostgreSQLDB::availableDatabases | ( |  | ) |

Returns an array of available databases in the database, null of none available, false if listing databases not supported by database

Returns
  array|null|bool

Reimplemented from eZDBInterface.

Definition at line 156 of file ezpostgresqldb.php.

References query().

## ◆ beginQuery()

eZPostgreSQLDB::beginQuery | ( |  | ) |

The query to start the transaction.

Reimplemented from eZDBInterface.

Definition at line 540 of file ezpostgresqldb.php.

References query().

## ◆ bindingType()

eZPostgreSQLDB::bindingType | ( |  | ) |

Returns type of binding used in database plugin.

Returns
  int

Reimplemented from eZDBInterface.

Definition at line 181 of file ezpostgresqldb.php.

References eZDBInterface\BINDING_NO.

## ◆ bindVariable()

eZPostgreSQLDB::bindVariable | ( |  | $value,
|  |  | $fieldDef = `false`
| ) |  |

Binds variable.

Parameters

  mixed | $value |
  mixed | $fieldDef |

Returns
  mixed

Reimplemented from eZDBInterface.

Definition at line 186 of file ezpostgresqldb.php.

## ◆ close()

eZPostgreSQLDB::close | ( |  | ) |

Will close the database connection.

Returns
  void

Reimplemented from eZDBInterface.

Definition at line 619 of file ezpostgresqldb.php.

## ◆ commitQuery()

eZPostgreSQLDB::commitQuery | ( |  | ) |

The query to commit the transaction.

Reimplemented from eZDBInterface.

Definition at line 548 of file ezpostgresqldb.php.

References query().

## ◆ concatString()

eZPostgreSQLDB::concatString | ( |  | $strings = `array()` | ) |

Returns a sql-expression(string) to concatenate strings.

Parameters

  array | $strings |

Returns
  string

Reimplemented from eZDBInterface.

Definition at line 335 of file ezpostgresqldb.php.

## ◆ connectString()

static eZPostgreSQLDB::connectString | ( |  | $server = `null`,
|  |  | $port = `null`,
|  |  | $db = `null`,
|  |  | $user = `null`,
|  |  | $password = `null`
| ) |  |
| static

Definition at line 139 of file ezpostgresqldb.php.

Referenced by __construct().

## ◆ correctSequenceValues()

eZPostgreSQLDB::correctSequenceValues | ( |  | ) |

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

Definition at line 674 of file ezpostgresqldb.php.

References arrayQuery(), eZDBInterface\isConnected(), and query().

## ◆ createDatabase()

eZPostgreSQLDB::createDatabase | ( |  | $dbName | ) |

Create a new database

Parameters

  string | $dbName |

Returns
  void

Reimplemented from eZDBInterface.

Definition at line 624 of file ezpostgresqldb.php.

References query(), and setError().

## ◆ databaseName()

eZPostgreSQLDB::databaseName | ( |  | ) |

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'.

Returns
  string

Reimplemented from eZDBInterface.

Definition at line 176 of file ezpostgresqldb.php.

## ◆ databaseServerVersion()

eZPostgreSQLDB::databaseServerVersion | ( |  | ) |

Returns the version of the database server or false if no version could be retrieved/

Returns
  string|bool

Reimplemented from eZDBInterface.

Definition at line 647 of file ezpostgresqldb.php.

References eZDBInterface\isConnected(), and eZDebug\writeError().

## ◆ escapeString()

eZPostgreSQLDB::escapeString | ( |  | $str | ) |

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

Parameters

  string | $str |

Returns
  string mixed

Reimplemented from eZDBInterface.

Definition at line 612 of file ezpostgresqldb.php.

## ◆ eZTableList()

eZPostgreSQLDB::eZTableList | ( |  | $server = `eZDBInterface::SERVER_MASTER` | ) |

Returns the existing ez publish tables in database

Parameters

  int | $server |

Returns
  array

Reimplemented from eZDBInterface.

Definition at line 467 of file ezpostgresqldb.php.

References arrayQuery(), eZDBInterface\isConnected(), eZDBInterface\RELATION_SEQUENCE, eZDBInterface\RELATION_TABLE, and relationKind().

## ◆ isCharsetSupported()

eZPostgreSQLDB::isCharsetSupported | ( |  | $charset | ) |

Returns true if the charset $charset is supported by the connected database.

Parameters

  string | $charset |

Returns
  bool

Reimplemented from eZDBInterface.

Definition at line 642 of file ezpostgresqldb.php.

## ◆ lastSerialID()

eZPostgreSQLDB::lastSerialID | ( |  | $table = `false`,
|  |  | $column = `'id'`
| ) |  |

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 | bool | $table |
  string | bool | $column |

Returns
  int|bool The most recent value for the sequence

Reimplemented from eZDBInterface.

Definition at line 571 of file ezpostgresqldb.php.

References eZDBInterface\isConnected(), and eZDebug\writeError().

## ◆ lock()

eZPostgreSQLDB::lock | ( |  | $table | ) |

Locks one or several tables

Parameters

  string | array | $table |

Reimplemented from eZDBInterface.

Definition at line 506 of file ezpostgresqldb.php.

References eZDBInterface\begin(), eZDBInterface\isConnected(), and query().

## ◆ md5()

eZPostgreSQLDB::md5 | ( |  | $str | ) |

Returns a sql-expression(string) to generate a md5 sum of the string.

Parameters

  string | $str |

Returns
  string

Reimplemented from eZDBInterface.

Definition at line 341 of file ezpostgresqldb.php.

## ◆ query()

eZPostgreSQLDB::query | ( |  | $sql,
|  |  | $server = `false`
| ) |  |

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

  string | $sql | SQL query to execute.
  int | bool | $server |

Returns
  mixed

Reimplemented from eZDBInterface.

Definition at line 191 of file ezpostgresqldb.php.

References eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), eZDBInterface\endTimer(), eZDB\ERROR_HANDLING_EXCEPTIONS, eZDebug\HANDLE_EXCEPTION, eZDBInterface\isConnected(), eZDBInterface\reportError(), eZDBInterface\reportQuery(), setError(), eZDebug\setHandleType(), eZDBInterface\startTimer(), eZDBInterface\timeTaken(), and eZDebug\writeError().

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

## ◆ relationCount()

eZPostgreSQLDB::relationCount | ( |  | $relationType = `eZDBInterface::RELATION_TABLE` | ) |

Returns the number of relation objects in the database for the relation type $relationType.

Parameters

  int | $relationType |

Returns
  int

Reimplemented from eZDBInterface.

Definition at line 419 of file ezpostgresqldb.php.

References arrayQuery(), eZDBInterface\isConnected(), relationKind(), and eZDebug\writeError().

## ◆ relationCounts()

eZPostgreSQLDB::relationCounts | ( |  | $relationMask | ) |

Returns the relation count for all relation types in the mask $relationMask.

Parameters

  int | $relationMask |

Returns
  int

Reimplemented from eZDBInterface.

Definition at line 379 of file ezpostgresqldb.php.

References arrayQuery(), eZDBInterface\isConnected(), relationKind(), and supportedRelationTypes().

## ◆ relationKind()

eZPostgreSQLDB::relationKind | ( |  | $relationType | ) |
| private

Definition at line 367 of file ezpostgresqldb.php.

References eZDBInterface\RELATION_INDEX, eZDBInterface\RELATION_SEQUENCE, eZDBInterface\RELATION_TABLE, eZDBInterface\RELATION_TRIGGER, and eZDBInterface\RELATION_VIEW.

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

## ◆ relationList()

eZPostgreSQLDB::relationList | ( |  | $relationType = `eZDBInterface::RELATION_TABLE` | ) |

Returns the relation names in the database as an array for the relation type $relationType.

Parameters

  int | $relationType |

Returns
  array

Reimplemented from eZDBInterface.

Definition at line 443 of file ezpostgresqldb.php.

References arrayQuery(), eZDBInterface\isConnected(), relationKind(), and eZDebug\writeError().

## ◆ relationMatchRegexp()

eZPostgreSQLDB::relationMatchRegexp | ( |  | $relationType | ) |

Return A regexp (PCRE) that can be used to filter out certain relation elements. If no special regexp is provided it will return false.

An example, will only match tables that start with 'ez'. `return "#^ez#";`

This function is currently used by the eZDBTool class to remove relation elements of a specific kind (Most likely eZ Publish related elements).

Parameters

  int | $relationType | The type which needs to be filtered, this allows one regexp per type.

Returns
  bool

Reimplemented from eZDBInterface.

Definition at line 484 of file ezpostgresqldb.php.

## ◆ removeDatabase()

eZPostgreSQLDB::removeDatabase | ( |  | $dbName | ) |

Removes a database

Parameters

  string | $dbName |

Returns
  void

Reimplemented from eZDBInterface.

Definition at line 633 of file ezpostgresqldb.php.

References query(), and setError().

## ◆ removeRelation()

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

Tries to remove the relation type $relationType named $relationName

Parameters

  string | $relationName |
  int | $relationType |

Returns
  bool true if successful

Reimplemented from eZDBInterface.

Definition at line 489 of file ezpostgresqldb.php.

References eZDBInterface\isConnected(), query(), eZDBInterface\relationName(), and eZDebug\writeError().

## ◆ rollbackQuery()

eZPostgreSQLDB::rollbackQuery | ( |  | ) |

The query to cancel the transaction.

Reimplemented from eZDBInterface.

Definition at line 556 of file ezpostgresqldb.php.

## ◆ setError()

eZPostgreSQLDB::setError | ( |  | ) |

Sets the error message and error message number

Returns
  void

Reimplemented from eZDBInterface.

Definition at line 594 of file ezpostgresqldb.php.

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

## ◆ subString()

eZPostgreSQLDB::subString | ( |  | $string,
|  |  | $from,
|  |  | $len = `null`
| ) |  |
| private

Returns a sql-expression(string) to get substring.

Parameters

  string | $string |
  int | $from |
  int | $len |

Returns
  string

Reimplemented from eZDBInterface.

Definition at line 323 of file ezpostgresqldb.php.

## ◆ supportedRelationTypeMask()

eZPostgreSQLDB::supportedRelationTypeMask | ( |  | ) |

Returns a mask of the relation type it supports.

Returns
  int

Reimplemented from eZDBInterface.

Definition at line 346 of file ezpostgresqldb.php.

References eZDBInterface\RELATION_INDEX_BIT, eZDBInterface\RELATION_SEQUENCE_BIT, eZDBInterface\RELATION_TABLE_BIT, eZDBInterface\RELATION_TRIGGER_BIT, and eZDBInterface\RELATION_VIEW_BIT.

## ◆ supportedRelationTypes()

eZPostgreSQLDB::supportedRelationTypes | ( |  | ) |

Returns an array of the relation types.

Returns
  array

Reimplemented from eZDBInterface.

Definition at line 355 of file ezpostgresqldb.php.

References eZDBInterface\RELATION_INDEX, eZDBInterface\RELATION_SEQUENCE, eZDBInterface\RELATION_TABLE, eZDBInterface\RELATION_TRIGGER, and eZDBInterface\RELATION_VIEW.

Referenced by relationCounts().

## ◆ unlock()

eZPostgreSQLDB::unlock | ( |  | ) |

Releases table locks.

Returns
  void

Reimplemented from eZDBInterface.

Definition at line 532 of file ezpostgresqldb.php.

References eZDBInterface\commit().

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

- ezpostgresqldb.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.