php-src/ext/pgsql/tests/inc/lcmess.inc
KentarouTakeda c15988aab3
ext/pgsql: Refactor tests (#12608)
This makes the tests independent of each other and allows them to be run in parallel.

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2023-11-06 22:36:52 +00:00

21 lines
463 B
PHP

<?php
function _skip_lc_messages($conn, $lc_messages = 'C')
{
if (!_set_lc_messages($conn, $lc_messages)) {
die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
}
}
function _set_lc_messages($conn, $lc_messages = 'C')
{
if (pg_fetch_result(pg_query($conn, "SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
if (!@pg_exec($conn, "SET LC_MESSAGES='{$lc_messages}'")) {
return false;
}
}
return true;
}
?>