PHP Class Postgres, phppgadmin

Inheritance: extends ADODB_base
Mostra file Open project: phppgadmin/phppgadmin Class Usage Examples

Public Properties

Property Type Description
$_maxNameLen Max object name length
$_schema Store the current schema
$codemap encoding name is the same as its database encoding name.
$defaultprops
$extraTypes Extra "magic" types. BIGSERIAL was added in PostgreSQL 7.2.
$fkactions Foreign key stuff. First element MUST be the default.
$fkdeferrable
$fkinitial
$fkmatches
$funcprops Function properties
$help_base Default help URL
$help_page Help sub pages
$id Name of id column
$joinOps Supported join operations for use with view wizard
$langmap Map of internal language name to syntax highlighting name
$major_version
$predefined_size_types Predefined size types
$privlist of objects.
$privmap refer to.
$rule_events Rule action types
$selectOps Select operators
$triggerEvents Array of allowed trigger events
$triggerExecTimes When to execute the trigger
$triggerFrequency How often to execute the trigger
$typAlignDef The default type alignment
$typAligns Array of allowed type alignments
$typIndexDef Default index type
$typIndexes Array of allowed index types
$typStorageDef The default type storage
$typStorages Array of allowed type storage attributes

Public Methods

Method Description
Postgres ( $conn ) Constructor
_encryptPassword ( $username, $password ) Helper function that computes encypted PostgreSQL passwords
_parseACL ( $acl ) : Privileges Internal function used for parsing ACLs
addCheckConstraint ( $table, $definition, $name = '' ) Adds a check constraint to a table
addColumn ( $table, $column, $type, $array, $length, $notnull, $default, $comment ) Add a new column to a table
addDomainCheckConstraint ( $domain, $definition, $name = '' ) Adds a check constraint to a domain
addForeignKey ( $table, $targschema, $targtable, $sfields, $tfields, $upd_action, $del_action, $match, $deferrable, $initially, $name = '' ) : -1 Adds a foreign key constraint to a table
addGroupMember ( $groname, $user ) Adds a group member
addPrimaryKey ( $table, $fields, $name = '', $tablespace = '' ) : -1 Adds a primary key constraint to a table
addUniqueKey ( $table, $fields, $name = '', $tablespace = '' ) : -1 Adds a unique constraint to a table
alreadyClustered ( $table ) : true test if a table has been clustered on an index
alterAggregate ( $aggrname, $aggrtype, $aggrowner, $aggrschema, $aggrcomment, $newaggrname, $newaggrowner, $newaggrschema, $newaggrcomment ) : -4 Alters an aggregate
alterColumn ( $table, $column, $name, $notnull, $oldnotnull, $default, $olddefault, $type, $length, $array, $oldtype, $comment ) : -6 Alters a column in a table
alterDatabase ( $dbName, $newName, $newOwner = '', $comment = '' ) : -4 Alters a database the multiple return vals are for postgres 8+ which support more functionality in alter database
alterDatabaseOwner ( string $dbName, string $newOwner ) : integer Changes ownership of a database This can only be done by a superuser or the owner of the database
alterDatabaseRename ( string $oldName, string $newName ) : integer Renames a database, note that this operation cannot be performed on a database that is currently being connected to
alterDomain ( $domain, $domdefault, $domnotnull, $domowner ) : -4 Alters a domain
alterSequence ( $sequence, $name, $comment, $owner = null, $schema = null, $increment = null, $minvalue = null, $maxvalue = null, $restartvalue = null, $cachevalue = null, $cycledvalue = null, $startvalue = null ) : -2 Alters a sequence
alterSequenceName ( $seqrs, $name ) Rename a sequence
alterSequenceOwner ( $seqrs, $owner ) Alter a sequence's owner
alterSequenceProps ( $seqrs, $increment, $minvalue, $maxvalue, $restartvalue, $cachevalue, $cycledvalue, $startvalue ) Alter a sequence's properties
alterSequenceSchema ( $seqrs, $schema ) Alter a sequence's schema
alterTable ( $table, $name, $owner, $schema, $comment, $tablespace ) : -2 Alter table properties
alterTableName ( $tblrs, $name = null ) Alter a table's name !\ this function is called from _alterTable which take care of escaping fields
alterTableOwner ( $tblrs, $owner = null ) Alter a table's owner !\ this function is called from _alterTable which take care of escaping fields
alterTableSchema ( $tblrs, $schema = null ) Alter a table's schema !\ this function is called from _alterTable which take care of escaping fields
alterTableTablespace ( $tblrs, $tablespace = null ) Alter a table's tablespace !\ this function is called from _alterTable which take care of escaping fields
alterTablespace ( $spcname, $name, $owner, $comment = '' ) : -4 Alters a tablespace
alterTrigger ( $table, $trigger, $name ) Alters a trigger
alterView ( $view, $name, $owner, $schema, $comment ) : -2 Alter view properties
alterViewName ( $vwrs, $name ) Rename a view
alterViewOwner ( $vwrs, $owner = null ) Alter a view's owner
alterViewSchema ( $vwrs, $schema ) Alter a view's schema
analyzeDB ( $table = '' ) Analyze a database
arrayClean ( &$arr ) : The Cleans (escapes) an array
beginDump ( ) Sets up the data object for a dump. eg. Starts the appropriate transaction, sets variables, etc.
browseQuery ( $type, $table, $query, $sortkey, $sortdir, $page, $page_size, &$max_pages ) : -5 Returns a recordset of all columns in a query. Supports paging.
browseQueryCount ( $query, $count ) : -1 Finds the number of rows that would be returned by a query.
browseRow ( $table, $key ) : A Returns a recordset of all columns in a table
changeAggregateOwner ( $aggrname, $aggrtype, $newaggrowner ) Changes the owner of an aggregate function
changeAggregateSchema ( $aggrname, $aggrtype, $newaggrschema ) Changes the schema of an aggregate function
changeFtsMapping ( $ftscfg, array $mapping, string $action, string $dictname = null ) Creates/updates/deletes FTS mapping.
changePassword ( $rolename, $password ) Changes a role's password
clean ( &$str ) : The Cleans (escapes) a string
clusterIndex ( $table = '', $index = '' ) Clusters an index
createAggregate ( $name, $basetype, $sfunc, $stype, $ffunc, $initcond, $sortop, $comment ) : -1 Creates a new aggregate in the database
createCompositeType ( $name, $fields, $field, $type, $array, $length, $colcomment, $typcomment ) : -1 Creates a new composite type in the database
createDatabase ( $database, $encoding, $tablespace = '', $comment = '', $template = 'template1', $lc_collate = '', $lc_ctype = '' ) : -2 Creates a database
createDomain ( $domain, $type, $length, $array, $notnull, $default, $check ) Creates a domain
createEnumType ( $name, $values, $typcomment ) : -2 Creates a new enum type in the database
createFtsConfiguration ( string $cfgname, string $parser = '', string $template = '', string $comment = '' ) Creates a new FTS configuration.
createFtsDictionary ( string $dictname, boolean $isTemplate = false, string $template = '', string $lexize = '', string $init = '', string $option = '', string $comment = '' ) Creates a new FTS dictionary or FTS dictionary template.
createFunction ( $funcname, $args, $returns, $definition, $language, $flags, $setof, $cost, $rows, $comment, $replace = false ) : -4 Creates a new function.
createGroup ( $groname, $users ) Creates a new group
createIndex ( $name, $table, $columns, $type, $unique, $where, $tablespace, $concurrently ) Creates an index
createRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers ) Creates a new role
createRule ( $name, $event, $table, $where, $instead, $type, $action, $replace = false ) : -1 Creates a rule
createSchema ( $schemaname, $authorization = '', $comment = '' ) Creates a new schema.
createSequence ( $sequence, $increment, $minvalue, $maxvalue, $startvalue, $cachevalue, $cycledvalue ) Creates a new sequence
createTable ( $name, $fields, $field, $type, $array, $length, $notnull, $default, $withoutoids, $colcomment, $tblcomment, $tablespace, $uniquekey, $primarykey ) : -1 Creates a new table in the database
createTableLike ( $name, $like, $defaults = false, $constraints = false, $idx = false, $tablespace = '' ) Creates a new table in the database copying attribs and other properties from another table
createTablespace ( $spcname, $spcowner, $spcloc, $comment = '' ) Creates a tablespace
createTrigger ( $tgname, $table, $tgproc, $tgtime, $tgevent, $tgfrequency, $tgargs ) Creates a trigger
createType ( $typname, $typin, $typout, $typlen, $typdef, $typelem, $typdelim, $typbyval, $typalign, $typstorage ) Creates a new type
createUser ( $username, $password, $createdb, $createuser, $expiry, $groups ) Creates a new user
createView ( $viewname, $definition, $replace, $comment ) Creates a new view.
dbBool ( &$parameter ) Change the value of a parameter to 't' or 'f' depending on whether it evaluates to true or false
deleteRow ( $table, $key, $schema = false ) Delete a row from a table
disableTrigger ( $tgname, $table ) Disables a trigger
dropAggregate ( $aggrname, $aggrtype, $cascade ) Removes an aggregate function from the database
dropAutovacuum ( $table )
dropCheckConstraint ( $table, $name ) : -4 Drops a check constraint from a table
dropColumn ( $table, $column, $cascade ) Drops a column from a table
dropColumnDefault ( $table, $column ) Drops default value of a column
dropConstraint ( $constraint, $relation, $type, $cascade ) Removes a constraint from a relation
dropDatabase ( $database ) Drops a database
dropDomain ( $domain, $cascade ) Drops a domain.
dropDomainConstraint ( $domain, $constraint, $cascade ) Drops a domain constraint
dropFtsConfiguration ( $ftscfg, $cascade ) Drops FTS coniguration
dropFtsDictionary ( $ftsdict, $cascade ) Drops FTS dictionary
dropFunction ( $function_oid, $cascade ) Drops a function.
dropGroup ( $groname ) Removes a group
dropGroupMember ( $groname, $user ) Removes a group member
dropIndex ( $index, $cascade ) Removes an index from the database
dropOperator ( $operator_oid, $cascade ) Drops an operator
dropRole ( $rolename ) Removes a role
dropRule ( $rule, $relation, $cascade ) Removes a rule from a table OR view
dropSchema ( $schemaname, $cascade ) Drops a schema.
dropSequence ( $sequence, $cascade ) Drops a given sequence
dropTable ( $table, $cascade ) Removes a table from the database
dropTablespace ( $spcname ) Drops a tablespace
dropTrigger ( $tgname, $table, $cascade ) Drops a trigger
dropType ( $typname, $cascade ) Drops a type.
dropUser ( $username ) Removes a user
dropView ( $viewname, $cascade ) Drops a view.
dumpRelation ( $relation, $oids ) : -1 Returns a recordset of all columns in a relation. Used for data export.
editRow ( $table, $vars, $nulls, $format, $types, $keyarr ) : -1 Updates a row in a table
emptyTable ( $table ) Empties a table in the database
enableTrigger ( $tgname, $table ) Enables a trigger
endDump ( ) Ends the data object for a dump.
escapeBytea ( $data ) : Data Escapes bytea data for display on the screen
executeScript ( $name, $callback = null ) : True Executes an SQL script as a series of SQL statements. Returns the result of the final step. This is a very complicated lexer based on the REL7_4_STABLE src/bin/psql/mainloop.c lexer in the PostgreSQL source code.
fieldArrayClean ( &$arr ) : The Cleans (escapes) an array of field names
fieldClean ( &$str ) : The Cleans (escapes) an object name (eg. table, field)
findObject ( $term, $filter ) : A Searches all system catalogs to find objects that match a certain name.
formatType ( $typname, $typmod ) Formats a type correctly for display. Postgres 7.0 had no 'format_type' built-in function, and hence we need to do it manually.
formatValue ( $type, $format, $value ) : The Formats a value or expression for sql purposes
getAggregate ( $name, $basetype ) : A Gets all information for an aggregate
getAggregates ( ) : A Gets all aggregates
getAttributeNames ( $table, $atts ) : -2 Given an array of attnums and a relation, returns an array mapping attribute number to attribute name.
getAutovacuum ( ) : associative Returns all autovacuum global configuration
getCasts ( ) : All Returns a list of all casts in the database
getChangeUserSQL ( $user ) : The Returns the SQL for changing the current user
getConstraints ( $table ) : A Returns a list of all constraints on a table
getConstraintsWithFields ( $table ) : a Returns a list of all constraints on a table, including constraint name, definition, related col and referenced namespace, table and col if needed
getConversions ( ) : All Returns a list of all conversions in the database
getDatabase ( $database ) : The Return all information about a particular database
getDatabaseComment ( string $database ) : recordset Return the database comment of a db from the shared description table
getDatabaseEncoding ( ) : The Returns the current database encoding
getDatabaseOwner ( string $database ) : recordset Return the database owner of a db
getDatabases ( $currentdatabase = NULL ) : A Return all database available on the server
getDefaultWithOid ( ) : default_with_oids Returns the current default_with_oids setting
getDomain ( $domain ) : A Gets all information for a single domain
getDomainConstraints ( $domain ) : A Get domain constraints
getDomains ( ) : All Return all domains in current schema. Excludes domain constraints.
getEnumValues ( $name ) : A Get defined values for a given enum
getFtsConfigurationByName ( $ftscfg ) : FTS Return all information related to a FTS configuration
getFtsConfigurationMap ( string $ftscfg ) : RecordSet Returns the map of FTS configuration given (list of mappings (tokens) and their processing dictionaries)
getFtsConfigurations ( $all = true ) : A Returns available FTS configurations
getFtsDictionaries ( $all = true ) Returns FTS dictionaries available
getFtsDictionaryByName ( $ftsdict ) : RecordSet Return all information relating to a FTS dictionary
getFtsDictionaryTemplates ( ) Returns all FTS dictionary templates available
getFtsMappingByName ( $ftscfg, $mapping ) : FTS Return all information related to a given FTS configuration's mapping
getFtsMappings ( $ftscfg ) Return list of FTS mappings possible for given parser (specified by given configuration since configuration can only have 1 parser)
getFtsParsers ( $all = true ) : RecordSet Returns FTS parsers available
getFunction ( $function_oid ) : Function Returns all details for a particular function
getFunctionProperties ( $f ) : An Returns an array containing a function's properties
getFunctions ( $all = false, $type = null ) : All Returns a list of all functions in the database
getGroup ( $groname ) : All Return users in a specific group
getGroups ( ) : All Returns all groups in the database cluser
getHelp ( $help ) Fetch a URL (or array of URLs) for a given help page.
getHelpPages ( )
getIndexes ( $table = '', $unique = false ) : A Grabs a list of indexes for a table
getLanguages ( $all = false ) : A Gets all languages
getLinkingKeys ( $tables ) : -1 A function for getting all columns linked by foreign keys given a group of tables
getLocks ( ) : A Returns table locks information in the current database
getMemberOf ( $rolename ) : All Returns all role names which the role belongs to
getMembers ( $rolename, $admin = 'f' ) : All Returns all role names that are members of a role
getOpClasses ( ) : A Gets all opclasses
getOperator ( $operator_oid ) : Function Returns all details for a particular operator
getOperators ( ) : All Returns a list of all operators in the database
getPreparedXacts ( $database = null ) : A Returns prepared transactions information
getPrivileges ( $object, $type, $table = null ) : -3 Grabs an array of users and their privileges for an object, given its type.
getProcesses ( $database = null ) : A Returns all available process information.
getReferrers ( $table ) : A Finds the foreign keys that refer to the specified table
getRole ( $rolename ) : The Returns information about a single role
getRoles ( $rolename = '' ) : All Returns all roles in the database cluster
getRowIdentifier ( $table ) : -1 Get the fields for uniquely identifying a row in a table
getRules ( $table ) : A Returns a list of all rules on a table OR view
getSchemaByName ( $schema ) : Schema Return all information relating to a schema
getSchemas ( ) : All Return all schemas in the current database.
getSearchPath ( ) : Array Return the current schema search path
getSelectSQL ( $table, $show, $values, $ops, $orderby = [] ) : The Generates the SQL for the 'select' function
getSequence ( $sequence ) : A Returns properties of a single sequence
getSequences ( $all = false ) : A Returns all sequences in the current database
getStatsDatabase ( $database ) : A Fetches statistics for a database
getStatsIndexIO ( $table ) : A Fetches I/0 statistics for all indexes on a table
getStatsIndexTuples ( $table ) : A Fetches tuple statistics for all indexes on a table
getStatsTableIO ( $table ) : A Fetches I/0 statistics for a table
getStatsTableTuples ( $table ) : A Fetches tuple statistics for a table
getTable ( $table ) : A Returns table information
getTableAttributes ( $table, $field = '' ) : All Retrieve the attribute definition of a table
getTableAutovacuum ( $table = '' ) : A Returns all available autovacuum per table information.
getTableChildren ( $table ) : A Finds the names and schemas of child tables
getTableDefPrefix ( $table, $clean = false ) : null Returns the SQL definition for the table.
getTableDefSuffix ( $table ) : null Returns extra table definition information that is most usefully dumped after the table contents for speed and efficiency reasons
getTableParents ( $table ) : A Finds the names and schemas of parent tables (in order)
getTables ( $all = false ) : All Return all tables in current database (and schema)
getTablespace ( $spcname ) : A Retrieves a tablespace's information
getTablespaces ( $all = false ) : A Retrieves information for all tablespaces
getTrigger ( $table, $trigger ) : A Grabs a single trigger
getTriggerDef ( $trigger ) : The A helper function for getTriggers that translates an array of attribute numbers to an array of field names.
getTriggerFunctions ( ) Returns a list of all functions that can be used in triggers
getTriggers ( $table = '' ) : A Grabs a list of triggers on a table
getType ( $typname ) : Type Returns all details for a particular type
getTypes ( $all = false, $tabletypes = false, $domains = false ) : A Returns a list of all types in the database
getUser ( $username ) : The Returns information about a single user
getUsers ( ) : All Returns all users in the database cluster
getVariables ( ) : A Returns all available variable information.
getView ( $view ) : View Returns all details for a particular view
getViews ( ) : All Returns a list of all views in the database
grantRole ( $role, $rolename, $admin ) Grants membership in a role
hasAggregateSortOp ( ) Capabilities
hasAlterAggregate ( )
hasAlterColumnType ( )
hasAlterDatabase ( )
hasAlterDatabaseOwner ( )
hasAlterDatabaseRename ( )
hasAlterDomains ( )
hasAlterSchema ( )
hasAlterSchemaOwner ( )
hasAlterSequenceSchema ( )
hasAlterSequenceStart ( )
hasAlterTableSchema ( )
hasAutovacuum ( )
hasByteaHexDefault ( )
hasConcurrentIndexBuild ( )
hasCreateFieldWithConstraints ( )
hasCreateTableLike ( )
hasCreateTableLikeWithConstraints ( )
hasCreateTableLikeWithIndexes ( )
hasDatabaseCollation ( )
hasDisableTriggers ( )
hasDomainConstraints ( )
hasEnumTypes ( )
hasFTS ( )
hasForceReindex ( )
hasFunctionAlterOwner ( )
hasFunctionAlterSchema ( )
hasFunctionCosting ( )
hasFunctionGUC ( )
hasGrantOption ( )
hasMagicTypes ( )
hasNamedParams ( )
hasObjectID ( $table ) : null Checks to see whether or not a table has a unique id column
hasPrepare ( )
hasPreparedXacts ( )
hasQueryCancel ( )
hasQueryKill ( )
hasReadOnlyQueries ( )
hasRecluster ( )
hasRoles ( )
hasServerAdminFuncs ( )
hasSharedComments ( )
hasTablespaces ( )
hasUserRename ( )
hasUserSignals ( )
hasVirtualTransactionId ( )
insertRow ( $table, $fields, $values, $nulls, $format, $types ) : -1 Adds a new row to a table
isSuperUser ( $username = '' ) : True Determines whether or not a user is a super user
nextvalSequence ( $sequence ) : -1 Execute nextval on a given sequence
phpBool ( $parameter ) Change a parameter from 't' or 'f' to a boolean, (others evaluate to false)
printField ( $name, $value, $type, $extras = [] ) Outputs the HTML code for a particular field
reindex ( $type, $name, $force = false ) Rebuild indexes
renameAggregate ( $aggrschema, $aggrname, $aggrtype, $newaggrname ) Renames an aggregate function
renameColumn ( $table, $column, $newName ) Renames a column in a table
renameRole ( $rolename, $newrolename ) Renames a role
renameUser ( $username, $newname ) Renames a user
resetSequence ( $sequence ) : -1 Resets a given sequence to min value of sequence
restartSequence ( $sequence ) : -1 Restart a given sequence to its start value
revokeRole ( $role, $rolename, $admin, $type = 'RESTRICT' ) Revokes membership in a role
saveAutovacuum ( $table, $vacenabled, $vacthreshold, $vacscalefactor, $anathresold, $anascalefactor, $vaccostdelay, $vaccostlimit ) : A Returns all available autovacuum per table information.
sendSignal ( $pid, $signal ) : -1 Sends a cancel or kill command to a process
setColumnDefault ( $table, $column, $default ) Sets default value of a column
setColumnNull ( $table, $column, $state ) Sets whether or not a column can contain NULLs
setComment ( $obj_type, $obj_name, $table, $comment, $basetype = NULL ) Sets the comment for an object in the database
setFunction ( $function_oid, $funcname, $newname, $args, $returns, $definition, $language, $flags, $setof, $funcown, $newown, $funcschema, $newschema, $cost, $rows, $comment ) : -7 Updates (replaces) a function.
setPrivileges ( $mode, $type, $object, $public, $usernames, $groupnames, $privileges, $grantoption, $cascade, $table ) : -4 Grants a privilege to a user, group or public
setRenameRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold, $newrolename ) : -3 Adjusts a role's info and renames it
setRenameUser ( $username, $password, $createdb, $createuser, $expiry, $newname ) : -3 Adjusts a user's info and renames the user
setRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold ) Adjusts a role's info
setRule ( $name, $event, $table, $where, $instead, $type, $action ) : -1 Edits a rule on a table OR view
setSchema ( $schema ) Sets the current working schema. Will also set Class variable.
setSearchPath ( $paths ) : -2 Sets the current schema search path
setUser ( $username, $password, $createdb, $createuser, $expiry ) Adjusts a user's info
setView ( $viewname, $definition, $comment ) : -3 Updates a view.
setvalSequence ( $sequence, $nextvalue ) : -1 Execute setval on a given sequence
updateFtsConfiguration ( $cfgname, $comment, $name ) Alters FTS configuration
updateFtsDictionary ( $dictname, $comment, $name ) Alters FTS dictionary or dictionary template
updateSchema ( $schemaname, $comment, $name, $owner ) Updates a schema.
vacuumDB ( $table = '', $analyze = false, $full = false, $freeze = false ) Vacuums a database

