Skip to content
Snippets Groups Projects

Fixes #14813 - Report: dbIndex - missing per level definition

Merged Carsten Rose requested to merge dbIndexPerRow into develop
2 files
+ 26
13
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -91,7 +91,7 @@ class Report {
/**
* @var Database
*/
private $db = null;
private $dbArr = array();
private $dbIndexData = false;
@@ -174,7 +174,7 @@ class Report {
$this->dbIndexData = DB_INDEX_DEFAULT;
}
$this->db = new Database($this->dbIndexData);
$this->dbArr[$this->dbIndexData] = new Database($this->dbIndexData);
$this->variables = new Variables($evaluate, $t3data["uid"]);
$this->link = new Link($this->sip, $this->dbIndexData, $phpUnit);
@@ -271,6 +271,7 @@ class Report {
}
// 10.50.5.sql
// Warum machen wir hier ein strtolower()? Die Schluesselwoerter: debugShowBodyText|dbIndex|sqlLog|sqlLogMode
$key = strtolower(trim($arr[0]));
// comment ?
@@ -466,11 +467,11 @@ class Report {
$bodytextArr = $functionCache[$rcFunctionName];
} else {
// Multi DB setup: check for the correct DB
if (DB_INDEX_T3 != $this->db->getDbIndex()) {
if (DB_INDEX_T3 != $this->dbArr[$this->dbIndexData]->getDbIndex()) {
// Current DB is wrong: get DB with DB_INDEX_T3
$db = new Database(DB_INDEX_T3);
} else {
$db = $this->db;
$db = $this->dbArr[$this->dbIndexData];
}
$bodytextArr = $db->getBodyText($rcFunctionName);
@@ -580,6 +581,15 @@ class Report {
unset($this->variables->resultArray[$fullLevel . ".line."][LINE_TOTAL]);
unset($this->variables->resultArray[$fullLevel . ".line."][LINE_COUNT]);
$dbIndexDataLast = $this->dbIndexData;
if ($this->frArray[$fullLevel . "." . TOKEN_DB_INDEX_LC] != '') {
$this->dbIndexData = $this->evaluate->parse($this->frArray[$fullLevel . "." . TOKEN_DB_INDEX_LC]);
}
if (!isset($this->dbArr[$this->dbIndexData])) {
$this->dbArr[$this->dbIndexData] = new Database($this->dbIndexData);
}
// If defined, fire QFQ function
if ($this->frArray[$fullLevel . "." . TOKEN_FUNCTION] != '') {
$this->doQfqFunction($this->frArray[$fullLevel . "." . TOKEN_FUNCTION]);
@@ -603,7 +613,7 @@ class Report {
//Execute SQL. All errors have been already catched.
if ($sql != '') {
$result = $this->db->sql($sql, ROW_KEYS, array(), '', $keys, $stat);
$result = $this->dbArr[$this->dbIndexData]->sql($sql, ROW_KEYS, array(), '', $keys, $stat);
}
// If an array is returned, $sql was a query, otherwise an 'insert', 'update', 'delete', ...
@@ -710,7 +720,7 @@ class Report {
// altsql
$sql = $this->variables->doVariables($this->frArray[$fullLevel . "." . TOKEN_ALT_SQL]);
if (!empty($sql)) {
$result = $this->db->sql($sql, ROW_KEYS, array(), '', $keys, $stat);
$result = $this->dbArr[$this->dbIndexData]->sql($sql, ROW_KEYS, array(), '', $keys, $stat);
$newKeys = $this->splitColumnNames($keys);
@@ -779,6 +789,8 @@ class Report {
} else {
$fullLevel = '';
}
$this->dbIndexData = $dbIndexDataLast;
}
return $content;
}
@@ -809,10 +821,10 @@ class Report {
// Author: Enis Nuredini
// Split and get given encryption method from column name
$key = $arr[0];
$keyArray = explode('=', $key,2);
if(isset($keyArray[1]) && $keyArray[1] !== '') {
$keyArray = explode('=', $key, 2);
if (isset($keyArray[1]) && $keyArray[1] !== '') {
$encryptionMethod = $keyArray[1];
if(EncryptDecrypt::checkForValidEncryptMethod($encryptionMethod)) {
if (EncryptDecrypt::checkForValidEncryptMethod($encryptionMethod)) {
try {
$this->store::setVar(ENCRYPTION_CIPHER_METHOD_COLUMN_NAME, $encryptionMethod, STORE_SYSTEM);
} catch (\CodeException|\UserFormException $e) {
@@ -1324,9 +1336,9 @@ class Report {
case COLUMN_ENCRYPT:
$encryptionMethodColumn = $this->store->getVar(ENCRYPTION_CIPHER_METHOD_COLUMN_NAME, STORE_SYSTEM, SANITIZE_ALLOW_ALL);
// If method from column not given then use default or check if the given one is valid
if($encryptionMethodColumn) {
if(!EncryptDecrypt::checkForValidEncryptMethod($encryptionMethodColumn)) {
throw new \UserReportException ("Invalid encryption method used in special column name: $encryptionMethodColumn", ERROR_INVALID_ENCRYPTION_METHOD);
if ($encryptionMethodColumn) {
if (!EncryptDecrypt::checkForValidEncryptMethod($encryptionMethodColumn)) {
throw new \UserReportException ("Invalid encryption method used in special column name: $encryptionMethodColumn", ERROR_INVALID_ENCRYPTION_METHOD);
}
} else {
$encryptionMethodColumn = $this->store->getVar(SYSTEM_ENCRYPTION_METHOD, STORE_SYSTEM, SANITIZE_ALLOW_ALL);
@@ -1336,7 +1348,7 @@ class Report {
break;
case COLUMN_DECRYPT:
if(EncryptDecrypt::checkForEncryptedValue($columnValue)) {
if (EncryptDecrypt::checkForEncryptedValue($columnValue)) {
$content .= EncryptDecrypt::getPlaintext($columnValue, $encryptionKey);
} else {
$content .= $columnValue;
Loading