SqlServerBuilder.php
TLDR
This file, SqlServerBuilder.php
, is a part of the Illuminate\Database\Schema
namespace in the Demo Projects
project. It contains the SqlServerBuilder
class which extends the Builder
class. The SqlServerBuilder
class provides methods for creating and dropping databases, tables, and views, as well as retrieving all tables and views in the database.
Methods
createDatabase
This method creates a new database in the schema.
dropDatabaseIfExists
This method drops a database from the schema if it exists.
dropAllTables
This method drops all tables from the database.
dropAllViews
This method drops all views from the database.
getAllTables
This method retrieves all tables in the database. (deprecated)
getAllViews
This method retrieves all views in the database. (deprecated)
<?php
namespace Illuminate\Database\Schema;
class SqlServerBuilder extends Builder
{
/**
* Create a database in the schema.
*
* @param string $name
* @return bool
*/
public function createDatabase($name)
{
return $this->connection->statement(
$this->grammar->compileCreateDatabase($name, $this->connection)
);
}
/**
* Drop a database from the schema if the database exists.
*
* @param string $name
* @return bool
*/
public function dropDatabaseIfExists($name)
{
return $this->connection->statement(
$this->grammar->compileDropDatabaseIfExists($name)
);
}
/**
* Drop all tables from the database.
*
* @return void
*/
public function dropAllTables()
{
$this->connection->statement($this->grammar->compileDropAllForeignKeys());
$this->connection->statement($this->grammar->compileDropAllTables());
}
/**
* Drop all views from the database.
*
* @return void
*/
public function dropAllViews()
{
$this->connection->statement($this->grammar->compileDropAllViews());
}
/**
* Drop all tables from the database.
*
* @deprecated Will be removed in a future Laravel version.
*
* @return array
*/
public function getAllTables()
{
return $this->connection->select(
$this->grammar->compileGetAllTables()
);
}
/**
* Get all of the view names for the database.
*
* @deprecated Will be removed in a future Laravel version.
*
* @return array
*/
public function getAllViews()
{
return $this->connection->select(
$this->grammar->compileGetAllViews()
);
}
}