Driver.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Doctrine\DBAL;
  3. use Doctrine\DBAL\Platforms\AbstractPlatform;
  4. use Doctrine\DBAL\Schema\AbstractSchemaManager;
  5. /**
  6. * Driver interface.
  7. * Interface that all DBAL drivers must implement.
  8. */
  9. interface Driver
  10. {
  11. /**
  12. * Attempts to create a connection with the database.
  13. *
  14. * @param mixed[] $params All connection parameters passed by the user.
  15. * @param string|null $username The username to use when connecting.
  16. * @param string|null $password The password to use when connecting.
  17. * @param mixed[] $driverOptions The driver options to use when connecting.
  18. *
  19. * @return \Doctrine\DBAL\Driver\Connection The database connection.
  20. */
  21. public function connect(array $params, $username = null, $password = null, array $driverOptions = []);
  22. /**
  23. * Gets the DatabasePlatform instance that provides all the metadata about
  24. * the platform this driver connects to.
  25. *
  26. * @return AbstractPlatform The database platform.
  27. */
  28. public function getDatabasePlatform();
  29. /**
  30. * Gets the SchemaManager that can be used to inspect and change the underlying
  31. * database schema of the platform this driver connects to.
  32. *
  33. * @return AbstractSchemaManager
  34. */
  35. public function getSchemaManager(Connection $conn);
  36. /**
  37. * Gets the name of the driver.
  38. *
  39. * @return string The name of the driver.
  40. */
  41. public function getName();
  42. /**
  43. * Gets the name of the database connected to for this driver.
  44. *
  45. * @return string The name of the database.
  46. */
  47. public function getDatabase(Connection $conn);
  48. }