Protected Methods

Method Description
_alterSequence ( $seqrs, $name, $comment, $owner, $schema, $increment, $minvalue, $maxvalue, $restartvalue, $cachevalue, $cycledvalue, $startvalue ) : -7 Protected method which alter a sequence SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION
_alterTable ( $tblrs, $name, $owner, $schema, $comment, $tablespace ) : -7 Protected method which alter a table SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION
_alterView ( $vwrs, $name, $owner, $schema, $comment ) : -6 Protected method which alter a view SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION

Private Methods

Method Description
advance_1 ( &$i, &$prevlen, &$thislen ) A private helper method for executeScript that advances the character by 1. In psql this is careful to take into account multibyte languages, but we don't at the moment, so this function is someone redundant, since it will always advance by 1
valid_dolquote ( $dquote ) : True Private helper method to detect a valid $foo$ quote delimiter at the start of the parameter dquote

Method Details

Postgres() public method

Constructor
public Postgres ( $conn )
$conn The database connection

_alterSequence() protected method

Protected method which alter a sequence SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION
protected _alterSequence ( $seqrs, $name, $comment, $owner, $schema, $increment, $minvalue, $maxvalue, $restartvalue, $cachevalue, $cycledvalue, $startvalue ) : -7
$seqrs The sequence recordSet returned by getSequence()
$name The new name for the sequence
$comment The comment on the sequence
$owner The new owner for the sequence
$schema The new schema for the sequence
$increment The increment
$minvalue The min value
$maxvalue The max value
$restartvalue The starting value
$cachevalue The cache value
$cycledvalue True if cycled, false otherwise
$startvalue The sequence start value when issueing a restart
return -7

