public function Schema::functionExists in Drupal driver for SQL Server and SQL Azure 4.1.x
Same name and namespace in other branches
- 4.2.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::functionExists()
- 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::functionExists()
- 4.0.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::functionExists()
Find if a table function exists.
Parameters
string $function: Name of the function.
Return value
bool True if the function exists, false otherwise.
File
- src/
Driver/ Database/ sqlsrv/ Schema.php, line 1108
Class
Namespace
Drupal\sqlsrv\Driver\Database\sqlsrvCode
public function functionExists($function) {
// FN = Scalar Function
// IF = Inline Table Function
// TF = Table Function
// FS | AF = Assembly (CLR) Scalar Function
// FT | AT = Assembly (CLR) Table Valued Function.
return $this->connection
->queryDirect("SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('" . $function . "') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT', N'AF')")
->fetchField() !== FALSE;
}