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

namespace Doctrine\DBAL;

5 6 7
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;

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

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

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

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

    /**
Benjamin Morel's avatar
Benjamin Morel committed
50 51 52
     * Gets the name of the database connected to for this driver.
     *
     * @return string The name of the database.
53
     */
54
    public function getDatabase(Connection $conn);
Benjamin Eberlei's avatar
Benjamin Eberlei committed
55
}