. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use Illuminate\Database\Capsule\Manager; /** * Database abstraction */ class DB extends Manager { /** * @internal */ public static function caseInsensitiveLikeOperator(): string { if (DB::connection()->getDriverName() === 'pgsql') { return 'ILIKE'; } if (DB::connection()->getDriverName() === 'sqlsrv') { return 'COLLATE SQL_UTF8_General_CI_AI LIKE'; } return 'LIKE'; } /** * @internal */ public static function groupConcat(string $column): string { switch (DB::connection()->getDriverName()) { case 'pgsql': case 'sqlsrv': return 'STRING_AGG(' . $column . ", ',')"; case 'mysql': case 'sqlite': default: return 'GROUP_CONCAT(' . $column . ')'; } } }