WITH RECURSIVE `cte` (`level`, `id`, `login`, `referrer`) AS (
SELECT 0, `id`, `login`, `referrer`
FROM `users`
WHERE `id` = :userId
UNION
SELECT `u`.`level` + 1, `r`.`id`, `r`.`login`, `r`.`referrer`
FROM `cte` AS `u`
JOIN `users` AS `r` ON `r`.`id` = `u`.`referrer`
)
SELECT *
FROM `cte`
const today = String((new Date()).getDate()).padStart(2, '0');
const dayStartElements = document.querySelectorAll(".js-text");
dayStartElements.forEach((el) => { el.innerText = `${dd}` });
If the handler throws an error or returns a rejected promise, the promise returned by finally() will be rejected with that value instead. Otherwise, the return value of the handler does not affect the state of the original promise.
...
UnlikePromise.resolve(2).then(() => 77, () => {})
(which will return a resolved promise with the result 77),Promise.resolve(2).finally(() => 77)
will return a new resolved promise with the result 2.
Similarly, unlikePromise.reject(3).then(() => {}, () => 88)
(which will return a resolved promise with the value 88),Promise.reject(3).finally(() => 88)
will return a rejected promise with the reason 3.
But, bothPromise.reject(3).finally(() => {throw 99})
andwill reject the returned promise with the reason 99.Promise.reject(3).finally(() => Promise.reject(99))
function find(sum, n, m) {
if (n === 1) {
return [`${sum}`];
}
const result = [];
const min = Math.max(m, Math.floor(sum - (n - 1) * 9));
const max = Math.floor(sum / n);
for (let i = min; i <= max; i += 1) {
find(sum - i, n - 1, i).forEach((el) => result.push(`${i}${el}`));
}
return result;
}
function findAll(sum, n) {
if (sum > n * 9 || sum < n) {
return [];
}
const result = find(sum, n, 1);
return [result.length, result[0], result.pop()];
}
SELECT DISTINCT FIRST_VALUE(`id`) OVER `win` AS `id`, `user_id`,
FIRST_VALUE(`score`) OVER `win` AS `score`,
FIRST_VALUE(`user_name`) OVER `win` AS `user_name`
FROM `game_api_score`
WINDOW `win` AS (PARTITION BY `user_id` ORDER BY `score` DESC)
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...