[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/ -> DatabaseDriver.php (summary)

Part of the Joomla Framework Database Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 2024 lines (45 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 58 functions

  getConnectors()
  getInstance()
  splitSql()
  __get()
  __construct()
  __destruct()
  alterDbCharacterSet()
  createDatabase()
  disconnect()
  dispatchEvent()
  dropTable()
  execute()
  fetchArray()
  fetchAssoc()
  fetchObject()
  freeResult()
  getAffectedRows()
  getConnection()
  getCount()
  getAlterDbCharacterSet()
  getCreateDatabaseQuery()
  getDatabase()
  getDateFormat()
  getMinimum()
  getName()
  getNumRows()
  getServerType()
  getNullDate()
  getPrefix()
  getExporter()
  getImporter()
  getQuery()
  getIterator()
  hasUtfSupport()
  insertObject()
  isMinimumVersion()
  loadAssoc()
  loadAssocList()
  loadColumn()
  loadObject()
  loadObjectList()
  loadResult()
  loadRow()
  loadRowList()
  q()
  quote()
  quoteBinary()
  decodeBinary()
  qn()
  quoteName()
  quoteNameString()
  quoteNameStr()
  replacePrefix()
  getMonitor()
  setMonitor()
  setQuery()
  truncateTable()
  updateObject()

Functions
Functions that are not part of a class:

getConnectors()   X-Ref
Get a list of available database connectors.

The list will only be populated with connectors that the class exists for and the environment supports its use.
This gives us the ability to have a multitude of connector classes that are self-aware as to whether or not they
are able to be used on a given system.

return: array  An array of available database connectors.

getInstance(array $options = [])   X-Ref
Method to return a DatabaseDriver instance based on the given options.

There are three global options and then the rest are specific to the database driver.

- The 'driver' option defines which DatabaseDriver class is used for the connection -- the default is 'mysqli'.
- The 'database' option determines which database is to be used for the connection.
- The 'select' option determines whether the connector should automatically select the chosen database.

Instances are unique to the given options and new objects are only created when a unique options array is
passed into the method.  This ensures that we don't end up with unnecessary database connection resources.

param: array  $options  Parameters to be passed to the database driver.
return: DatabaseDriver

splitSql($sql)   X-Ref
Splits a string of multiple queries into an array of individual queries.

param: string  $sql  Input SQL string with which to split into individual queries.
return: array

__get($name)   X-Ref
Magic method to access properties of the database driver.

param: string  $name  The name of the property.
return: mixed   A value if the property name is valid, null otherwise.

__construct(array $options)   X-Ref
Constructor.

param: array  $options  List of options used to configure the connection

__destruct()   X-Ref
Destructor.


alterDbCharacterSet($dbName)   X-Ref
Alter database's character set.

param: string  $dbName  The database name that will be altered
return: boolean|resource

createDatabase($options, $utf = true)   X-Ref
Create a new database using information from $options object.

param: \stdClass  $options  Object used to pass user and database name to database driver. This object must have "db_name" and "db_user" set.
param: boolean    $utf      True if the database supports the UTF-8 character set.
return: boolean|resource

disconnect()   X-Ref
Disconnects the database.

return: void

dispatchEvent(EventInterface $event)   X-Ref
Dispatch an event.

param: EventInterface  $event  The event to dispatch
return: void

dropTable($table, $ifExists = true)   X-Ref
Drops a table from the database.

param: string   $table     The name of the database table to drop.
param: boolean  $ifExists  Optionally specify that the table must exist before it is dropped.
return: $this

execute()   X-Ref
Execute the SQL statement.

return: boolean

fetchArray()   X-Ref
Method to fetch a row from the result set cursor as an array.

return: mixed  Either the next row from the result set or false if there are no more rows.

fetchAssoc()   X-Ref
Method to fetch a row from the result set cursor as an associative array.

return: mixed  Either the next row from the result set or false if there are no more rows.

fetchObject()   X-Ref
Method to fetch a row from the result set cursor as an object.

Note, the fetch mode should be configured before calling this method using `StatementInterface::setFetchMode()`.

return: mixed   Either the next row from the result set or false if there are no more rows.

freeResult()   X-Ref
Method to free up the memory used for the result set.

return: void

getAffectedRows()   X-Ref
Get the number of affected rows for the previous executed SQL statement.

return: integer  The number of affected rows in the previous operation

getConnection()   X-Ref
Method that provides access to the underlying database connection.

return: resource  The underlying database connection resource.

getCount()   X-Ref
Get the total number of SQL statements executed by the database driver.

return: integer

getAlterDbCharacterSet($dbName)   X-Ref
Return the query string to alter the database character set.

param: string  $dbName  The database name
return: string  The query that alter the database query string

getCreateDatabaseQuery($options, $utf)   X-Ref
Return the query string to create new Database.

param: stdClass  $options  Object used to pass user and database name to database driver. This object must have "db_name" and "db_user" set.
param: boolean   $utf      True if the database supports the UTF-8 character set.
return: string  The query that creates database

getDatabase()   X-Ref
Gets the name of the database used by this connection.

return: string

getDateFormat()   X-Ref
Returns a PHP date() function compliant date format for the database driver.

return: string

getMinimum()   X-Ref
Get the minimum supported database version.

return: string

getName()   X-Ref
Get the name of the database driver.

If $this->name is not set it will try guessing the driver name from the class name.

return: string

getNumRows()   X-Ref
Get the number of returned rows for the previous executed SQL statement.

return: integer   The number of returned rows.

getServerType()   X-Ref
Get the server family type.

If $this->serverType is not set it will attempt guessing the server family type from the driver name. If this is not possible the driver
name will be returned instead.

return: string

getNullDate()   X-Ref
Get the null or zero representation of a timestamp for the database driver.

return: string

getPrefix()   X-Ref
Get the common table prefix for the database driver.

return: string  The common database table prefix.

getExporter()   X-Ref
Gets an exporter class object.

return: DatabaseExporter  An exporter object.

getImporter()   X-Ref
Gets an importer class object.

return: DatabaseImporter

getQuery($new = false)   X-Ref
Get the current query object or a new DatabaseQuery object.

param: boolean  $new  False to return the current query object, True to return a new DatabaseQuery object.
return: DatabaseQuery

getIterator($column = null, $class = \stdClass::class)   X-Ref
Get a new iterator on the current query.

param: string  $column  An option column to use as the iterator key.
param: string  $class   The class of object that is returned.
return: DatabaseIterator

hasUtfSupport()   X-Ref
Determine whether or not the database engine supports UTF-8 character encoding.

return: boolean  True if the database engine supports UTF-8 character encoding.

insertObject($table, &$object, $key = null)   X-Ref
Inserts a row into a table based on an object's properties.

param: string  $table   The name of the database table to insert into.
param: object  $object  A reference to an object whose public properties match the table fields.
param: string  $key     The name of the primary key. If provided the object property is updated.
return: boolean

isMinimumVersion()   X-Ref
Method to check whether the installed database version is supported by the database driver

return: boolean  True if the database version is supported

loadAssoc()   X-Ref
Method to get the first row of the result set from the database query as an associative array of ['field_name' => 'row_value'].

return: mixed  The return value or null if the query failed.

loadAssocList($key = null, $column = null)   X-Ref
Method to get an array of the result set rows from the database query where each row is an associative array
of ['field_name' => 'row_value'].  The array of rows can optionally be keyed by a field name, but defaults to
a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field name can result in unwanted
behavior and should be avoided.

param: string  $key     The name of a field on which to key the result array.
param: string  $column  An optional column name. Instead of the whole row, only this column value will be in
return: mixed   The return value or null if the query failed.

loadColumn($offset = 0)   X-Ref
Method to get an array of values from the <var>$offset</var> field in each row of the result set from the database query.

param: integer  $offset  The row offset to use to build the result array.
return: mixed  The return value or null if the query failed.

loadObject($class = \stdClass::class)   X-Ref
Method to get the first row of the result set from the database query as an object.

param: string  $class  The class name to use for the returned row object.
return: mixed  The return value or null if the query failed.

loadObjectList($key = '', $class = \stdClass::class)   X-Ref
Method to get an array of the result set rows from the database query where each row is an object.  The array
of objects can optionally be keyed by a field name, but defaults to a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field name can result in unwanted behavior and should be avoided.

param: string  $key    The name of a field on which to key the result array.
param: string  $class  The class name to use for the returned row objects.
return: mixed  The return value or null if the query failed.

loadResult()   X-Ref
Method to get the first field of the first row of the result set from the database query.

return: mixed  The return value or null if the query failed.

loadRow()   X-Ref
Method to get the first row of the result set from the database query as an array.

Columns are indexed numerically so the first column in the result set would be accessible via <var>$row[0]</var>, etc.

return: mixed  The return value or null if the query failed.

loadRowList($key = null)   X-Ref
Method to get an array of the result set rows from the database query where each row is an array.  The array
of objects can optionally be keyed by a field offset, but defaults to a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field can result in unwanted behavior and should be avoided.

param: string  $key  The name of a field on which to key the result array.
return: array   An array of results.

q($text, $escape = true)   X-Ref
Alias for quote method

param: array|string  $text    A string or an array of strings to quote.
param: boolean       $escape  True (default) to escape the string, false to leave it unchanged.
return: string  The quoted input string.

quote($text, $escape = true)   X-Ref
Quotes and optionally escapes a string to database requirements for use in database queries.

param: array|string  $text    A string or an array of strings to quote.
param: boolean       $escape  True (default) to escape the string, false to leave it unchanged.
return: string  The quoted input string.

quoteBinary($data)   X-Ref
Quotes a binary string to database requirements for use in database queries.

param: string  $data  A binary string to quote.
return: string  The binary quoted input string.

decodeBinary($data)   X-Ref
Replace special placeholder representing binary field with the original string.

param: string|resource  $data  Encoded string or resource.
return: string  The original string.

qn($name, $as = null)   X-Ref
Alias for quoteName method

param: array|string  $name  The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes.
param: array|string  $as    The AS query part associated to $name. It can be string or array, in latter case it has to be
return: array|string  The quote wrapped name, same type of $name.

quoteName($name, $as = null)   X-Ref
Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection
risks and reserved word conflicts.

param: array|string  $name  The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes.
param: array|string  $as    The AS query part associated to $name. It can be string or array, in latter case it has to be
return: array|string  The quote wrapped name, same type of $name.

quoteNameString($name, $asSinglePart = false)   X-Ref
Quote string coming from quoteName call.

param: string   $name          Identifier name to be quoted.
param: boolean  $asSinglePart  Treat the name as a single part of the identifier.
return: string  Quoted identifier string.

quoteNameStr($strArr)   X-Ref
Quote strings coming from quoteName call.

param: array  $strArr  Array of strings coming from quoteName dot-explosion.
return: string  Dot-imploded string of quoted parts.

replacePrefix($sql, $prefix = ')   X-Ref
This function replaces a string identifier with the configured table prefix.

param: string  $sql     The SQL statement to prepare.
param: string  $prefix  The table prefix.
return: string  The processed SQL statement.

getMonitor()   X-Ref
Get the query monitor.

return: QueryMonitorInterface|null  The query monitor or null if not set.

setMonitor(QueryMonitorInterface $monitor = null)   X-Ref
Set a query monitor.

param: QueryMonitorInterface|null  $monitor  The query monitor.
return: $this

setQuery($query, $offset = 0, $limit = 0)   X-Ref
Sets the SQL statement string for later execution.

param: string|QueryInterface  $query   The SQL statement to set either as a Query object or a string.
param: integer                $offset  The affected row offset to set. {@deprecated 3.0 Use LimitableInterface::setLimit() instead}
param: integer                $limit   The maximum affected rows to set. {@deprecated 3.0 Use LimitableInterface::setLimit() instead}
return: $this

truncateTable($table)   X-Ref
Method to truncate a table.

param: string  $table  The table to truncate
return: void

updateObject($table, &$object, $key, $nulls = false)   X-Ref
Updates a row in a table based on an object's properties.

param: string        $table   The name of the database table to update.
param: object        $object  A reference to an object whose public properties match the table fields.
param: array|string  $key     The name of the primary key.
param: boolean       $nulls   True to update null fields or false to ignore them.
return: boolean  True on success.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer