$pass = trim($this->configCache->get('database', 'password'));
$db = trim($this->configCache->get('database', 'database'));
$charset = trim($this->configCache->get('database', 'charset'));
+ $socket = trim($this->configCache->get('database', 'socket'));
if (!(strlen($server) && strlen($user))) {
return false;
$connect .= ";charset=" . $charset;
}
+ if ($socket) {
+ $connect .= ";$unix_socket=" . $socket;
+ }
+
try {
$this->connection = @new PDO($connect, $user, $pass, [PDO::ATTR_PERSISTENT => $persistent]);
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, $this->pdo_emulate_prepares);
+ $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$this->connected = true;
} catch (PDOException $e) {
$this->connected = false;
if ($charset) {
$this->connection->set_charset($charset);
}
+
+ if ($socket) {
+ $this->connection->set_socket($socket);
+ }
+
}
}
private function escapeFields(array $fields, array $options)
{
// In the case of a "GROUP BY" we have to add all the ORDER fields to the fieldlist.
- // This needs to done to apply the "MAX(...)" treatment from below to them.
+ // This needs to done to apply the "ANY_VALUE(...)" treatment from below to them.
// Otherwise MySQL would report errors.
if (!empty($options['group_by']) && !empty($options['order'])) {
foreach ($options['order'] as $key => $field) {
$value = '`' . str_replace('`', '``', $value) . '`';
if (!empty($options['group_by']) && !in_array($field, $options['group_by'])) {
- $value = 'MAX(' . $value . ') AS ' . $value;
+ $value = 'ANY_VALUE(' . $value . ') AS ' . $value;
}
});