_alterTable() protected method

Protected method which alter a table SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION
protected _alterTable ( $tblrs, $name, $owner, $schema, $comment, $tablespace ) : -7
$tblrs The table recordSet returned by getTable()
$name The new name for the table
$owner The new owner for the table
$schema The new schema for the table
$comment The comment on the table
$tablespace The new tablespace for the table ('' means leave as is)
return -7

_alterView() protected method

Protected method which alter a view SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION
protected _alterView ( $vwrs, $name, $owner, $schema, $comment ) : -6
$vwrs The view recordSet returned by getView()
$name The new name for the view
$owner The new owner for the view
$comment The comment on the view
return -6

_encryptPassword() public method

Helper function that computes encypted PostgreSQL passwords
public _encryptPassword ( $username, $password )
$username The username
$password The password

_parseACL() public method

Internal function used for parsing ACLs
public _parseACL ( $acl ) : Privileges
$acl The ACL to parse (of type aclitem[])
return Privileges array

addCheckConstraint() public method

Adds a check constraint to a table
public addCheckConstraint ( $table, $definition, $name = '' )
$table The table to which to add the check
$definition The definition of the check
$name (optional) The name to give the check, otherwise default name is assigned

addColumn() public method

Add a new column to a table
public addColumn ( $table, $column, $type, $array, $length, $notnull, $default, $comment )
$table The table to add to
$column The name of the new column
$type The type of the column
$array True if array type, false otherwise
$length The optional size of the column (ie. 30 for varchar(30))
$notnull True if NOT NULL, false otherwise
$default The default for the column. '' for none.

addDomainCheckConstraint() public method

Adds a check constraint to a domain
public addDomainCheckConstraint ( $domain, $definition, $name = '' )
$domain The domain to which to add the check
$definition The definition of the check
$name (optional) The name to give the check, otherwise default name is assigned

addForeignKey() public method

Adds a foreign key constraint to a table
public addForeignKey ( $table, $targschema, $targtable, $sfields, $tfields, $upd_action, $del_action, $match, $deferrable, $initially, $name = '' ) : -1
$targschema The schema that houses the target table to which to add the foreign key
$targtable The table to which to add the foreign key
$sfields (array) An array of source fields over which to add the foreign key
$tfields (array) An array of target fields over which to add the foreign key
$upd_action The action for updates (eg. RESTRICT)
$del_action The action for deletes (eg. RESTRICT)
$match The match type (eg. MATCH FULL)
$deferrable The deferrability (eg. NOT DEFERRABLE)
$name (optional) The name to give the key, otherwise default name is assigned
return -1

addGroupMember() public method

Adds a group member
public addGroupMember ( $groname, $user )
$groname The name of the group
$user The name of the user to add to the group

addPrimaryKey() public method

Adds a primary key constraint to a table
public addPrimaryKey ( $table, $fields, $name = '', $tablespace = '' ) : -1
$table The table to which to add the primery key
$fields (array) An array of fields over which to add the primary key
$name (optional) The name to give the key, otherwise default name is assigned
$tablespace (optional) The tablespace for the schema, '' indicates default.
return -1

addUniqueKey() public method

Adds a unique constraint to a table
public addUniqueKey ( $table, $fields, $name = '', $tablespace = '' ) : -1
$table The table to which to add the unique key
$fields (array) An array of fields over which to add the unique key
$name (optional) The name to give the key, otherwise default name is assigned
$tablespace (optional) The tablespace for the schema, '' indicates default.
return -1

alreadyClustered() public method

test if a table has been clustered on an index
public alreadyClustered ( $table ) : true
$table The table to test
return true if the table has been already clustered

alterAggregate() public method

Alters an aggregate
public alterAggregate ( $aggrname, $aggrtype, $aggrowner, $aggrschema, $aggrcomment, $newaggrname, $newaggrowner, $newaggrschema, $newaggrcomment ) : -4
$aggrname The actual name of the aggregate
$aggrtype The actual input data type of the aggregate
$aggrowner The actual owner of the aggregate
$aggrschema The actual schema the aggregate belongs to
$aggrcomment The actual comment for the aggregate
$newaggrname The new name of the aggregate
$newaggrowner The new owner of the aggregate
$newaggrschema The new schema where the aggregate will belong to
$newaggrcomment The new comment for the aggregate
return -4

alterColumn() public method

Alters a column in a table
public alterColumn ( $table, $column, $name, $notnull, $oldnotnull, $default, $olddefault, $type, $length, $array, $oldtype, $comment ) : -6
$table The table in which the column resides
$column The column to alter
$name The new name for the column
$notnull (boolean) True if not null, false otherwise
$oldnotnull (boolean) True if column is already not null, false otherwise
$default The new default for the column
$olddefault The old default for the column
$type The new type for the column
$length The optional size of the column (ie. 30 for varchar(30))
$array True if array type, false otherwise
$oldtype The old type for the column
$comment Comment for the column
return -6

alterDatabase() public method

Alters a database the multiple return vals are for postgres 8+ which support more functionality in alter database
public alterDatabase ( $dbName, $newName, $newOwner = '', $comment = '' ) : -4
$dbName The name of the database
$newName new name for the database
$newOwner The new owner for the database
return -4

