master

laravel/framework

Last updated at: 29/12/2023 09:22

SqlServerDriver.php

TLDR

This file defines the SqlServerDriver class, which extends AbstractSQLServerDriver. It provides a method connect to create a new database connection and a method getName to get the driver name.

Methods

connect

This method creates a new database connection. It takes an array of parameters as input and returns an instance of SqlServerConnection.

getName

This method returns the name of the driver, which is 'pdo_sqlsrv'.

<?php

namespace Illuminate\Database\PDO;

use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
use Doctrine\DBAL\Driver\Connection as ConnectionContract;

class SqlServerDriver extends AbstractSQLServerDriver
{
    /**
     * Create a new database connection.
     *
     * @param  mixed[]  $params
     * @return \Illuminate\Database\PDO\SqlServerConnection
     */
    public function connect(array $params): ConnectionContract
    {
        return new SqlServerConnection(
            new Connection($params['pdo'])
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'pdo_sqlsrv';
    }
}