mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-15 20:47:33 +08:00
pg support: group_concat
This commit is contained in:
@@ -533,7 +533,7 @@ class NexusDB
|
||||
}
|
||||
}
|
||||
|
||||
public static function upsertField(array $uniqueFields, array $updateFields): string
|
||||
public static function upsertField(array $uniqueFields, array $updateFields = []): string
|
||||
{
|
||||
if (self::isMysql()) {
|
||||
$updates = [];
|
||||
@@ -557,4 +557,15 @@ class NexusDB
|
||||
}
|
||||
}
|
||||
|
||||
public static function groupConcatField(string $field): string
|
||||
{
|
||||
if (self::isMysql()) {
|
||||
return sprintf("group_concat(%s)", $field);
|
||||
} elseif (self::isPgsql()) {
|
||||
return sprintf("string_agg(%s::text, ',')", $field);
|
||||
} else {
|
||||
throw new \RuntimeException('Not supported database.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user