alterDatabaseOwner() public method

Changes ownership of a database This can only be done by a superuser or the owner of the database
public alterDatabaseOwner ( string $dbName, string $newOwner ) : integer
$dbName string database to change ownership of
$newOwner string user that will own the database
return integer 0 on success

alterDatabaseRename() public method

Renames a database, note that this operation cannot be performed on a database that is currently being connected to
public alterDatabaseRename ( string $oldName, string $newName ) : integer
$oldName string name of database to rename
$newName string new name of database
return integer 0 on success

alterDomain() public method

Alters a domain
public alterDomain ( $domain, $domdefault, $domnotnull, $domowner ) : -4
$domain The domain to alter
$domdefault The domain default
$domnotnull True for NOT NULL, false otherwise
$domowner The domain owner
return -4

alterSequence() public method

Alters a sequence
public alterSequence ( $sequence, $name, $comment, $owner = null, $schema = null, $increment = null, $minvalue = null, $maxvalue = null, $restartvalue = null, $cachevalue = null, $cycledvalue = null, $startvalue = null ) : -2
$sequence The name of the sequence
$name The new name for the sequence
$comment The comment on the sequence
$owner The new owner for the sequence
$schema The new schema for the sequence
$increment The increment
$minvalue The min value
$maxvalue The max value
$restartvalue The starting value
$cachevalue The cache value
$cycledvalue True if cycled, false otherwise
$startvalue The sequence start value when issueing a restart
return -2

alterSequenceName() public method

Rename a sequence
public alterSequenceName ( $seqrs, $name )
$seqrs The sequence RecordSet returned by getSequence()
$name The new name for the sequence

alterSequenceOwner() public method

Alter a sequence's owner
public alterSequenceOwner ( $seqrs, $owner )
$seqrs The sequence RecordSet returned by getSequence()

alterSequenceProps() public method

Alter a sequence's properties
public alterSequenceProps ( $seqrs, $increment, $minvalue, $maxvalue, $restartvalue, $cachevalue, $cycledvalue, $startvalue )
$seqrs The sequence RecordSet returned by getSequence()
$increment The sequence incremental value
$minvalue The sequence minimum value
$maxvalue The sequence maximum value
$restartvalue The sequence current value
$cachevalue The sequence cache value
$cycledvalue Sequence can cycle ?
$startvalue The sequence start value when issueing a restart

alterSequenceSchema() public method

Alter a sequence's schema
public alterSequenceSchema ( $seqrs, $schema )
$seqrs The sequence RecordSet returned by getSequence()

alterTable() public method

Alter table properties
public alterTable ( $table, $name, $owner, $schema, $comment, $tablespace ) : -2
$table The name of the table
$name The new name for the table
$owner The new owner for the table
$schema The new schema for the table
$comment The comment on the table
$tablespace The new tablespace for the table ('' means leave as is)
return -2

alterTableName() public method

Alter a table's name !\ this function is called from _alterTable which take care of escaping fields
public alterTableName ( $tblrs, $name = null )
$tblrs The table RecordSet returned by getTable()
$name The new table's name

alterTableOwner() public method

Alter a table's owner !\ this function is called from _alterTable which take care of escaping fields
public alterTableOwner ( $tblrs, $owner = null )
$tblrs The table RecordSet returned by getTable()

alterTableSchema() public method

Alter a table's schema !\ this function is called from _alterTable which take care of escaping fields
public alterTableSchema ( $tblrs, $schema = null )
$tblrs The table RecordSet returned by getTable()

alterTableTablespace() public method

Alter a table's tablespace !\ this function is called from _alterTable which take care of escaping fields
public alterTableTablespace ( $tblrs, $tablespace = null )
$tblrs The table RecordSet returned by getTable()

alterTablespace() public method

Alters a tablespace
public alterTablespace ( $spcname, $name, $owner, $comment = '' ) : -4
$spcname The name of the tablespace
$name The new name for the tablespace
$owner The new owner for the tablespace
return -4

alterTrigger() public method

Alters a trigger
public alterTrigger ( $table, $trigger, $name )
$table The name of the table containing the trigger
$trigger The name of the trigger to alter
$name The new name for the trigger

alterView() public method

Alter view properties
public alterView ( $view, $name, $owner, $schema, $comment ) : -2
$view The name of the view
$name The new name for the view
$owner The new owner for the view
$schema The new schema for the view
$comment The comment on the view
return -2

alterViewName() public method

Rename a view
public alterViewName ( $vwrs, $name )
$vwrs The view recordSet returned by getView()
$name The new view's name

alterViewOwner() public method

Alter a view's owner
public alterViewOwner ( $vwrs, $owner = null )
$vwrs The view recordSet returned by getView()

alterViewSchema() public method

Alter a view's schema
public alterViewSchema ( $vwrs, $schema )
$vwrs The view recordSet returned by getView()

analyzeDB() public method

Analyze a database
public analyzeDB ( $table = '' )
$table (optional) The table to analyze

arrayClean() public method

Cleans (escapes) an array
public arrayClean ( &$arr ) : The
$arr The array to clean, by reference
return The cleaned array

beginDump() public method

Sets up the data object for a dump. eg. Starts the appropriate transaction, sets variables, etc.
public beginDump ( )

browseQuery() public method

Returns a recordset of all columns in a query. Supports paging.
public browseQuery ( $type, $table, $query, $sortkey, $sortdir, $page, $page_size, &$max_pages ) : -5
$type Either 'QUERY' if it is an SQL query, or 'TABLE' if it is a table identifier, or 'SELECT" if it's a select query
$table The base table of the query. NULL for no table.
$query The query that is being executed. NULL for no query.
$sortkey The column number to sort by, or '' or null for no sorting
$sortdir The direction in which to sort the specified column ('asc' or 'desc')
$page The page of the relation to retrieve
$page_size The number of rows per page
return -5 recordset on success

browseQueryCount() public method

Finds the number of rows that would be returned by a query.
public browseQueryCount ( $query, $count ) : -1
$query The SQL query
$count The count query
return -1 count of rows

browseRow() public method

Returns a recordset of all columns in a table
public browseRow ( $table, $key ) : A
$table The name of a table
$key The associative array holding the key to retrieve
return A recordset

changeAggregateOwner() public method

Changes the owner of an aggregate function
public changeAggregateOwner ( $aggrname, $aggrtype, $newaggrowner )
$aggrname The name of the aggregate
$aggrtype The input data type of the aggregate
$newaggrowner The new owner of the aggregate

changeAggregateSchema() public method

Changes the schema of an aggregate function
public changeAggregateSchema ( $aggrname, $aggrtype, $newaggrschema )
$aggrname The name of the aggregate
$aggrtype The input data type of the aggregate
$newaggrschema The new schema for the aggregate

changeFtsMapping() public method

Creates/updates/deletes FTS mapping.
public changeFtsMapping ( $ftscfg, array $mapping, string $action, string $dictname = null )
$mapping array Array of tokens' names
$action string What to do with the mapping: add, alter or drop
$dictname string Dictionary that will process tokens given or null in case of drop action

changePassword() public method

Changes a role's password
public changePassword ( $rolename, $password )
$rolename The role name
$password The new password

clean() public method

Cleans (escapes) a string
public clean ( &$str ) : The
$str The string to clean, by reference
return The cleaned string

clusterIndex() public method

Clusters an index
public clusterIndex ( $table = '', $index = '' )
$table The table the index is on
$index The name of the index

createAggregate() public method

Creates a new aggregate in the database
public createAggregate ( $name, $basetype, $sfunc, $stype, $ffunc, $initcond, $sortop, $comment ) : -1
$name The name of the aggregate
$basetype The input data type of the aggregate
$sfunc The name of the state transition function for the aggregate
$stype The data type for the aggregate's state value
$ffunc The name of the final function for the aggregate
$initcond The initial setting for the state value
$sortop The sort operator for the aggregate
$comment Aggregate comment
return -1

createCompositeType() public method

Creates a new composite type in the database
public createCompositeType ( $name, $fields, $field, $type, $array, $length, $colcomment, $typcomment ) : -1
$name The name of the type
$fields The number of fields
$field An array of field names
$type An array of field types
$array An array of '' or '[]' for each type if it's an array or not
$length An array of field lengths
$colcomment An array of comments
$typcomment Type comment
return -1

createDatabase() public method

Creates a database
public createDatabase ( $database, $encoding, $tablespace = '', $comment = '', $template = 'template1', $lc_collate = '', $lc_ctype = '' ) : -2
$database The name of the database to create
$encoding Encoding of the database
$tablespace (optional) The tablespace name
return -2

createDomain() public method

Creates a domain
public createDomain ( $domain, $type, $length, $array, $notnull, $default, $check )
$domain The name of the domain to create
$type The base type for the domain
$length Optional type length
$array True for array type, false otherwise
$notnull True for NOT NULL, false otherwise
$default Default value for domain
$check A CHECK constraint if there is one

createEnumType() public method

Creates a new enum type in the database
public createEnumType ( $name, $values, $typcomment ) : -2
$name The name of the type
$values An array of values
$typcomment Type comment
return -2

createFtsConfiguration() public method

Creates a new FTS configuration.
public createFtsConfiguration ( string $cfgname, string $parser = '', string $template = '', string $comment = '' )
$cfgname string The name of the FTS configuration to create
$parser string The parser to be used in new FTS configuration
$template string The existing FTS configuration to be used as template for the new one
$comment string If omitted, defaults to nothing

createFtsDictionary() public method

Creates a new FTS dictionary or FTS dictionary template.
public createFtsDictionary ( string $dictname, boolean $isTemplate = false, string $template = '', string $lexize = '', string $init = '', string $option = '', string $comment = '' )
$dictname string The name of the FTS dictionary to create
$isTemplate boolean Flag whether we create usual dictionary or dictionary template
$template string The existing FTS dictionary to be used as template for the new one
$lexize string The name of the function, which does transformation of input word
$init string The name of the function, which initializes dictionary
$option string Usually, it stores various options required for the dictionary
$comment string If omitted, defaults to nothing

