Compare commits

..

2 commits

Author SHA1 Message Date
Benjamin Renard
7166e63032
Config: add traces in ini_set() 2023-03-01 19:07:50 +01:00
Benjamin Renard
77deb947db
Db: add set_autocommit() method 2023-03-01 19:07:19 +01:00
2 changed files with 15 additions and 1 deletions

View file

@ -236,8 +236,12 @@ Class Config {
* @return void * @return void
*/ */
public static function ini_set($option, $value) { public static function ini_set($option, $value) {
Log :: trace('Set PHP INI option "%s" to "%s"', $option, $value);
if (ini_set($option, $value) === false) if (ini_set($option, $value) === false)
Log::warning('Fail to set INI options "%s" to "%s"', $option, $value); Log::warning('Fail to set PHP INI option "%s" to "%s"', $option, $value);
Log :: trace(
'PHP INI option "%s" after setting it to "%s": "%s"',
$option, $value, vardump(ini_get($option)));
} }
} }

View file

@ -103,6 +103,16 @@ class Db {
Log :: debug($msg); Log :: debug($msg);
} }
/**
* Set autocommit (only available on OCI, Firebird or MySQL connection)
* @param bool $value
* @see https://www.php.net/manual/en/pdo.setattribute.php
* @return void
*/
public function set_autocommit($value) {
$this -> pdo -> setAttribute(PDO::ATTR_AUTOCOMMIT, $value);
}
/* /*
* Handle date/datetime format * Handle date/datetime format
*/ */