mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
Upgrade code for core namespaces
This commit is contained in:
parent
551ccfd352
commit
da6cefac06
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
||||
use SilverStripe\MSSQL\MSSQLDatabaseConfigurationHelper;
|
||||
|
||||
// PDO connector for MS SQL Server
|
||||
/** @skipUpgrade */
|
||||
use SilverStripe\MSSQL\MSSQLDatabaseConfigurationHelper;
|
||||
|
||||
DatabaseAdapterRegistry::register(array(
|
||||
'class' => 'MSSQLPDODatabase',
|
||||
'title' => 'SQL Server 2008 (using PDO)',
|
||||
|
@ -18,7 +18,6 @@ namespace SilverStripe\MSSQL;
|
||||
* Fulltext indexes are not supported.
|
||||
*
|
||||
* @author Sean Harvey <sean at silverstripe dot com>
|
||||
* @package mssql
|
||||
*/
|
||||
class MSSQLAzureDatabase extends MSSQLDatabase
|
||||
{
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
namespace SilverStripe\MSSQL;
|
||||
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\Connect\SS_Database;
|
||||
use SilverStripe\ORM\DataList;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\Connect\SS_Database;
|
||||
use Config;
|
||||
use ClassInfo;
|
||||
use PaginatedList;
|
||||
use SilverStripe\ORM\PaginatedList;
|
||||
use SilverStripe\ORM\Queries\SQLSelect;
|
||||
|
||||
/**
|
||||
@ -48,8 +48,6 @@ use SilverStripe\ORM\Queries\SQLSelect;
|
||||
*
|
||||
* References:
|
||||
* @see http://freetds.org
|
||||
*
|
||||
* @package mssql
|
||||
*/
|
||||
class MSSQLDatabase extends SS_Database
|
||||
{
|
||||
@ -217,14 +215,10 @@ class MSSQLDatabase extends SS_Database
|
||||
*/
|
||||
public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC", $extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false)
|
||||
{
|
||||
if (isset($objects)) {
|
||||
$results = new ArrayList($objects);
|
||||
} else {
|
||||
$results = new ArrayList();
|
||||
}
|
||||
|
||||
if (!$this->fullTextEnabled()) {
|
||||
return $results;
|
||||
return new PaginatedList($results);
|
||||
}
|
||||
if (!in_array(substr($sortBy, 0, 9), array('"Relevanc', 'Relevance'))) {
|
||||
user_error("Non-relevance sort not supported.", E_USER_ERROR);
|
||||
@ -262,14 +256,14 @@ class MSSQLDatabase extends SS_Database
|
||||
$class = DataObject::getSchema()->tableClass($tableName);
|
||||
$join = $this->fullTextSearchMSSQL($tableName, $keywords);
|
||||
if (!$join) {
|
||||
return $results;
|
||||
return new PaginatedList($results);
|
||||
} // avoid "Null or empty full-text predicate"
|
||||
|
||||
// Check if we need to add ShowInSearch
|
||||
$where = null;
|
||||
if ($class === 'SiteTree') {
|
||||
if ($class === 'SilverStripe\\CMS\\Model\\SiteTree') {
|
||||
$where = array("\"$tableName\".\"ShowInSearch\"!=0");
|
||||
} elseif ($class === 'File') {
|
||||
} elseif ($class === 'SilverStripe\\Assets\\File') {
|
||||
// File.ShowInSearch was added later, keep the database driver backwards compatible
|
||||
// by checking for its existence first
|
||||
$fields = $this->getSchemaManager()->fieldList($tableName);
|
||||
|
@ -2,18 +2,16 @@
|
||||
|
||||
namespace SilverStripe\MSSQL;
|
||||
|
||||
use DatabaseConfigurationHelper;
|
||||
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
||||
use SilverStripe\Dev\Install\DatabaseConfigurationHelper;
|
||||
use PDO;
|
||||
use Exception;
|
||||
use DatabaseAdapterRegistry;
|
||||
|
||||
/**
|
||||
* This is a helper class for the SS installer.
|
||||
*
|
||||
* It does all the specific checking for MSSQLDatabase
|
||||
* to ensure that the configuration is setup correctly.
|
||||
*
|
||||
* @package mssql
|
||||
*/
|
||||
class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
||||
{
|
||||
@ -111,7 +109,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
||||
*
|
||||
* @param mixed $conn Connection object/resource
|
||||
* @param string $value Value to quote
|
||||
* @return string Quoted strieng
|
||||
* @return string Quoted string
|
||||
*/
|
||||
protected function quote($conn, $value)
|
||||
{
|
||||
@ -124,6 +122,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
||||
} else {
|
||||
user_error('Invalid database connection', E_USER_ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,17 +2,12 @@
|
||||
|
||||
namespace SilverStripe\MSSQL;
|
||||
|
||||
|
||||
use InvalidArgumentException;
|
||||
use SilverStripe\ORM\Queries\SQLSelect;
|
||||
use SilverStripe\ORM\Connect\DBQueryBuilder;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Builds a SQL query string from a SQLExpression object
|
||||
*
|
||||
* @package mssql
|
||||
*/
|
||||
class MSSQLQueryBuilder extends DBQueryBuilder
|
||||
{
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
namespace SilverStripe\MSSQL;
|
||||
|
||||
|
||||
use SilverStripe\ORM\Connect\DBSchemaManager;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Represents and handles all schema management for a MS SQL database
|
||||
*
|
||||
* @package mssql
|
||||
*/
|
||||
class MSSQLSchemaManager extends DBSchemaManager
|
||||
{
|
||||
@ -697,6 +692,7 @@ class MSSQLSchemaManager extends DBSchemaManager
|
||||
* For a given table name, get all the internal index names,
|
||||
* except for those that are primary keys and fulltext indexes.
|
||||
*
|
||||
* @param string $tableName
|
||||
* @return array
|
||||
*/
|
||||
public function indexNames($tableName)
|
||||
@ -786,6 +782,9 @@ class MSSQLSchemaManager extends DBSchemaManager
|
||||
|
||||
/**
|
||||
* @todo Make this work like {@link MySQLDatabase::set()}
|
||||
*
|
||||
* @param array $values
|
||||
* @return string
|
||||
*/
|
||||
public function set($values)
|
||||
{
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
namespace SilverStripe\MSSQL;
|
||||
|
||||
|
||||
use SilverStripe\ORM\Connect\DBConnector;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Database connector driver for sqlsrv_ library
|
||||
*
|
||||
* @package mssql
|
||||
*/
|
||||
class SQLServerConnector extends DBConnector
|
||||
{
|
||||
|
@ -2,15 +2,11 @@
|
||||
|
||||
namespace SilverStripe\MSSQL;
|
||||
|
||||
|
||||
use SilverStripe\ORM\Connect\SS_Query;
|
||||
use DateTime;
|
||||
|
||||
use SilverStripe\ORM\Connect\SS_Query;
|
||||
|
||||
/**
|
||||
* A result-set from a MSSQL database.
|
||||
*
|
||||
* @package mssql
|
||||
*/
|
||||
class SQLServerQuery extends SS_Query
|
||||
{
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class MSSQLDatabaseQueryTest extends SapphireTest
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user