public
|
#
__construct( array $options )
Database object constructor
Database object constructor
Parameters
- $options
array - $options List of options used to configure the connection
Since
12.1
Overrides
|
public
|
#
__destruct( )
Database object destructor
Database object destructor
Since
12.1
|
public
|
#
connect( )
Connects to the database if needed.
Connects to the database if needed.
Returns
- Returns void if the database connected successfully.
Throws
Since
12.1
|
public
|
#
disconnect( )
Disconnects the database.
Disconnects the database.
Since
12.1
|
public
string
|
#
escape( string $text, boolean $extra = false )
Method to escape a string for usage in an SQL statement.
Method to escape a string for usage in an SQL statement.
Parameters
- $text
string - $text The string to be escaped.
- $extra
boolean - $extra Optional parameter to provide extra escaping.
Returns
string - The escaped string.
Since
12.1
|
public static
boolean
|
#
test( )
Test to see if the PostgreSQL connector is available
Test to see if the PostgreSQL connector is available
Returns
boolean - True on success, false otherwise.
Since
12.1
Overrides
|
public
boolean
|
#
connected( )
Determines if the connection to the server is active.
Determines if the connection to the server is active.
Returns
boolean
Since
12.1
|
public
boolean
|
#
dropTable( string $tableName, boolean $ifExists = true )
Drops a table from the database.
Drops a table from the database.
Parameters
- $tableName
string - $tableName The name of the database table to drop.
- $ifExists
boolean - $ifExists Optionally specify that the table must exist before it is dropped.
Returns
boolean
Throws
Since
12.1
|
public
integer
|
#
getAffectedRows( )
Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE
for the previous executed SQL statement.
Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE
for the previous executed SQL statement.
Returns
integer - The number of affected rows in the previous operation
Since
12.1
|
public
mixed
|
#
getCollation( )
Method to get the database collation in use by sampling a text field of a
table in the database.
Method to get the database collation in use by sampling a text field of a
table in the database.
Returns
mixed - The collation in use by the database or boolean false if not supported.
Throws
Since
12.1
|
public
string
|
#
getConnectionCollation( )
Method to get the database connection collation, as reported by the driver.
If the connector doesn't support reporting this value please return an empty
string.
Method to get the database connection collation, as reported by the driver.
If the connector doesn't support reporting this value please return an empty
string.
Returns
string
Overrides
|
public
integer
|
#
getNumRows( resource $cur = null )
Get the number of returned rows for the previous executed SQL statement. This
command is only valid for statements like SELECT or SHOW that return an actual
result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE
or DELETE query, use getAffectedRows().
Get the number of returned rows for the previous executed SQL statement. This
command is only valid for statements like SELECT or SHOW that return an actual
result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE
or DELETE query, use getAffectedRows().
Parameters
- $cur
resource - $cur An optional database cursor resource to extract the row count from.
Returns
integer - The number of returned rows.
Since
12.1
|
public
FOFDatabaseQuery
|
#
getQuery( boolean $new = false, boolean $asObj = false )
Get the current or query, or new FOFDatabaseQuery object.
Get the current or query, or new FOFDatabaseQuery object.
Parameters
- $new
boolean - $new False to return the last query set, True to return a new FOFDatabaseQuery
object.
- $asObj
boolean - $asObj False to return last query as string, true to get
FOFDatabaseQueryPostgresql object.
Returns
FOFDatabaseQuery
- The current query object or a new object extending the FOFDatabaseQuery class.
Throws
Since
12.1
Overrides
|
public
string
|
#
getTableCreate( mixed $tables )
Shows the table CREATE statement that creates the given tables.
Shows the table CREATE statement that creates the given tables.
This is unsuported by PostgreSQL.
Parameters
- $tables
mixed - $tables A table name or a list of table names.
Returns
string - An empty char because this function is not supported by PostgreSQL.
Throws
Since
12.1
|
public
array
|
#
getTableColumns( string $table, boolean $typeOnly = true )
Retrieves field information about a given table.
Retrieves field information about a given table.
Parameters
- $table
string - $table The name of the database table.
- $typeOnly
boolean - $typeOnly True to only return field types.
Returns
array - An array of fields for the database table.
Throws
Since
12.1
|
public
array
|
#
getTableKeys( string $table )
Get the details list of keys for a table.
Get the details list of keys for a table.
Parameters
- $table
string - $table The name of the table.
Returns
array - An array of the column specification for the table.
Throws
Since
12.1
|
public
array
|
#
getTableList( )
Method to get an array of all tables in the database.
Method to get an array of all tables in the database.
Returns
array - An array of all the tables in the database.
Throws
Since
12.1
|
public
array
|
#
getTableSequences( string $table )
Get the details list of sequences for a table.
Get the details list of sequences for a table.
Parameters
- $table
string - $table The name of the table.
Returns
array - An array of sequences specification for the table.
Throws
Since
12.1
|
public
string
|
#
getVersion( )
Get the version of the database connector.
Get the version of the database connector.
Returns
string - The database connector version.
Since
12.1
|
public
integer
|
#
insertid( )
Method to get the auto-incremented value from the last INSERT statement. To
be called after the INSERT statement, it's MANDATORY to have a sequence on every
primary key table.
Method to get the auto-incremented value from the last INSERT statement. To
be called after the INSERT statement, it's MANDATORY to have a sequence on every
primary key table.
To get the auto incremented value it's possible to call this function after
INSERT INTO query, or use INSERT INTO with RETURNING clause.
Returns
integer - The value of the auto-increment field from the last inserted row.
Since
12.1
Example
with insertid() call: $query = $this->getQuery(true)
->insert('jos_dbtest') ->columns('title,start_date,description')
->values("'testTitle2nd','1971-01-01','testDescription2nd'");
$this->setQuery($query); $this->execute(); $id = $this->insertid();
with RETURNING clause: $query = $this->getQuery(true)
->insert('jos_dbtest') ->columns('title,start_date,description')
->values("'testTitle2nd','1971-01-01','testDescription2nd'")
->returning('id'); $this->setQuery($query); $id = $this->loadResult();
|
public
FOFDatabaseDriverPostgresql
|
#
lockTable( string $tableName )
Locks a table in the database.
Locks a table in the database.
Parameters
- $tableName
string - $tableName The name of the table to unlock.
Returns
Throws
Since
12.1
|
public
mixed
|
#
execute( )
Execute the SQL statement.
Execute the SQL statement.
Returns
mixed - A database cursor resource on success, boolean false on failure.
Throws
Since
12.1
|
public
FOFDatabaseDriverPostgresql
|
#
renameTable( string $oldTable, string $newTable, string $backup = null, string $prefix = null )
Renames a table in the database.
Renames a table in the database.
Parameters
- $oldTable
string - $oldTable The name of the table to be renamed
- $newTable
string - $newTable The new name for the table.
- $backup
string - $backup Not used by PostgreSQL.
- $prefix
string - $prefix Not used by PostgreSQL.
Returns
Throws
Since
12.1
|
public
boolean
|
#
select( string $database )
Selects the database, but redundant for PostgreSQL
Selects the database, but redundant for PostgreSQL
Parameters
- $database
string - $database Database name to select.
Returns
boolean - Always true
Throws
Since
12.1
|
public
integer
|
#
setUtf( )
Custom settings for UTF support
Custom settings for UTF support
Returns
integer - Zero on success, -1 on failure
Since
12.1
|
public
string
|
#
sqlValue( array $columns, string $field_name, string $field_value )
This function return a field value as a prepared string to be used in a SQL
statement.
This function return a field value as a prepared string to be used in a SQL
statement.
Parameters
- $columns
array - $columns Array of table's column returned by ::getTableColumns.
- $field_name
string - $field_name The table field's name.
- $field_value
string - $field_value The variable value to quote and return.
Returns
string - The quoted string.
Since
12.1
|
public
|
#
transactionCommit( boolean $toSavepoint = false )
Method to commit a transaction.
Method to commit a transaction.
Parameters
- $toSavepoint
boolean - $toSavepoint If true, commit to the last savepoint.
Throws
Since
12.1
|
public
|
#
transactionRollback( boolean $toSavepoint = false )
Method to roll back a transaction.
Method to roll back a transaction.
Parameters
- $toSavepoint
boolean - $toSavepoint If true, rollback to the last savepoint.
Throws
Since
12.1
|
public
|
#
transactionStart( boolean $asSavepoint = false )
Method to initialize a transaction.
Method to initialize a transaction.
Parameters
- $asSavepoint
boolean - $asSavepoint If true and a transaction is already active, a savepoint will be
created.
Throws
Since
12.1
|
protected
mixed
|
#
fetchArray( mixed $cursor = null )
Method to fetch a row from the result set cursor as an array.
Method to fetch a row from the result set cursor as an array.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
Returns
mixed - Either the next row from the result set or false if there are no more rows.
Since
12.1
|
protected
mixed
|
#
fetchAssoc( mixed $cursor = null )
Method to fetch a row from the result set cursor as an associative array.
Method to fetch a row from the result set cursor as an associative array.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
Returns
mixed - Either the next row from the result set or false if there are no more rows.
Since
12.1
|
protected
mixed
|
#
fetchObject( mixed $cursor = null, string $class = 'stdClass' )
Method to fetch a row from the result set cursor as an object.
Method to fetch a row from the result set cursor as an object.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
- $class
string - $class The class name to use for the returned row object.
Returns
mixed - Either the next row from the result set or false if there are no more rows.
Since
12.1
|
protected
|
#
freeResult( mixed $cursor = null )
Method to free up the memory used for the result set.
Method to free up the memory used for the result set.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
Since
12.1
|
public
boolean
|
#
insertObject( string $table, object & $object, string $key = null )
Inserts a row into a table based on an object's properties.
Inserts a row into a table based on an object's properties.
Parameters
- $table
string - $table The name of the database table to insert into.
- $object
object - &$object A reference to an object whose public properties match the table
fields.
- $key
string - $key The name of the primary key. If provided the object property is updated.
Returns
boolean - True on success.
Throws
Since
12.1
Overrides
|
public static
boolean
|
#
isSupported( )
Test to see if the PostgreSQL connector is available.
Test to see if the PostgreSQL connector is available.
Returns
boolean - True on success, false otherwise.
Since
12.1
|
public
array
|
#
showTables( )
Returns an array containing database's table list.
Returns an array containing database's table list.
Returns
array - The database's table list.
Since
12.1
|
public
integer
|
#
getStringPositionSql( string $substring, string $string )
Get the substring position inside a string
Get the substring position inside a string
Parameters
- $substring
string - $substring The string being sought
- $string
string - $string The string/column being searched
Returns
integer - The position of $substring in $string
Since
12.1
|
public
float
|
#
getRandom( )
Generate a random value
Returns
float - The random generated number
Since
12.1
|
public
string
|
#
getAlterDbCharacterSet( string $dbName )
Get the query string to alter the database character set.
Get the query string to alter the database character set.
Parameters
- $dbName
string - $dbName The database name
Returns
string - The query that alter the database query string
Since
12.1
Overrides
|
public
string
|
#
getCreateDbQuery( object $options, boolean $utf )
Get the query string to create new Database in correct PostgreSQL syntax.
Get the query string to create new Database in correct PostgreSQL syntax.
Parameters
- $options
object - $options object coming from "initialise" function to pass user and database name
to database driver.
- $utf
boolean - $utf True if the database supports the UTF-8 character set, not used in
PostgreSQL "CREATE DATABASE" query.
Returns
string - The query that creates database, owned by $options['user']
Since
12.1
|
public
string
|
#
replacePrefix( string $query, string $prefix = '#__' )
This function replaces a string identifier $prefix with the string
held is the tablePrefix class variable.
This function replaces a string identifier $prefix with the string
held is the tablePrefix class variable.
Parameters
- $query
string - $query The SQL statement to prepare.
- $prefix
string - $prefix The common table prefix.
Returns
string - The processed SQL statement.
Since
12.1
Overrides
|
public
|
#
releaseTransactionSavepoint( string $savepointName )
Method to release a savepoint.
Method to release a savepoint.
Parameters
- $savepointName
string - $savepointName Savepoint's name to release
Since
12.1
|
public
|
#
transactionSavepoint( string $savepointName )
Method to create a savepoint.
Method to create a savepoint.
Parameters
- $savepointName
string - $savepointName Savepoint's name to create
Since
12.1
|
public
FOFDatabaseDriverPostgresql
|
#
unlockTables( )
Unlocks tables in the database, this command does not exist in PostgreSQL, it
is automatically done on commit or rollback.
Unlocks tables in the database, this command does not exist in PostgreSQL, it
is automatically done on commit or rollback.
Returns
Throws
Since
12.1
|
public
boolean
|
#
updateObject( string $table, object & $object, array $key, boolean $nulls = false )
Updates a row in a table based on an object's properties.
Updates a row in a table based on an object's properties.
Parameters
- $table
string - $table The name of the database table to update.
- $object
object - &$object A reference to an object whose public properties match the table
fields.
- $key
array - $key The name of the primary key.
- $nulls
boolean - $nulls True to update null fields or false to ignore them.
Returns
boolean - True on success.
Throws
Since
12.1
Overrides
|
protected
integer
|
#
getErrorNumber( )
Return the actual SQL Error number
Return the actual SQL Error number
Returns
integer - The SQL Error number
Since
3.4.6
|
protected
string
|
#
getErrorMessage( string $query )
Return the actual SQL Error message
Return the actual SQL Error message
Parameters
- $query
string - $query The SQL Query that fails
Returns
string - The SQL Error message
Since
3.4.6
|