Commit 348149f9 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature #4720 - Removed the dbIndexList code. The new implementation is more flexible.

parent c5a7826d
......@@ -792,8 +792,10 @@ System tables
* Check Bug #5459 - support of system tables in different DBs not supported.
Multi Databases
^^^^^^^^^^^^^^^
.. _`multi-database`:
Multi Database
^^^^^^^^^^^^^^
Base: T3 & QFQ
''''''''''''''
......@@ -1063,7 +1065,17 @@ a string where an array is needed and vice versa.
Database index
''''''''''''''
Multi Database setups needs access to different databases.
To access different databases in a `multi-database`_ setup, the database index can be specified after the opening curly
braces. ::
{{[1]SELECT ... }}
For using the DB_INDEX_DATA and DB_INDEX_QFQ (`config.qfq.ini`_), it's a good practice to specify the variable name
instead of the numeric index. ::
{{[{{DB_INDEX_DATA:Y}}]SELECT ...}}
If no dbIndex is given, `{{DB_INDEX_DATA:Y}}` is used.
Example
'''''''
......@@ -1073,6 +1085,9 @@ Example
{{SELECT id, name FROM Person}}
{{SELECT id, name, IF({{feUser:T0}}=0,'Yes','No') FROM Person WHERE id={{r:S}} }}
{{SELECT id, city FROM Address AS adr WHERE adr.accId={{SELECT id FROM Account AS acc WHERE acc.name={{feUser:T0}} }} }}
{{!SELECT id, name FROM Person}}
{{[2]SELECT id, name FROM Form}}
{{[{{DB_INDEX_QFQ:Y}}]SELECT id, name FROM Form}}
......
......@@ -568,27 +568,10 @@ abstract class AbstractBuildForm {
$this->store->appendToStore($fe[FE_FILL_STORE_VAR], STORE_VAR);
}
// In case the FormElement List, defined in SQL1, needs a different Database:
if (!empty($fe[FE_DB_INDEX_LIST]) && !empty($fe[FE_SQL1])) {
$feSql1 = $fe[FE_SQL1];
$fe[FE_SQL1] = '';
}
// ** evaluate current FormElement **
$formElement = $this->evaluate->parseArray($fe, $skip, $debugStack);
$formElement = HelperFormElement::setLanguage($formElement, $parameterLanguageFieldName);
if (!empty($feSql1)) {
// Has to be done after parseArray(), cause $formElement[FE_DB_INDEX_LIST] needs to be evaluated first.
$dbList = new Database($formElement[FE_DB_INDEX_LIST]);
$evalList = new Evaluate($this->store, $dbList);
$dataSql1 = $evalList->parse($feSql1);
$formElement[FE_SQL1] = $dataSql1;
unset($dbList);
unset($evalList);
}
// Some Defaults
$formElement = Support::setFeDefaults($formElement, $this->formSpec);
......
......@@ -795,7 +795,6 @@ const F_PARAMETER = 'parameter'; // valid for F_ and FE_
// Form columns: via parameter field
const F_DB_INDEX = 'dbIndex';
const FE_DB_INDEX_LIST = 'dbIndexList';
const DB_INDEX_DEFAULT = "1";
const PARAM_DB_INDEX_DATA = '__dbIndexData'; // Submitted via SIP to make record locking DB aware.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment