Driver.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * The usage of NULL to indicate empty username or password is deprecated. Use an empty string instead.
  15. *
  16. * @param mixed[] $params All connection parameters passed by the user.
  17. * @param string|null $username The username to use when connecting.
  18. * @param string|null $password The password to use when connecting.
  19. * @param mixed[] $driverOptions The driver options to use when connecting.
  20. *
  21. * @return \Doctrine\DBAL\Driver\Connection The database connection.
  22. */
  23. public function connect(array $params, $username = null, $password = null, array $driverOptions = []);
  24. /**
  25. * Gets the DatabasePlatform instance that provides all the metadata about
  26. * the platform this driver connects to.
  27. *
  28. * @return AbstractPlatform The database platform.
  29. */
  30. public function getDatabasePlatform();
  31. /**
  32. * Gets the SchemaManager that can be used to inspect and change the underlying
  33. * database schema of the platform this driver connects to.
  34. *
  35. * @return AbstractSchemaManager
  36. */
  37. public function getSchemaManager(Connection $conn);
  38. /**
  39. * Gets the name of the driver.
  40. *
  41. * @deprecated
  42. *
  43. * @return string The name of the driver.
  44. */
  45. public function getName();
  46. /**
  47. * Gets the name of the database connected to for this driver.
  48. *
  49. * @deprecated Use Connection::getDatabase() instead.
  50. *
  51. * @return string The name of the database.
  52. */
  53. public function getDatabase(Connection $conn);
  54. }