Driver.php 1.63 KB
Newer Older
1
<?php
2 3 4

namespace Doctrine\DBAL;

5 6 7 8 9 10
/**
 * Driver interface.
 * Interface that all DBAL drivers must implement.
 *
 * @since 2.0
 */
11
interface Driver
12 13 14 15 16 17 18 19
{
    /**
     * Attempts to create a connection with the database.
     *
     * @param array $params All connection parameters passed by the user.
     * @param string $username The username to use when connecting.
     * @param string $password The password to use when connecting.
     * @param array $driverOptions The driver options to use when connecting.
20
     * @return Doctrine\DBAL\Driver\Connection The database connection.
21 22
     */
    public function connect(array $params, $username = null, $password = null, array $driverOptions = array());
23

24 25 26 27
    /**
     * Gets the DatabasePlatform instance that provides all the metadata about
     * the platform this driver connects to.
     *
28
     * @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
29 30
     */
    public function getDatabasePlatform();
31

32 33 34 35
    /**
     * Gets the SchemaManager that can be used to inspect and change the underlying
     * database schema of the platform this driver connects to.
     *
36
     * @param  Doctrine\DBAL\Connection $conn
37
     * @return Doctrine\DBAL\SchemaManager
38
     */
39
    public function getSchemaManager(Connection $conn);
40 41

    /**
42
     * Gets the name of the driver.
43
     *
44
     * @return string The name of the driver.
45 46
     */
    public function getName();
47 48 49 50 51 52 53 54

    /**
     * Get the name of the database connected to for this driver instance
     *
     * @param  Doctrine\DBAL\Connection $conn
     * @return string $database
     */
    public function getDatabase(\Doctrine\DBAL\Connection $conn);
55
}