protected function getDsn()
    {
        $dsn = sprintf('%s:', $this->database_driver);

        switch($this->database_driver) {
            case self::SI_DRIVER_SQLITE3:
                $dsn .= $this->database_file;
                break;

            case self::SI_DRIVER_MYSQL:
            case self::SI_DRIVER_PGSQL:
                if (empty($this->database_host)) {
                    throw new Exception('Securimage::database_host is not set');
                } else if (empty($this->database_name)) {
                    throw new Exception('Securimage::database_name is not set');
                }

                $dsn .= sprintf('host=%s;dbname=%s',
                                $this->database_host,
                                $this->database_name);
                break;

        }

        return $dsn;
    }
protected function getDsn()
    {
        $dsn = sprintf('%s:', $this->database_driver);

        switch($this->database_driver) {
            case self::SI_DRIVER_SQLITE3:
                $dsn .= $this->database_file;
                break;

            case self::SI_DRIVER_MYSQL:
            case self::SI_DRIVER_PGSQL:
                if (empty($this->database_host)) {
                    throw new Exception('Securimage::database_host is not set');
                } else if (empty($this->database_name)) {
                    throw new Exception('Securimage::database_name is not set');
                }

                $dsn .= sprintf('host=%s;dbname=%s',
                                $this->database_host,
                                $this->database_name);
                break;

        }

        return $dsn;
    }
protected function getDsn ( ) { $ dsn = sprintf ( '%s:' , $ this -> database_driver ) ; switch ( $ this -> database_driver ) { case self :: SI_DRIVER_SQLITE3 : $ dsn .= $ this -> database_file ; break ; case self :: SI_DRIVER_MYSQL : case self :: SI_DRIVER_PGSQL : if ( empty ( $ this -> database_host ) ) { throw new Exception ( 'Securimage::database_host is not set' ) ; } else if ( empty ( $ this -> database_name ) ) { throw new Exception ( 'Securimage::database_name is not set' ) ; } $ dsn .= sprintf ( 'host=%s;dbname=%s' , $ this -> database_host , $ this -> database_name ) ; break ; } return $ dsn ; }
Get the PDO DSN string for connecting to the database

@see Securimage::$database_driver Database driver
@throws Exception  If database specific options are not configured
@return string     The DSN for connecting to the database
Get the PDO DSN string for connecting to the database