class ResponseObject
{
public static function parse(object $data): ResponseObject1|ResponseObject2|ResponseObject3|ResponseObject4
{
switch ($data->type) {
case 'type1':
return new ResponseObject1($data);
case 'type2':
return new ResponseObject2($data);
case 'type3':
return new ResponseObject3($data);
case 'type4':
return new ResponseObject4($data);
}
}
}
INSERT INTO `mail` (`user`, `to`, `text`, `time`)
SELECT 2, `id`, :text, :time
FROM `users`
WHERE `id` != 2;
INSERT INTO `contacts` (`user`, `ho`, `delete`, `time`)
SELECT *
FROM (
SELECT `id`, 2, 0, :time
FROM `users`
WHERE `id` != 2
UNION ALL SELECT 2, `id`, 0, :time
FROM `users`
WHERE `id` != 2
) AS `t`
ON DUPLICATE KEY UPDATE `delete` = 0, `time` = VALUES(`time`);
The error (2002) Can't connect to ... normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.https://dev.mysql.com/doc/refman/8.0/en/can-not-co...