Ejemplo n.º 1
0
 /**
  * Get SQLite Adapter DSN
  *
  * @return string
  *   SQLite Adapter DSN used by PDO Connection
  *
  * @throws Next\DB\Driver\DriverException
  *   Required <strong>Path</strong> or <strong>File</strong>
  *   parameters was not set in Connection Parameters
  */
 protected function getDSN()
 {
     if (!isset($this->options->dbPath) || empty($this->options->dbPath)) {
         throw DriverException::missingConnectionAdapterParameter('Missing DSN Path for SQLite Adapter');
     }
     return sprintf('sqlite:%s', $this->options->dbPath);
 }
Ejemplo n.º 2
0
 /**
  * Get MySQL Adapter DSN
  *
  * @return string
  *   MySQL Adapter DSN used by PDO Connection
  *
  * @throws Next\DB\Driver\DriverException
  *   Required <strong>Host</strong> or <strong>Database</strong>
  *   parameters was not set in Connection Parameters
  */
 protected function getDSN()
 {
     if (!isset($this->options->host) || empty($this->options->host)) {
         throw DriverException::missingConnectionAdapterParameter('Missing DSN Host for MySQL Adapter');
     }
     if (!isset($this->options->database) || empty($this->options->database)) {
         throw DriverException::missingConnectionAdapterParameter('Missing DSN Database for MySQL Adapter');
     }
     return sprintf('mysql:host=%s;dbname=%s', $this->options->host, $this->options->database);
 }