mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 20:51:30 +00:00
create temp table for document revisions
This commit is contained in:
parent
8c63cc607b
commit
bbcff75b00
|
@ -88,10 +88,15 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
private $_ttcontentid;
|
private $_ttcontentid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean set to true if temp. table for doc content has been created
|
* @var boolean set to true if temp. table for doc reception has been created
|
||||||
*/
|
*/
|
||||||
private $_ttreceiptid;
|
private $_ttreceiptid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean set to true if temp. table for doc revision has been created
|
||||||
|
*/
|
||||||
|
private $_ttrevisionid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean set to true if in a database transaction
|
* @var boolean set to true if in a database transaction
|
||||||
*/
|
*/
|
||||||
|
@ -157,6 +162,7 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
$this->_ttstatid = false;
|
$this->_ttstatid = false;
|
||||||
$this->_ttcontentid = false;
|
$this->_ttcontentid = false;
|
||||||
$this->_ttreceiptid = false;
|
$this->_ttreceiptid = false;
|
||||||
|
$this->_ttrevisionid = false;
|
||||||
$this->_debug = false;
|
$this->_debug = false;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -341,7 +347,7 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
}
|
}
|
||||||
return $this->_ttreviewid;
|
return $this->_ttreviewid;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp($tableName, "ttapproveid")) {
|
elseif (!strcasecmp($tableName, "ttapproveid")) {
|
||||||
switch($this->_driver) {
|
switch($this->_driver) {
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` AS ".
|
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` AS ".
|
||||||
|
@ -374,7 +380,7 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
}
|
}
|
||||||
return $this->_ttapproveid;
|
return $this->_ttapproveid;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp($tableName, "ttstatid")) {
|
elseif (!strcasecmp($tableName, "ttstatid")) {
|
||||||
switch($this->_driver) {
|
switch($this->_driver) {
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` AS ".
|
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` AS ".
|
||||||
|
@ -407,7 +413,7 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
}
|
}
|
||||||
return $this->_ttstatid;
|
return $this->_ttstatid;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp($tableName, "ttcontentid")) {
|
elseif (!strcasecmp($tableName, "ttcontentid")) {
|
||||||
switch($this->_driver) {
|
switch($this->_driver) {
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
$queryStr = "CREATE TEMPORARY TABLE `ttcontentid` AS ".
|
$queryStr = "CREATE TEMPORARY TABLE `ttcontentid` AS ".
|
||||||
|
@ -473,6 +479,39 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
}
|
}
|
||||||
return $this->_ttreceiptid;
|
return $this->_ttreceiptid;
|
||||||
}
|
}
|
||||||
|
elseif (!strcasecmp($tableName, "ttrevisionid")) {
|
||||||
|
switch($this->_driver) {
|
||||||
|
case 'sqlite':
|
||||||
|
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttrevisionid` AS ".
|
||||||
|
"SELECT `tblDocumentRevisionLog`.`revisionID`, ".
|
||||||
|
"MAX(`tblDocumentRevisionLog`.`revisionLogID`) AS `maxLogID` ".
|
||||||
|
"FROM `tblDocumentRevisionLog` ".
|
||||||
|
"GROUP BY `tblDocumentRevisionLog`.`revisionID` ".
|
||||||
|
"ORDER BY `maxLogID`";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttrevisionid` (PRIMARY KEY (`revisionID`), INDEX (`maxLogID`)) ".
|
||||||
|
"SELECT `tblDocumentRevisionLog`.`revisionID`, ".
|
||||||
|
"MAX(`tblDocumentRevisionLog`.`revisionLogID`) AS `maxLogID` ".
|
||||||
|
"FROM `tblDocumentRevisionLog` ".
|
||||||
|
"GROUP BY `tblDocumentRevisionLog`.`revisionID` ".
|
||||||
|
"ORDER BY `maxLogID`";
|
||||||
|
}
|
||||||
|
if (!$this->_ttrevisionid) {
|
||||||
|
if (!$this->getResult($queryStr))
|
||||||
|
return false;
|
||||||
|
$this->_ttrevisionid=true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (is_bool($override) && $override) {
|
||||||
|
if (!$this->getResult("DELETE FROM `ttrevisionid`"))
|
||||||
|
return false;
|
||||||
|
if (!$this->getResult($queryStr))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->_ttrevisionid;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user