Commit 2ddd5356 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DDC-1202'

parents 0985b38b 1605e5c3
......@@ -22,7 +22,8 @@ namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Index, Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\Index,
Doctrine\DBAL\Schema\Table;
/**
* The MsSqlPlatform provides the behavior, features and SQL dialect of the
......@@ -441,11 +442,11 @@ class MsSqlPlatform extends AbstractPlatform
$pattern = "'%[^' + $char + ']%'";
if ($pos == self::TRIM_LEADING) {
return 'stuff(' . $str . ', 1, patindex(' . $pattern .', ' . $str . ') - 1, null)';
return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)';
} else if ($pos == self::TRIM_TRAILING) {
return 'reverse(stuff(reverse(' . $str . '), 1, patindex(' . $pattern .', reverse(' . $str . ')) - 1, null))';
return 'reverse(stuff(reverse(' . $str . '), 1, patindex(' . $pattern . ', reverse(' . $str . ')) - 1, null))';
} else {
return 'reverse(stuff(reverse(stuff(' . $str . ', 1, patindex(' . $pattern .', ' . $str . ') - 1, null)), 1, patindex(' . $pattern .', reverse(stuff(' . $str . ', 1, patindex(' . $pattern .', ' . $str . ') - 1, null))) - 1, null))';
return 'reverse(stuff(reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)), 1, patindex(' . $pattern . ', reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null))) - 1, null))';
}
}
}
......@@ -761,8 +762,7 @@ class MsSqlPlatform extends AbstractPlatform
return $fromClause . ' WITH (tablockx)';
} else if ($lockMode == \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) {
return $fromClause . ' WITH (tablockx)';
}
else {
} else {
return $fromClause;
}
}
......@@ -779,4 +779,20 @@ class MsSqlPlatform extends AbstractPlatform
{
return 'Doctrine\DBAL\Platforms\Keywords\MsSQLKeywords';
}
/**
* Quotes a string so that it can be safely used as a table or column name,
* even if it is a reserved word of the platform.
*
* NOTE: Just because you CAN use quoted identifiers doesn't mean
* you SHOULD use them. In general, they end up causing way more
* problems than they solve.
*
* @param string $str identifier name to be quoted
* @return string quoted identifier string
*/
public function quoteIdentifier($str)
{
return "[" . $str . "]";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment