public function getResourceStream(DatabaseResource $resource): StreamInterface
    {
        switch ($this->conn->getDriverName()) {
            case DB::DRIVER_MYSQL:
            case DB::DRIVER_SQLITE:
                $stmt = $this->conn->prepare("SELECT `data` FROM `#__webdav_file_data` WHERE `resource_id` = :id ORDER BY `resource_id`, `chunk`");
                $stmt->bindValue('id', $resource->getIdentifier());
                $stmt->transform('data', new StreamTransformer());
                
                return new DatabaseOutputStream($stmt);
        }
        
        $stmt = $this->conn->prepare("SELECT `data` FROM `#__webdav_file_data` WHERE `resource_id` = :id");
        $stmt->bindValue('id', $resource->getIdentifier());
        $stmt->transform('data', new StreamTransformer());
        $stmt->execute();
        
        return $stmt->fetchNextColumn('data');
    }