mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-08 17:34:32 +02:00
Allow to emulate natural sort on mysql platforms
This commit is contained in:
parent
272fe0516b
commit
123372d93f
2 changed files with 121 additions and 1 deletions
|
@ -25,6 +25,7 @@ namespace App\Doctrine\Functions;
|
|||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
|
||||
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
|
||||
use Doctrine\DBAL\Platforms\MariaDBPlatform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
|
||||
use Doctrine\DBAL\Platforms\SQLitePlatform;
|
||||
|
@ -100,10 +101,13 @@ class Natsort extends FunctionNode
|
|||
|
||||
//Do the following operations only if we allow slow natural sort
|
||||
if (self::$allowSlowNaturalSort) {
|
||||
|
||||
if ($platform instanceof SQLitePlatform) {
|
||||
return $this->field->dispatch($sqlWalker).' COLLATE NATURAL_CMP';
|
||||
}
|
||||
|
||||
if ($platform instanceof AbstractMySQLPlatform) {
|
||||
return 'NatSortKey(' . $this->field->dispatch($sqlWalker) . ', 0)';
|
||||
}
|
||||
}
|
||||
|
||||
//For every other platform, return the field as is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue