public function DatabaseSchema_sqlsrv::functionExists in Drupal driver for SQL Server and SQL Azure 7
Same name and namespace in other branches
- 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::functionExists()
- 7.2 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::functionExists()
Find if a table function exists.
Parameters
$function: Name of the function.
Return value
True if the function exists, false otherwise.
File
- sqlsrv/
schema.inc, line 188 - Database schema code for Microsoft SQL Server database servers.
Class
Code
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
->query("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;
}