dbobjectset : check cache use via phpunit tests

This commit is contained in:
odain
2025-12-30 12:05:32 +01:00
parent e58e699288
commit afdfb2acf1
3 changed files with 81 additions and 24 deletions

View File

@@ -537,6 +537,12 @@ class CMDBSource
*/
public static function Query($sSQLQuery)
{
if (self::$sRaisesExceptionMsgWhenSqlQuery) {
$e = new \Exception(self::$sRaisesExceptionMsgWhenSqlQuery);
\IssueLog::Error(__METHOD__, null, [$e->getTraceAsString()]);
throw $e;
}
if (preg_match('/^START TRANSACTION;?$/i', $sSQLQuery)) {
self::StartTransaction();
@@ -556,6 +562,13 @@ class CMDBSource
return self::DBQuery($sSQLQuery);
}
public static ?string $sRaisesExceptionMsgWhenSqlQuery = null;
public static function TriggerExceptionWhenSqlQuery(?string $sMsg)
{
self::$sRaisesExceptionMsgWhenSqlQuery = $sMsg;
}
/**
* Send the query directly to the DB. **Be extra cautious with this !**
*