createFunction() public method

Creates a new function.
public createFunction ( $funcname, $args, $returns, $definition, $language, $flags, $setof, $cost, $rows, $comment, $replace = false ) : -4
$funcname The name of the function to create
$args A comma separated string of types
$returns The return type
$definition The definition for the new function
$language The language the function is written for
$flags An array of optional flags
$setof True if it returns a set, false otherwise
$cost cost the planner should use in the function execution step
$rows number of rows planner should estimate will be returned
$comment Comment for the function
$replace (optional) True if OR REPLACE, false for normal
return -4

createGroup() public method

Creates a new group
public createGroup ( $groname, $users )
$groname The name of the group
$users An array of users to add to the group

createIndex() public method

Creates an index
public createIndex ( $name, $table, $columns, $type, $unique, $where, $tablespace, $concurrently )
$name The index name
$table The table on which to add the index
$columns An array of columns that form the index or a string expression for a functional index
$type The index type
$unique True if unique, false otherwise
$where Index predicate ('' for none)
$tablespace The tablespaces ('' means none/default)

createRole() public method

Creates a new role
public createRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers )
$rolename The name of the role to create
$password A password for the role
$superuser Boolean whether or not the role is a superuser
$createdb Boolean whether or not the role can create databases
$createrole Boolean whether or not the role can create other roles
$inherits Boolean whether or not the role inherits the privileges from parent roles
$login Boolean whether or not the role will be allowed to login
$connlimit Number of concurrent connections the role can make
$expiry String Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire
$memberof (array) Roles to which the new role will be immediately added as a new member
$members (array) Roles which are automatically added as members of the new role
$adminmembers (array) Roles which are automatically added as admin members of the new role

createRule() public method

Creates a rule
public createRule ( $name, $event, $table, $where, $instead, $type, $action, $replace = false ) : -1
$name The name of the new rule
$event SELECT, INSERT, UPDATE or DELETE
$table Table on which to create the rule
$where When to execute the rule, '' indicates always
$instead True if an INSTEAD rule, false otherwise
$type NOTHING for a do nothing rule, SOMETHING to use given action
$action The action to take
$replace (optional) True to replace existing rule, false otherwise
return -1

createSchema() public method

Creates a new schema.
public createSchema ( $schemaname, $authorization = '', $comment = '' )
$schemaname The name of the schema to create
$authorization (optional) The username to create the schema for.
$comment (optional) If omitted, defaults to nothing

createSequence() public method

Creates a new sequence
public createSequence ( $sequence, $increment, $minvalue, $maxvalue, $startvalue, $cachevalue, $cycledvalue )
$sequence Sequence name
$increment The increment
$minvalue The min value
$maxvalue The max value
$startvalue The starting value
$cachevalue The cache value
$cycledvalue True if cycled, false otherwise

createTable() public method

Creates a new table in the database
public createTable ( $name, $fields, $field, $type, $array, $length, $notnull, $default, $withoutoids, $colcomment, $tblcomment, $tablespace, $uniquekey, $primarykey ) : -1
$name The name of the table
$fields The number of fields
$field An array of field names
$type An array of field types
$array An array of '' or '[]' for each type if it's an array or not
$length An array of field lengths
$notnull An array of not null
$default An array of default values
$withoutoids True if WITHOUT OIDS, false otherwise
$colcomment An array of comments
$tablespace The tablespace name ('' means none/default)
$uniquekey An Array indicating the fields that are unique (those indexes that are set)
$primarykey An Array indicating the field used for the primarykey (those indexes that are set)
return -1

createTableLike() public method

Creates a new table in the database copying attribs and other properties from another table
public createTableLike ( $name, $like, $defaults = false, $constraints = false, $idx = false, $tablespace = '' )
$name The name of the table
$like an array giving the schema ans the name of the table from which attribs are copying from: array( 'table' => table name, 'schema' => the schema name, )
$defaults if true, copy the defaults values as well
$constraints if true, copy the constraints as well (CHECK on table & attr)
$tablespace The tablespace name ('' means none/default)

createTablespace() public method

Creates a tablespace
public createTablespace ( $spcname, $spcowner, $spcloc, $comment = '' )
$spcname The name of the tablespace to create
$spcowner The owner of the tablespace. '' for current
$spcloc The directory in which to create the tablespace

createTrigger() public method

Creates a trigger
public createTrigger ( $tgname, $table, $tgproc, $tgtime, $tgevent, $tgfrequency, $tgargs )
$tgname The name of the trigger to create
$table The name of the table
$tgproc The function to execute
$tgtime BEFORE or AFTER
$tgevent Event
$tgargs The function arguments

createType() public method

Creates a new type
public createType ( $typname, $typin, $typout, $typlen, $typdef, $typelem, $typdelim, $typbyval, $typalign, $typstorage )

createUser() public method

Creates a new user
public createUser ( $username, $password, $createdb, $createuser, $expiry, $groups )
$username The username of the user to create
$password A password for the user
$createdb boolean Whether or not the user can create databases
$createuser boolean Whether or not the user can create other users
$expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire

createView() public method

Creates a new view.
public createView ( $viewname, $definition, $replace, $comment )
$viewname The name of the view to create
$definition The definition for the new view
$replace True to replace the view, false otherwise

dbBool() public method

Change the value of a parameter to 't' or 'f' depending on whether it evaluates to true or false
public dbBool ( &$parameter )
$parameter the parameter

deleteRow() public method

Delete a row from a table
public deleteRow ( $table, $key, $schema = false )
$table The table from which to delete
$key An array mapping column => value to delete

disableTrigger() public method

Disables a trigger
public disableTrigger ( $tgname, $table )
$tgname The name of the trigger to disable
$table The table in which to disable the trigger

dropAggregate() public method

Removes an aggregate function from the database
public dropAggregate ( $aggrname, $aggrtype, $cascade )
$aggrname The name of the aggregate
$aggrtype The input data type of the aggregate
$cascade True to cascade drop, false to restrict

dropAutovacuum() public method

public dropAutovacuum ( $table )

dropCheckConstraint() public method

Drops a check constraint from a table
public dropCheckConstraint ( $table, $name ) : -4
$table The table from which to drop the check
$name The name of the check to be dropped
return -4

dropColumn() public method

Drops a column from a table
public dropColumn ( $table, $column, $cascade )
$table The table from which to drop a column
$column The column to be dropped
$cascade True to cascade drop, false to restrict

dropColumnDefault() public method

Drops default value of a column
public dropColumnDefault ( $table, $column )
$table The table from which to drop
$column The column name to drop default

dropConstraint() public method

Removes a constraint from a relation
public dropConstraint ( $constraint, $relation, $type, $cascade )
$constraint The constraint to drop
$relation The relation from which to drop
$type The type of constraint (c, f, u or p)
$cascade True to cascade drop, false to restrict

dropDatabase() public method

Drops a database
public dropDatabase ( $database )
$database The name of the database to drop

dropDomain() public method

Drops a domain.
public dropDomain ( $domain, $cascade )
$domain The name of the domain to drop
$cascade True to cascade drop, false to restrict

dropDomainConstraint() public method

Drops a domain constraint
public dropDomainConstraint ( $domain, $constraint, $cascade )
$domain The domain from which to remove the constraint
$constraint The constraint to remove
$cascade True to cascade, false otherwise

dropFtsConfiguration() public method

Drops FTS coniguration
public dropFtsConfiguration ( $ftscfg, $cascade )
$ftscfg The configuration's name
$cascade Cascade to dependenced objects

dropFtsDictionary() public method

Drops FTS dictionary
public dropFtsDictionary ( $ftsdict, $cascade )
$ftsdict The dico's name
$cascade Cascade to dependenced objects

dropFunction() public method

Drops a function.
public dropFunction ( $function_oid, $cascade )
$function_oid The OID of the function to drop
$cascade True to cascade drop, false to restrict

dropGroup() public method

Removes a group
public dropGroup ( $groname )
$groname The name of the group to drop

dropGroupMember() public method

Removes a group member
public dropGroupMember ( $groname, $user )
$groname The name of the group
$user The name of the user to remove from the group

dropIndex() public method

Removes an index from the database
public dropIndex ( $index, $cascade )
$index The index to drop
$cascade True to cascade drop, false to restrict

dropOperator() public method

Drops an operator
public dropOperator ( $operator_oid, $cascade )
$operator_oid The OID of the operator to drop
$cascade True to cascade drop, false to restrict

dropRole() public method

Removes a role
public dropRole ( $rolename )
$rolename The name of the role to drop

dropRule() public method

Removes a rule from a table OR view
public dropRule ( $rule, $relation, $cascade )
$rule The rule to drop
$relation The relation from which to drop
$cascade True to cascade drop, false to restrict

dropSchema() public method

Drops a schema.
public dropSchema ( $schemaname, $cascade )
$schemaname The name of the schema to drop
$cascade True to cascade drop, false to restrict

dropSequence() public method

Drops a given sequence
public dropSequence ( $sequence, $cascade )
$sequence Sequence name
$cascade True to cascade drop, false to restrict

dropTable() public method

Removes a table from the database
public dropTable ( $table, $cascade )
$table The table to drop
$cascade True to cascade drop, false to restrict

dropTablespace() public method

Drops a tablespace
public dropTablespace ( $spcname )
$spcname The name of the domain to drop

dropTrigger() public method

Drops a trigger
public dropTrigger ( $tgname, $table, $cascade )
$tgname The name of the trigger to drop
$table The table from which to drop the trigger
$cascade True to cascade drop, false to restrict

dropType() public method

Drops a type.
public dropType ( $typname, $cascade )
$typname The name of the type to drop
$cascade True to cascade drop, false to restrict

dropUser() public method

Removes a user
public dropUser ( $username )
$username The username of the user to drop

dropView() public method

Drops a view.
public dropView ( $viewname, $cascade )
$viewname The name of the view to drop
$cascade True to cascade drop, false to restrict

