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 { ...@@ -25,10 +25,12 @@ class Delete {
private $store = null; private $store = null;
/** /**
* * @param bool $dbIndexData
* @param bool $phpUnit
*/ */
public function __construct($phpUnit = false) { public function __construct($dbIndexData = false, $phpUnit = false) {
$this->db = new Database();
$this->db = new Database($dbIndexData);
$this->store = Store::getInstance('', $phpUnit); $this->store = Store::getInstance('', $phpUnit);
} }
......
...@@ -305,6 +305,16 @@ class QuickFormQuery { ...@@ -305,6 +305,16 @@ class QuickFormQuery {
$this->formSpec[F_TABLE_NAME] = $table; $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_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. $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. // For 'new' record always create a new Browser TAB-uniq (for this current form, nowhere else used) SIP.
...@@ -344,10 +354,10 @@ class QuickFormQuery { ...@@ -344,10 +354,10 @@ class QuickFormQuery {
if ($formMode === FORM_DELETE) { if ($formMode === FORM_DELETE) {
$build = new Delete(); $build = new Delete($this->dbIndexData);
} else { } 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); $this->store->fillStoreTableDefaultColumnType($tableDefinition);
switch ($this->formSpec['render']) { switch ($this->formSpec['render']) {
......
...@@ -68,8 +68,10 @@ class Database { ...@@ -68,8 +68,10 @@ class Database {
* @throws DbException * @throws DbException
* @throws UserFormException * @throws UserFormException
*/ */
public function __construct($dbIndex = 1) { public function __construct($dbIndex = DB_INDEX_DEFAULT) {
$dbInit = ''; if (empty($dbIndex)) {
$dbIndex = DB_INDEX_DEFAULT;
}
$this->store = Store::getInstance(); $this->store = Store::getInstance();
$storeSystem = $this->store->getStore(STORE_SYSTEM); $storeSystem = $this->store->getStore(STORE_SYSTEM);
......
Supports Markdown
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