MINOR phpDoc of MSSQLDatabase methods

This commit is contained in:
Sean Harvey 2009-07-20 09:09:53 +00:00
parent b6a0c4f8a4
commit 8b3f4f9963

View File

@ -42,6 +42,12 @@ class MSSQLDatabase extends Database {
*/ */
private $lastAffectedRows; private $lastAffectedRows;
/**
* The version of MSSQL
* @var float
*/
private $mssqlVersion;
/** /**
* Words that will trigger an error if passed to a SQL Server fulltext search * Words that will trigger an error if passed to a SQL Server fulltext search
*/ */
@ -127,6 +133,7 @@ class MSSQLDatabase extends Database {
if(!$result) $this->query("CREATE FULLTEXT CATALOG ftCatalog AS DEFAULT;"); if(!$result) $this->query("CREATE FULLTEXT CATALOG ftCatalog AS DEFAULT;");
} }
} }
/** /**
* Not implemented, needed for PDO * Not implemented, needed for PDO
*/ */
@ -142,12 +149,6 @@ class MSSQLDatabase extends Database {
return true; return true;
} }
/**
* The version of MSSQL
* @var float
*/
private $mssqlVersion;
/** /**
* Get the version of MSSQL. * Get the version of MSSQL.
* NOTE: not yet implemented for MSSQL, we just return 2008; the minimum supported version * NOTE: not yet implemented for MSSQL, we just return 2008; the minimum supported version
@ -222,9 +223,7 @@ class MSSQLDatabase extends Database {
/** /**
* OBSOLETE: Get the ID for the next new record for the table. * OBSOLETE: Get the ID for the next new record for the table.
* * @param string $table The name of the table
* @var string $table The name od the table.
*
* @return int * @return int
*/ */
public function getNextID($table) { public function getNextID($table) {
@ -237,9 +236,8 @@ class MSSQLDatabase extends Database {
return $this->active ? true : false; return $this->active ? true : false;
} }
/* /**
* TODO: test this, as far as I know we haven't got the create method working... * Create the database that is currently selected.
* 4th Jun 09 / Tom Rix - worked for me
*/ */
public function createDatabase() { public function createDatabase() {
$this->query("CREATE DATABASE \"$this->database\""); $this->query("CREATE DATABASE \"$this->database\"");
@ -266,7 +264,11 @@ class MSSQLDatabase extends Database {
/** /**
* Switches to the given database. * Switches to the given database.
* If the database doesn't exist, you should call createDatabase() after calling selectDatabase() *
* If the database doesn't exist, you should call
* createDatabase() after calling selectDatabase()
*
* @param string $dbname The database name to switch to
*/ */
public function selectDatabase($dbname) { public function selectDatabase($dbname) {
$this->database = $dbname; $this->database = $dbname;
@ -286,7 +288,8 @@ class MSSQLDatabase extends Database {
} }
/** /**
* Returns true if the named database exists. * Check if the given database exists.
* @param string $name Name of database to check exists
* @return boolean * @return boolean
*/ */
public function databaseExists($name) { public function databaseExists($name) {
@ -393,16 +396,18 @@ class MSSQLDatabase extends Database {
} }
} }
/* /**
* This is a private MSSQL-only function which returns specific details about a column's constraints (if any) * This is a private MSSQL-only function which returns
* specific details about a column's constraints (if any)
* @param string $tableName Name of table the column exists in
* @param string $columnName Name of column to check for
*/ */
private function ColumnConstraints($tableName, $columnName){ private function ColumnConstraints($tableName, $columnName) {
$constraint=$this->query("SELECT CC.CONSTRAINT_NAME, CAST(CHECK_CLAUSE AS TEXT) AS CHECK_CLAUSE, COLUMN_NAME FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS AS CC INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS CCU ON CCU.CONSTRAINT_NAME=CC.CONSTRAINT_NAME WHERE TABLE_NAME='$tableName' AND COLUMN_NAME='" . $columnName . "';")->first(); $constraint = $this->query("SELECT CC.CONSTRAINT_NAME, CAST(CHECK_CLAUSE AS TEXT) AS CHECK_CLAUSE, COLUMN_NAME FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS AS CC INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS CCU ON CCU.CONSTRAINT_NAME=CC.CONSTRAINT_NAME WHERE TABLE_NAME='$tableName' AND COLUMN_NAME='" . $columnName . "';")->first();
return $constraint; return $constraint;
} }
/* /**
* Get the actual enum fields from the constraint value: * Get the actual enum fields from the constraint value:
*/ */
private function EnumValuesFromConstraint($constraint){ private function EnumValuesFromConstraint($constraint){
@ -1096,10 +1101,11 @@ class MSSQLDatabase extends Database {
} }
/** /**
* The core search engine, used by this class and its subclasses to do fun stuff. * The core search engine configuration.
* Searches both SiteTree and File. * @todo There is no result relevancy or ordering as it currently stands.
* *
* @param string $keywords Keywords as a string. * @param string $keywords Keywords as a space separated string
* @return object DataObjectSet of result pages
*/ */
public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC", $extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false) { public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC", $extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false) {
if($this->fullTextEnabled) { if($this->fullTextEnabled) {