Commit 9d064a3b authored by Carsten  Rose's avatar Carsten Rose
Browse files

MultiDB: fix problem with deleting records

parent 575bf775
......@@ -25,10 +25,12 @@ class Delete {
private $store = null;
/**
*
* @param bool $dbIndexData
* @param bool $phpUnit
*/
public function __construct($phpUnit = false) {
$this->db = new Database();
public function __construct($dbIndexData = false, $phpUnit = false) {
$this->db = new Database($dbIndexData);
$this->store = Store::getInstance('', $phpUnit);
}
......
......@@ -305,6 +305,16 @@ class QuickFormQuery {
$this->formSpec[F_TABLE_NAME] = $table;
$this->formSpec[F_RECORD_LOCK_TIMEOUT_SECONDS] = 1; // just indicate a timeout, the exact timeout is stored in the dirty record.
$this->formSpec[F_DIRTY_MODE] = DIRTY_MODE_EXCLUSIVE; // just set a mode,, the exact mode is stored in the dirty record.
$tmpDbIndexData = $this->store->getVar(PARAM_DB_INDEX_DATA, STORE_SIP);
if (!empty($tmpDbIndexData)) {
$this->formSpec[F_DB_INDEX] = $tmpDbIndexData;
if ($tmpDbIndexData != $this->dbIndexData) {
if (!isset($this->dbArray[$tmpDbIndexData])) {
$this->dbArray[$tmpDbIndexData] = new Database($tmpDbIndexData);
}
}
}
}
// For 'new' record always create a new Browser TAB-uniq (for this current form, nowhere else used) SIP.
......@@ -344,10 +354,10 @@ class QuickFormQuery {
if ($formMode === FORM_DELETE) {
$build = new Delete();
$build = new Delete($this->dbIndexData);
} else {
$tableDefinition = $this->dbArray[$this->dbIndexData]->getTableDefinition($this->formSpec[F_TABLE_NAME]);
$tableDefinition = $this->dbArray[$this->dbIndexData]->getTableDefinition($this->formSpec[F_TABLE_NAME]);
$this->store->fillStoreTableDefaultColumnType($tableDefinition);
switch ($this->formSpec['render']) {
......
......@@ -68,8 +68,10 @@ class Database {
* @throws DbException
* @throws UserFormException
*/
public function __construct($dbIndex = 1) {
$dbInit = '';
public function __construct($dbIndex = DB_INDEX_DEFAULT) {
if (empty($dbIndex)) {
$dbIndex = DB_INDEX_DEFAULT;
}
$this->store = Store::getInstance();
$storeSystem = $this->store->getStore(STORE_SYSTEM);
......
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