dumpRelation() public method

@@ Note: Really needs to use a cursor
public dumpRelation ( $relation, $oids ) : -1
$relation The name of a relation
return -1 recordset on success

editRow() public method

Updates a row in a table
public editRow ( $table, $vars, $nulls, $format, $types, $keyarr ) : -1
$table The table in which to update
$vars An array mapping new values for the row
$nulls An array mapping column => something if it is to be null
$format An array of the data type (VALUE or EXPRESSION)
$types An array of field types
$keyarr An array mapping column => value to update
return -1

emptyTable() public method

Empties a table in the database
public emptyTable ( $table )
$table The table to be emptied

enableTrigger() public method

Enables a trigger
public enableTrigger ( $tgname, $table )
$tgname The name of the trigger to enable
$table The table in which to enable the trigger

endDump() public method

Ends the data object for a dump.
public endDump ( )

escapeBytea() public method

Escapes bytea data for display on the screen
public escapeBytea ( $data ) : Data
$data The bytea data
return Data formatted for on-screen display

executeScript() public method

XXX: It does not handle multibyte languages properly.
public executeScript ( $name, $callback = null ) : True
$name Entry in $_FILES to use
$callback (optional) Callback function to call with each query, its result and line number.
return True for general success, false on any failure.

fieldArrayClean() public method

Cleans (escapes) an array of field names
public fieldArrayClean ( &$arr ) : The
$arr The array to clean, by reference
return The cleaned array

fieldClean() public method

Cleans (escapes) an object name (eg. table, field)
public fieldClean ( &$str ) : The
$str The string to clean, by reference
return The cleaned string

findObject() public method

Searches all system catalogs to find objects that match a certain name.
public findObject ( $term, $filter ) : A
$term The search term
$filter The object type to restrict to ('' means no restriction)
return A recordset

formatType() public method

Formats a type correctly for display. Postgres 7.0 had no 'format_type' built-in function, and hence we need to do it manually.
public formatType ( $typname, $typmod )
$typname The name of the type
$typmod The contents of the typmod field

formatValue() public method

Formats a value or expression for sql purposes
public formatValue ( $type, $format, $value ) : The
$type The type of the field
$format VALUE or EXPRESSION
$value The actual value entered in the field. Can be NULL
return The suitably quoted and escaped value.

getAggregate() public method

Gets all information for an aggregate
public getAggregate ( $name, $basetype ) : A
$name The name of the aggregate
$basetype The input data type of the aggregate
return A recordset

getAggregates() public method

Gets all aggregates
public getAggregates ( ) : A
return A recordset

getAttributeNames() public method

Given an array of attnums and a relation, returns an array mapping attribute number to attribute name.
public getAttributeNames ( $table, $atts ) : -2
$table The table to get attributes for
$atts An array of attribute numbers
return -2 array mapping attnum to attname

getAutovacuum() public method

Returns all autovacuum global configuration
public getAutovacuum ( ) : associative
return associative array array( param => value, ...)

getCasts() public method

Returns a list of all casts in the database
public getCasts ( ) : All
return All casts

getChangeUserSQL() public method

Returns the SQL for changing the current user
public getChangeUserSQL ( $user ) : The
$user The user to change to
return The SQL

getConstraints() public method

Returns a list of all constraints on a table
public getConstraints ( $table ) : A
$table The table to find rules for
return A recordset

getConstraintsWithFields() public method

Returns a list of all constraints on a table, including constraint name, definition, related col and referenced namespace, table and col if needed
public getConstraintsWithFields ( $table ) : a
$table the table where we are looking for fk
return a recordset

getConversions() public method

Returns a list of all conversions in the database
public getConversions ( ) : All
return All conversions

getDatabase() public method

Return all information about a particular database
public getDatabase ( $database ) : The
$database The name of the database to retrieve
return The database info

getDatabaseComment() public method

Return the database comment of a db from the shared description table
public getDatabaseComment ( string $database ) : recordset
$database string the name of the database to get the comment for
return recordset of the db comment info

getDatabaseEncoding() public method

Returns the current database encoding
public getDatabaseEncoding ( ) : The
return The encoding. eg. SQL_ASCII, UTF-8, etc.

getDatabaseOwner() public method

Return the database owner of a db
public getDatabaseOwner ( string $database ) : recordset
$database string the name of the database to get the owner for
return recordset of the db owner info

getDatabases() public method

Return all database available on the server
public getDatabases ( $currentdatabase = NULL ) : A
$currentdatabase database name that should be on top of the resultset
return A list of databases, sorted alphabetically

getDefaultWithOid() public method

Returns the current default_with_oids setting
public getDefaultWithOid ( ) : default_with_oids
return default_with_oids setting

getDomain() public method

Gets all information for a single domain
public getDomain ( $domain ) : A
$domain The name of the domain to fetch
return A recordset

getDomainConstraints() public method

Get domain constraints
public getDomainConstraints ( $domain ) : A
$domain The name of the domain whose constraints to fetch
return A recordset

getDomains() public method

Return all domains in current schema. Excludes domain constraints.
public getDomains ( ) : All
return All tables, sorted alphabetically

getEnumValues() public method

Get defined values for a given enum
public getEnumValues ( $name ) : A
return A recordset

getFtsConfigurationByName() public method

Return all information related to a FTS configuration
public getFtsConfigurationByName ( $ftscfg ) : FTS
$ftscfg The name of the FTS configuration
return FTS configuration information

getFtsConfigurationMap() public method

Returns the map of FTS configuration given (list of mappings (tokens) and their processing dictionaries)
public getFtsConfigurationMap ( string $ftscfg ) : RecordSet
$ftscfg string Name of the FTS configuration
return RecordSet

getFtsConfigurations() public method

Returns available FTS configurations
public getFtsConfigurations ( $all = true ) : A
$all if false, returns schema qualified FTS confs
return A recordset

getFtsDictionaries() public method

Returns FTS dictionaries available
public getFtsDictionaries ( $all = true )
$all if false, return only Dics from the current schema

getFtsDictionaryByName() public method

Return all information relating to a FTS dictionary
public getFtsDictionaryByName ( $ftsdict ) : RecordSet
$ftsdict The name of the FTS dictionary
return RecordSet of FTS dictionary information

getFtsDictionaryTemplates() public method

Returns all FTS dictionary templates available

getFtsMappingByName() public method

Return all information related to a given FTS configuration's mapping
public getFtsMappingByName ( $ftscfg, $mapping ) : FTS
$ftscfg The name of the FTS configuration
$mapping The name of the mapping
return FTS configuration information

getFtsMappings() public method

Return list of FTS mappings possible for given parser (specified by given configuration since configuration can only have 1 parser)
public getFtsMappings ( $ftscfg )
$ftscfg The config's name that use the parser

getFtsParsers() public method

Returns FTS parsers available
public getFtsParsers ( $all = true ) : RecordSet
$all if false, return only Parsers from the current schema
return RecordSet

getFunction() public method

Returns all details for a particular function
public getFunction ( $function_oid ) : Function
return Function info

getFunctionProperties() public method

Returns an array containing a function's properties
public getFunctionProperties ( $f ) : An
$f The array of data for the function
return An array containing the properties

getFunctions() public method

Returns a list of all functions in the database
public getFunctions ( $all = false, $type = null ) : All
$all If true, will find all available functions, if false just those in search path
$type If not null, will find all functions with return value = type
return All functions

getGroup() public method

Return users in a specific group
public getGroup ( $groname ) : All
$groname The name of the group
return All users in the group

getGroups() public method

Returns all groups in the database cluser
public getGroups ( ) : All
return All groups

getHelp() public method

Fetch a URL (or array of URLs) for a given help page.
public getHelp ( $help )

getHelpPages() public method

public getHelpPages ( )

getIndexes() public method

Grabs a list of indexes for a table
public getIndexes ( $table = '', $unique = false ) : A
$table The name of a table whose indexes to retrieve
$unique Only get unique/pk indexes
return A recordset

getLanguages() public method

Gets all languages
public getLanguages ( $all = false ) : A
$all True to get all languages, regardless of show_system
return A recordset

getLinkingKeys() public method

A function for getting all columns linked by foreign keys given a group of tables
public getLinkingKeys ( $tables ) : -1
$tables multi dimensional assoc array that holds schema and table name
return -1 recordset of linked tables and columns

getLocks() public method

Returns table locks information in the current database
public getLocks ( ) : A
return A recordset

getMemberOf() public method

Returns all role names which the role belongs to
public getMemberOf ( $rolename ) : All
$rolename The role name
return All role names

getMembers() public method

Returns all role names that are members of a role
public getMembers ( $rolename, $admin = 'f' ) : All
$rolename The role name
$admin (optional) Find only admin members
return All role names

getOpClasses() public method

Gets all opclasses
public getOpClasses ( ) : A
return A recordset

getOperator() public method

Returns all details for a particular operator
public getOperator ( $operator_oid ) : Function
$operator_oid The oid of the operator
return Function info

getOperators() public method

Returns a list of all operators in the database
public getOperators ( ) : All
return All operators

getPreparedXacts() public method

Returns prepared transactions information
public getPreparedXacts ( $database = null ) : A
$database (optional) Find only prepared transactions executed in a specific database
return A recordset

getPrivileges() public method

Grabs an array of users and their privileges for an object, given its type.
public getPrivileges ( $object, $type, $table = null ) : -3
$object The name of the object whose privileges are to be retrieved
$type The type of the object (eg. database, schema, relation, function or language)
$table Optional, column's table if type = column
return -3 array

getProcesses() public method

Returns all available process information.
public getProcesses ( $database = null ) : A
$database (optional) Find only connections to specified database
return A recordset

getReferrers() public method

Finds the foreign keys that refer to the specified table
public getReferrers ( $table ) : A
$table The table to find referrers for
return A recordset

getRole() public method

Returns information about a single role
public getRole ( $rolename ) : The
$rolename The name of the role to retrieve
return The role's data

