JDatabaseFactory

Joomla Platform Database Factory class

since

12.1

package

Joomla.Platform

Methods

getDriver

Method to return a JDatabaseDriver instance based on the given options. There are three global options and then the rest are specific to the database driver. 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.

getDriver(string $name = 'mysqli', array $options = array()) : \JDatabaseDriver

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.

since

12.1

throws

\RuntimeException

Arguments

$name

stringName of the database driver you'd like to instantiate

$options

arrayParameters to be passed to the database driver.

Response

\JDatabaseDriverA database driver object.

getExporter

Gets an exporter class object.

getExporter(string $name, \JDatabaseDriver $db = null) : \JDatabaseExporter
since

12.1

throws

\RuntimeException

Arguments

$name

stringName of the driver you want an exporter for.

$db

\JDatabaseDriverOptional JDatabaseDriver instance

Response

\JDatabaseExporterAn exporter object.

getImporter

Gets an importer class object.

getImporter(string $name, \JDatabaseDriver $db = null) : \JDatabaseImporter
since

12.1

throws

\RuntimeException

Arguments

$name

stringName of the driver you want an importer for.

$db

\JDatabaseDriverOptional JDatabaseDriver instance

Response

\JDatabaseImporterAn importer object.

getInstance

Gets an instance of the factory object.

getInstance() : \JDatabaseFactory
static
since

12.1

Response

\JDatabaseFactory

getQuery

Get the current query object or a new JDatabaseQuery object.

getQuery(string $name, \JDatabaseDriver $db = null) : \JDatabaseQuery
since

12.1

throws

\RuntimeException

Arguments

$name

stringName of the driver you want an query object for.

$db

\JDatabaseDriverOptional JDatabaseDriver instance

Response

\JDatabaseQueryThe current query object or a new object extending the JDatabaseQuery class.

setInstance

Gets an instance of a factory object to return on subsequent calls of getInstance.

setInstance(\JDatabaseFactory $instance = null) : void
static
since

12.1

Arguments

$instance

\JDatabaseFactoryA JDatabaseFactory object.

Properties

_instance

Contains the current JDatabaseFactory instance

static