getRoles() public method

Returns all roles in the database cluster
public getRoles ( $rolename = '' ) : All
$rolename (optional) The role name to exclude from the select
return All roles

getRowIdentifier() public method

Get the fields for uniquely identifying a row in a table
public getRowIdentifier ( $table ) : -1
$table The table for which to retrieve the identifier
return -1 array mapping attribute number to attribute name, empty for no identifiers

getRules() public method

Returns a list of all rules on a table OR view
public getRules ( $table ) : A
$table The table to find rules for
return A recordset

getSchemaByName() public method

Return all information relating to a schema
public getSchemaByName ( $schema ) : Schema
$schema The name of the schema
return Schema information

getSchemas() public method

Return all schemas in the current database.
public getSchemas ( ) : All
return All schemas, sorted alphabetically

getSearchPath() public method

Return the current schema search path
public getSearchPath ( ) : Array
return Array of schema names

getSelectSQL() public method

Generates the SQL for the 'select' function
public getSelectSQL ( $table, $show, $values, $ops, $orderby = [] ) : The
$table The table from which to select
$show An array of columns to show. Empty array means all columns.
$values An array mapping columns to values
$ops An array of the operators to use
$orderby (optional) An array of column numbers or names (one based) mapped to sort direction (asc or desc or '' or null) to order by
return The SQL query

getSequence() public method

Returns properties of a single sequence
public getSequence ( $sequence ) : A
$sequence Sequence name
return A recordset

getSequences() public method

Returns all sequences in the current database
public getSequences ( $all = false ) : A
return A recordset

getStatsDatabase() public method

Fetches statistics for a database
public getStatsDatabase ( $database ) : A
$database The database to fetch stats for
return A recordset

getStatsIndexIO() public method

Fetches I/0 statistics for all indexes on a table
public getStatsIndexIO ( $table ) : A
$table The table to fetch index stats for
return A recordset

getStatsIndexTuples() public method

Fetches tuple statistics for all indexes on a table
public getStatsIndexTuples ( $table ) : A
$table The table to fetch index stats for
return A recordset

getStatsTableIO() public method

Fetches I/0 statistics for a table
public getStatsTableIO ( $table ) : A
$table The table to fetch stats for
return A recordset

getStatsTableTuples() public method

Fetches tuple statistics for a table
public getStatsTableTuples ( $table ) : A
$table The table to fetch stats for
return A recordset

getTable() public method

Returns table information
public getTable ( $table ) : A
$table The name of the table
return A recordset

getTableAttributes() public method

Retrieve the attribute definition of a table
public getTableAttributes ( $table, $field = '' ) : All
$table The name of the table
$field (optional) The name of a field to return
return All attributes in order

getTableAutovacuum() public method

Returns all available autovacuum per table information.
public getTableAutovacuum ( $table = '' ) : A
$table if given, return autovacuum info for the given table or return all informations for all table
return A recordset

getTableChildren() public method

Finds the names and schemas of child tables
public getTableChildren ( $table ) : A
$table The table to find the children for
return A recordset

getTableDefPrefix() public method

Returns the SQL definition for the table.
public getTableDefPrefix ( $table, $clean = false ) : null
$table The table to define
$clean True to issue drop command, false otherwise
return null string containing the formatted SQL code

getTableDefSuffix() public method

Returns extra table definition information that is most usefully dumped after the table contents for speed and efficiency reasons
public getTableDefSuffix ( $table ) : null
$table The table to define
return null string containing the formatted SQL code

getTableParents() public method

Finds the names and schemas of parent tables (in order)
public getTableParents ( $table ) : A
$table The table to find the parents for
return A recordset

getTables() public method

Return all tables in current database (and schema)
public getTables ( $all = false ) : All
$all True to fetch all tables, false for just in current schema
return All tables, sorted alphabetically

getTablespace() public method

Retrieves a tablespace's information
public getTablespace ( $spcname ) : A
return A recordset

getTablespaces() public method

Retrieves information for all tablespaces
public getTablespaces ( $all = false ) : A
$all Include all tablespaces (necessary when moving objects back to the default space)
return A recordset

getTrigger() public method

Grabs a single trigger
public getTrigger ( $table, $trigger ) : A
$table The name of a table whose triggers to retrieve
$trigger The name of the trigger to retrieve
return A recordset

getTriggerDef() public method

Note: Only needed for pre-7.4 servers, this function is deprecated
public getTriggerDef ( $trigger ) : The
$trigger An array containing fields from the trigger table
return The trigger definition string

getTriggerFunctions() public method

Returns a list of all functions that can be used in triggers
public getTriggerFunctions ( )

getTriggers() public method

Grabs a list of triggers on a table
public getTriggers ( $table = '' ) : A
$table The name of a table whose triggers to retrieve
return A recordset

getType() public method

Returns all details for a particular type
public getType ( $typname ) : Type
$typname The name of the view to retrieve
return Type info

getTypes() public method

Returns a list of all types in the database
public getTypes ( $all = false, $tabletypes = false, $domains = false ) : A
$all If true, will find all available types, if false just those in search path
$tabletypes If true, will include table types
$domains If true, will include domains
return A recordet

getUser() public method

Returns information about a single user
public getUser ( $username ) : The
$username The username of the user to retrieve
return The user's data

getUsers() public method

Returns all users in the database cluster
public getUsers ( ) : All
return All users

getVariables() public method

Returns all available variable information.
public getVariables ( ) : A
return A recordset

getView() public method

Returns all details for a particular view
public getView ( $view ) : View
$view The name of the view to retrieve
return View info

getViews() public method

Returns a list of all views in the database
public getViews ( ) : All
return All views

grantRole() public method

Grants membership in a role
public grantRole ( $role, $rolename, $admin )
$role The name of the target role
$rolename The name of the role that will belong to the target role
$admin (optional) Flag to grant the admin option

hasAggregateSortOp() public method

Capabilities
public hasAggregateSortOp ( )

hasAlterAggregate() public method

public hasAlterAggregate ( )

hasAlterColumnType() public method

public hasAlterColumnType ( )

hasAlterDatabase() public method

public hasAlterDatabase ( )

hasAlterDatabaseOwner() public method

hasAlterDatabaseRename() public method

hasAlterDomains() public method

public hasAlterDomains ( )

hasAlterSchema() public method

public hasAlterSchema ( )

hasAlterSchemaOwner() public method

public hasAlterSchemaOwner ( )

hasAlterSequenceSchema() public method

hasAlterSequenceStart() public method

hasAlterTableSchema() public method

public hasAlterTableSchema ( )

hasAutovacuum() public method

public hasAutovacuum ( )

hasByteaHexDefault() public method

public hasByteaHexDefault ( )

hasConcurrentIndexBuild() public method

hasCreateFieldWithConstraints() public method

hasCreateTableLike() public method

public hasCreateTableLike ( )

hasCreateTableLikeWithConstraints() public method

hasCreateTableLikeWithIndexes() public method

hasDatabaseCollation() public method

hasDisableTriggers() public method

public hasDisableTriggers ( )

hasDomainConstraints() public method

hasEnumTypes() public method

public hasEnumTypes ( )

hasFTS() public method

public hasFTS ( )

hasForceReindex() public method

public hasForceReindex ( )

hasFunctionAlterOwner() public method

hasFunctionAlterSchema() public method

hasFunctionCosting() public method

public hasFunctionCosting ( )

hasFunctionGUC() public method

public hasFunctionGUC ( )

hasGrantOption() public method

public hasGrantOption ( )

hasMagicTypes() public method

public hasMagicTypes ( )

hasNamedParams() public method

public hasNamedParams ( )

hasObjectID() public method

Checks to see whether or not a table has a unique id column
public hasObjectID ( $table ) : null
$table The table name
return null if it has a unique id, false otherwise

hasPrepare() public method

public hasPrepare ( )

hasPreparedXacts() public method

public hasPreparedXacts ( )

hasQueryCancel() public method

public hasQueryCancel ( )

hasQueryKill() public method

public hasQueryKill ( )

hasReadOnlyQueries() public method

public hasReadOnlyQueries ( )

hasRecluster() public method

public hasRecluster ( )

hasRoles() public method

public hasRoles ( )

hasServerAdminFuncs() public method

public hasServerAdminFuncs ( )

hasSharedComments() public method

public hasSharedComments ( )

hasTablespaces() public method

public hasTablespaces ( )

hasUserRename() public method

public hasUserRename ( )

hasUserSignals() public method

public hasUserSignals ( )

hasVirtualTransactionId() public method

insertRow() public method

Adds a new row to a table
public insertRow ( $table, $fields, $values, $nulls, $format, $types ) : -1
$table The table in which to insert
$fields Array of given field in values
$values Array of new values for the row
$nulls An array mapping column => something if it is to be null
$format An array of the data type (VALUE or EXPRESSION)
$types An array of field types
return -1

isSuperUser() public method

Determines whether or not a user is a super user
public isSuperUser ( $username = '' ) : True
$username The username of the user
return True if is a super user, false otherwise

nextvalSequence() public method

Execute nextval on a given sequence
public nextvalSequence ( $sequence ) : -1
$sequence Sequence name
return -1

phpBool() public method

Change a parameter from 't' or 'f' to a boolean, (others evaluate to false)
public phpBool ( $parameter )
$parameter the parameter

printField() public method

Outputs the HTML code for a particular field
public printField ( $name, $value, $type, $extras = [] )
$name The name to give the field
$value The value of the field. Note this could be 'numeric(7,2)' sort of thing...
$type The database type of the field
$extras An array of attributes name as key and attributes' values as value

reindex() public method

Rebuild indexes
public reindex ( $type, $name, $force = false )
$type 'DATABASE' or 'TABLE' or 'INDEX'
$name The name of the specific database, table, or index to be reindexed
$force If true, recreates indexes forcedly in PostgreSQL 7.0-7.1, forces rebuild of system indexes in 7.2-7.3, ignored in >=7.4

renameAggregate() public method

Renames an aggregate function
public renameAggregate ( $aggrschema, $aggrname, $aggrtype, $newaggrname )
$aggrname The actual name of the aggregate
$aggrtype The actual input data type of the aggregate
$newaggrname The new name of the aggregate

renameColumn() public method

Renames a column in a table
public renameColumn ( $table, $column, $newName )
$table The table containing the column to be renamed
$column The column to be renamed
$newName The new name for the column

renameRole() public method

Renames a role
public renameRole ( $rolename, $newrolename )
$rolename The name of the role to rename
$newrolename The new name of the role

renameUser() public method

Renames a user
public renameUser ( $username, $newname )
$username The username of the user to rename
$newname The new name of the user

resetSequence() public method

Resets a given sequence to min value of sequence
public resetSequence ( $sequence ) : -1
$sequence Sequence name
return -1

restartSequence() public method

Restart a given sequence to its start value
public restartSequence ( $sequence ) : -1
$sequence Sequence name
return -1

revokeRole() public method

Revokes membership in a role
public revokeRole ( $role, $rolename, $admin, $type = 'RESTRICT' )
$role The name of the target role
$rolename The name of the role that will not belong to the target role
$admin (optional) Flag to revoke only the admin option
$type (optional) Type of revoke: RESTRICT | CASCADE

saveAutovacuum() public method

Returns all available autovacuum per table information.
public saveAutovacuum ( $table, $vacenabled, $vacthreshold, $vacscalefactor, $anathresold, $anascalefactor, $vaccostdelay, $vaccostlimit ) : A
return A recordset

sendSignal() public method

Sends a cancel or kill command to a process
public sendSignal ( $pid, $signal ) : -1
$pid The ID of the backend process
$signal 'CANCEL'
return -1

setColumnDefault() public method

Sets default value of a column
public setColumnDefault ( $table, $column, $default )
$table The table from which to drop
$column The column name to set
$default The new default value

setColumnNull() public method

Sets whether or not a column can contain NULLs
public setColumnNull ( $table, $column, $state )
$table The table that contains the column
$column The column to alter
$state True to set null, false to set not null

setComment() public method

Sets the comment for an object in the database
public setComment ( $obj_type, $obj_name, $table, $comment, $basetype = NULL )
$obj_type One of 'TABLE' | 'COLUMN' | 'VIEW' | 'SCHEMA' | 'SEQUENCE' | 'TYPE' | 'FUNCTION' | 'AGGREGATE'
$obj_name The name of the object for which to attach a comment.
$table Name of table that $obj_name belongs to. Ignored unless $obj_type is 'TABLE' or 'COLUMN'.
$comment The comment to add.

setFunction() public method

Updates (replaces) a function.
public setFunction ( $function_oid, $funcname, $newname, $args, $returns, $definition, $language, $flags, $setof, $funcown, $newown, $funcschema, $newschema, $cost, $rows, $comment ) : -7
$function_oid The OID of the function
$funcname The name of the function to create
$newname The new name for the function
$args The array of argument types
$returns The return type
$definition The definition for the new function
$language The language the function is written for
$flags An array of optional flags
$setof True if returns a set, false otherwise
$comment The comment on the function
return -7

setPrivileges() public method

Grants a privilege to a user, group or public
public setPrivileges ( $mode, $type, $object, $public, $usernames, $groupnames, $privileges, $grantoption, $cascade, $table ) : -4
$mode 'GRANT' or 'REVOKE';
$type The type of object
$object The name of the object
$public True to grant to public, false otherwise
$usernames The array of usernames to grant privs to.
$groupnames The array of group names to grant privs to.
$privileges The array of privileges to grant (eg. ('SELECT', 'ALL PRIVILEGES', etc.) )
$grantoption True if has grant option, false otherwise
$cascade True for cascade revoke, false otherwise
$table the column's table if type=column
return -4

setRenameRole() public method

Adjusts a role's info and renames it
public setRenameRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold, $newrolename ) : -3
$rolename The name of the role to adjust
$password A password for the role
$superuser Boolean whether or not the role is a superuser
$createdb Boolean whether or not the role can create databases
$createrole Boolean whether or not the role can create other roles
$inherits Boolean whether or not the role inherits the privileges from parent roles
$login Boolean whether or not the role will be allowed to login
$connlimit Number of concurrent connections the role can make
$expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire
$memberof (array) Roles to which the role will be immediately added as a new member
$members (array) Roles which are automatically added as members of the role
$adminmembers (array) Roles which are automatically added as admin members of the role
$memberofold (array) Original roles whose the role belongs to
$membersold (array) Original roles that are members of the role
$adminmembersold (array) Original roles that are admin members of the role
$newrolename The new name of the role
return -3

setRenameUser() public method

Adjusts a user's info and renames the user
public setRenameUser ( $username, $password, $createdb, $createuser, $expiry, $newname ) : -3
$username The username of the user to modify
$password A new password for the user
$createdb boolean Whether or not the user can create databases
$createuser boolean Whether or not the user can create other users
$expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire.
$newname The new name of the user
return -3

setRole() public method

Adjusts a role's info
public setRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold )
$rolename The name of the role to adjust
$password A password for the role
$superuser Boolean whether or not the role is a superuser
$createdb Boolean whether or not the role can create databases
$createrole Boolean whether or not the role can create other roles
$inherits Boolean whether or not the role inherits the privileges from parent roles
$login Boolean whether or not the role will be allowed to login
$connlimit Number of concurrent connections the role can make
$expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire
$memberof (array) Roles to which the role will be immediately added as a new member
$members (array) Roles which are automatically added as members of the role
$adminmembers (array) Roles which are automatically added as admin members of the role
$memberofold (array) Original roles whose the role belongs to
$membersold (array) Original roles that are members of the role
$adminmembersold (array) Original roles that are admin members of the role

setRule() public method

Edits a rule on a table OR view
public setRule ( $name, $event, $table, $where, $instead, $type, $action ) : -1
$name The name of the new rule
$event SELECT, INSERT, UPDATE or DELETE
$table Table on which to create the rule
$where When to execute the rule, '' indicates always
$instead True if an INSTEAD rule, false otherwise
$type NOTHING for a do nothing rule, SOMETHING to use given action
$action The action to take
return -1

setSchema() public method

Sets the current working schema. Will also set Class variable.
public setSchema ( $schema )
$schema The the name of the schema to work in

setSearchPath() public method

Sets the current schema search path
public setSearchPath ( $paths ) : -2
$paths An array of schemas in required search order
return -2

setUser() public method

Adjusts a user's info
public setUser ( $username, $password, $createdb, $createuser, $expiry )
$username The username of the user to modify
$password A new password for the user
$createdb boolean Whether or not the user can create databases
$createuser boolean Whether or not the user can create other users
$expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire.

setView() public method

Updates a view.
public setView ( $viewname, $definition, $comment ) : -3
$viewname The name fo the view to update
$definition The new definition for the view
return -3

setvalSequence() public method

Execute setval on a given sequence
public setvalSequence ( $sequence, $nextvalue ) : -1
$sequence Sequence name
$nextvalue The next value
return -1

updateFtsConfiguration() public method

Alters FTS configuration
public updateFtsConfiguration ( $cfgname, $comment, $name )
$cfgname The conf's name
$comment A comment on for the conf
$name The new conf name

updateFtsDictionary() public method

Alters FTS dictionary or dictionary template
public updateFtsDictionary ( $dictname, $comment, $name )
$dictname The dico's name
$comment The comment
$name The new dico's name

updateSchema() public method

Updates a schema.
public updateSchema ( $schemaname, $comment, $name, $owner )
$schemaname The name of the schema to drop
$comment The new comment for this schema
$owner The new owner for this schema

vacuumDB() public method

Vacuums a database
public vacuumDB ( $table = '', $analyze = false, $full = false, $freeze = false )
$table The table to vacuum
$analyze If true, also does analyze
$full If true, selects "full" vacuum
$freeze If true, selects aggressive "freezing" of tuples

Property Details

$_maxNameLen public_oe property

Max object name length
public $_maxNameLen

$_schema public_oe property

Store the current schema
public $_schema

$codemap public_oe property

encoding name is the same as its database encoding name.
public $codemap

$defaultprops public_oe property

public $defaultprops

$extraTypes public_oe property

Extra "magic" types. BIGSERIAL was added in PostgreSQL 7.2.
public $extraTypes

$fkactions public_oe property

Foreign key stuff. First element MUST be the default.
public $fkactions

$fkdeferrable public_oe property

public $fkdeferrable

$fkinitial public_oe property

public $fkinitial

$fkmatches public_oe property

public $fkmatches

$funcprops public_oe property

Function properties
public $funcprops

$help_base public_oe property

Default help URL
public $help_base

$help_page public_oe property

Help sub pages
public $help_page

$id public_oe property

Name of id column
public $id

$joinOps public_oe property

Supported join operations for use with view wizard
public $joinOps

$langmap public_oe property

Map of internal language name to syntax highlighting name
public $langmap

$major_version public_oe property

public $major_version

$predefined_size_types public_oe property

Predefined size types
public $predefined_size_types

$privlist public_oe property

of objects.
public $privlist

$privmap public_oe property

refer to.
public $privmap

$rule_events public_oe property

Rule action types
public $rule_events

$selectOps public_oe property

Select operators
public $selectOps

$triggerEvents public_oe property

Array of allowed trigger events
public $triggerEvents

$triggerExecTimes public_oe property

When to execute the trigger
public $triggerExecTimes

$triggerFrequency public_oe property

How often to execute the trigger
public $triggerFrequency

$typAlignDef public_oe property

The default type alignment
public $typAlignDef

$typAligns public_oe property

Array of allowed type alignments
public $typAligns

$typIndexDef public_oe property

Default index type
public $typIndexDef

$typIndexes public_oe property

Array of allowed index types
public $typIndexes

$typStorageDef public_oe property

The default type storage
public $typStorageDef

$typStorages public_oe property

Array of allowed type storage attributes
public $typStorages