From c55b595ae9567aa975cb97ba04f63507ee2d455d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 11 Feb 2017 15:19:36 +0100 Subject: [PATCH 01/15] pass tablename to getInsertID(), add pgsql as new db driver --- SeedDMS_Core/Core/inc.ClassDMS.php | 16 ++++++------ SeedDMS_Core/Core/inc.ClassDocument.php | 34 ++++++++++++------------- SeedDMS_Core/Core/inc.ClassFolder.php | 4 +-- SeedDMS_Core/Core/inc.ClassObject.php | 5 +++- SeedDMS_Core/Core/inc.ClassWorkflow.php | 2 +- SeedDMS_Core/Core/inc.DBAccessPDO.php | 23 ++++++++++++----- 6 files changed, 48 insertions(+), 36 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 0b358a405..fe587fb04 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -1870,7 +1870,7 @@ class SeedDMS_Core_DMS { if (!$res) return false; - $user = $this->getUser($this->db->getInsertID()); + $user = $this->getUser($this->db->getInsertID('tblUsers')); /* Check if 'onPostAddUser' callback is set */ if(isset($this->_dms->callbacks['onPostAddUser'])) { @@ -1932,7 +1932,7 @@ class SeedDMS_Core_DMS { if (!$this->db->getResult($queryStr)) return false; - $group = $this->getGroup($this->db->getInsertID()); + $group = $this->getGroup($this->db->getInsertID('tblGroups')); /* Check if 'onPostAddGroup' callback is set */ if(isset($this->_dms->callbacks['onPostAddGroup'])) { @@ -2125,7 +2125,7 @@ class SeedDMS_Core_DMS { if (!$this->db->getResult($queryStr)) return false; - $category = $this->getKeywordCategory($this->db->getInsertID()); + $category = $this->getKeywordCategory($this->db->getInsertID('tblKeywordCategories')); /* Check if 'onPostAddKeywordCategory' callback is set */ if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) { @@ -2201,7 +2201,7 @@ class SeedDMS_Core_DMS { if (!$this->db->getResult($queryStr)) return false; - $category = $this->getDocumentCategory($this->db->getInsertID()); + $category = $this->getDocumentCategory($this->db->getInsertID('tblCategory')); /* Check if 'onPostAddDocumentCategory' callback is set */ if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) { @@ -2400,7 +2400,7 @@ class SeedDMS_Core_DMS { if (!$res) return false; - return $this->getAttributeDefinition($this->db->getInsertID()); + return $this->getAttributeDefinition($this->db->getInsertID('tblAttributeDefinitions')); } /* }}} */ /** @@ -2501,7 +2501,7 @@ class SeedDMS_Core_DMS { if (!$res) return false; - return $this->getWorkflow($db->getInsertID()); + return $this->getWorkflow($db->getInsertID('tblWorkflows')); } /* }}} */ /** @@ -2594,7 +2594,7 @@ class SeedDMS_Core_DMS { if (!$res) return false; - return $this->getWorkflowState($db->getInsertID()); + return $this->getWorkflowState($db->getInsertID('tblWorkflowStates')); } /* }}} */ /** @@ -2684,7 +2684,7 @@ class SeedDMS_Core_DMS { if (!$res) return false; - return $this->getWorkflowAction($db->getInsertID()); + return $this->getWorkflowAction($db->getInsertID('tblWorkflowActions')); } /* }}} */ /** diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 20e72a082..f2aa93a91 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -1586,7 +1586,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ return false; } - $contentID = $db->getInsertID(); + $contentID = $db->getInsertID('tblDocumentContent'); // copy file if (!SeedDMS_Core_File::makeDir($this->_dms->contentDir . $dir)) { @@ -1632,7 +1632,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ return false; } - $statusID = $db->getInsertID(); + $statusID = $db->getInsertID('tblDocumentStatus', 'statusID'); if($workflow) $content->setWorkflow($workflow, $user); @@ -2271,7 +2271,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ "(".$db->qstr($comment).", ".$db->getCurrentTimestamp().", ".$db->qstr($dir).", ".$this->_id.", ".$db->qstr($fileType).", ".$db->qstr($mimeType).", ".$db->qstr($orgFileName).",".$user->getID().",".$db->qstr($name).")"; if (!$db->getResult($queryStr)) return false; - $id = $db->getInsertID(); + $id = $db->getInsertID('tblDocumentFiles'); $file = $this->getDocumentFile($id); if (is_bool($file) && !$file) return false; @@ -3379,7 +3379,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $db->rollbackTransaction(); return false; } - $reviewID = $db->getInsertID(); + $reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID'); $reviewlog = array_reverse($review['logs']); foreach($reviewlog as $log) { if(!SeedDMS_Core_DMS::checkDate($log['date'], 'Y-m-d H:i:s')) { @@ -3392,7 +3392,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $db->rollbackTransaction(); return false; } - $reviewLogID = $db->getInsertID(); + $reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID'); if(!empty($log['file'])) { SeedDMS_Core_File::copyFile($log['file'], $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID); } @@ -3507,7 +3507,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $db->rollbackTransaction(); return false; } - $reviewID = $db->getInsertID(); + $reviewID = $db->getInsertID('tblDocumentApprovers', 'approveID'); $reviewlog = array_reverse($review['logs']); foreach($reviewlog as $log) { if(!SeedDMS_Core_DMS::checkDate($log['date'], 'Y-m-d H:i:s')) { @@ -3520,7 +3520,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $db->rollbackTransaction(); return false; } - $approveLogID = $db->getInsertID(); + $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); if(!empty($log['file'])) { SeedDMS_Core_File::copyFile($log['file'], $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID); } @@ -3667,7 +3667,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $reviewID = $db->getInsertID(); + $reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID'); } else { $reviewID = isset($indstatus["reviewID"]) ? $indstatus["reviewID"] : NULL; @@ -3725,7 +3725,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $reviewID = $db->getInsertID(); + $reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID'); } else { $reviewID = isset($reviewStatus[0]["reviewID"])?$reviewStatus[0]["reviewID"]:NULL; @@ -3795,7 +3795,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; - $reviewLogID = $db->getInsertID(); + $reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID'); if($file) { SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID); } @@ -3847,7 +3847,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; else { - $reviewLogID = $db->getInsertID(); + $reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID'); if($file) { SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID); } @@ -3887,7 +3887,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $approveID = $db->getInsertID(); + $approveID = $db->getInsertID('tblDocumentApprovers', 'approveID'); } else { $approveID = isset($indstatus["approveID"]) ? $indstatus["approveID"] : NULL; @@ -3900,7 +3900,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return -1; } - $approveLogID = $db->getInsertID(); + $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); return $approveLogID; } /* }}} */ @@ -3943,7 +3943,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $approveID = $db->getInsertID(); + $approveID = $db->getInsertID('tblDocumentApprovers', 'approveID'); } else { $approveID = isset($approvalStatus[0]["approveID"])?$approvalStatus[0]["approveID"]:NULL; @@ -3959,7 +3959,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ // Add approver to event notification table. //$this->_document->addNotify($groupID, false); - $approveLogID = $db->getInsertID(); + $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); return $approveLogID; } /* }}} */ @@ -4017,7 +4017,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; - $approveLogID = $db->getInsertID(); + $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); if($file) { SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID); } @@ -4061,7 +4061,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; - $approveLogID = $db->getInsertID(); + $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); if($file) { SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID); } diff --git a/SeedDMS_Core/Core/inc.ClassFolder.php b/SeedDMS_Core/Core/inc.ClassFolder.php index ad1098c31..001899510 100644 --- a/SeedDMS_Core/Core/inc.ClassFolder.php +++ b/SeedDMS_Core/Core/inc.ClassFolder.php @@ -520,7 +520,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { $db->rollbackTransaction(); return false; } - $newFolder = $this->_dms->getFolder($db->getInsertID()); + $newFolder = $this->_dms->getFolder($db->getInsertID('tblFolders')); unset($this->_subFolders); if($attributes) { @@ -827,7 +827,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { return false; } - $document = $this->_dms->getDocument($db->getInsertID()); + $document = $this->_dms->getDocument($db->getInsertID('tblDocuments')); // if ($version_comment!="") $res = $document->addContent($version_comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers, $reqversion, $version_attributes, $workflow, $initstate); diff --git a/SeedDMS_Core/Core/inc.ClassObject.php b/SeedDMS_Core/Core/inc.ClassObject.php index e0cd1cbfb..4a9df2a30 100644 --- a/SeedDMS_Core/Core/inc.ClassObject.php +++ b/SeedDMS_Core/Core/inc.ClassObject.php @@ -223,12 +223,15 @@ class SeedDMS_Core_Object { /* {{{ */ if(!isset($this->_attributes[$attrdef->getId()])) { switch(get_class($this)) { case $this->_dms->getClassname('document'): + $tablename = 'tblDocumentAttributes'; $queryStr = "INSERT INTO `tblDocumentAttributes` (`document`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")"; break; case $this->_dms->getClassname('documentcontent'): + $tablename = 'tblDocumentContentAttributes'; $queryStr = "INSERT INTO `tblDocumentContentAttributes` (`content`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")"; break; case $this->_dms->getClassname('folder'): + $tablename = 'tblFolderAttributes'; $queryStr = "INSERT INTO `tblFolderAttributes` (`folder`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")"; break; default: @@ -238,7 +241,7 @@ class SeedDMS_Core_Object { /* {{{ */ if (!$res) return false; - $attr = new SeedDMS_Core_Attribute($db->getInsertID(), $this, $attrdef, $value); + $attr = new SeedDMS_Core_Attribute($db->getInsertID($tablename), $this, $attrdef, $value); $attr->setDMS($this->_dms); $this->_attributes[$attrdef->getId()] = $attr; return true; diff --git a/SeedDMS_Core/Core/inc.ClassWorkflow.php b/SeedDMS_Core/Core/inc.ClassWorkflow.php index 5404f6a67..e3e5eab0d 100644 --- a/SeedDMS_Core/Core/inc.ClassWorkflow.php +++ b/SeedDMS_Core/Core/inc.ClassWorkflow.php @@ -286,7 +286,7 @@ class SeedDMS_Core_Workflow { /* {{{ */ * transitions are added in a row, without reloading the workflow */ $this->_transitions = array(); - $transition = $this->getTransition($db->getInsertID()); + $transition = $this->getTransition($db->getInsertID('tblWorkflowTransitions')); foreach($users as $user) { $queryStr = "INSERT INTO `tblWorkflowTransitionUsers` (`transition`, `userid`) VALUES (".$transition->getID().", ".$user->getID().")"; diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 18f64c2de..213199927 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -176,6 +176,7 @@ class SeedDMS_Core_DatabaseAccess { case 'mysql': case 'mysqli': case 'mysqlnd': + case 'pgsql': $dsn = $this->_driver.":dbname=".$this->_database.";host=".$this->_hostname; if($this->_port) $dsn .= ";port=".$this->_port; @@ -234,7 +235,7 @@ class SeedDMS_Core_DatabaseAccess { * @return string sanitized string */ function rbt($text) { /* {{{ */ - return str_replace('`', '"'); + return str_replace('`', '"', $text); } /* }}} */ /** @@ -245,9 +246,12 @@ class SeedDMS_Core_DatabaseAccess { * @param string $queryStr sql query * @return array/boolean data if query could be executed otherwise false */ - function getResultArray($queryStr) { /* {{{ */ + function getResultArray($queryStr, $retick=true) { /* {{{ */ $resArr = array(); + if($retick && $this->_driver == 'pgsql') { + $queryStr = $this->rbt($queryStr); + } $res = $this->_conn->query($queryStr); if ($res === false) { if($this->_debug) @@ -265,11 +269,13 @@ class SeedDMS_Core_DatabaseAccess { * Call this function only with sql query which do not return data records. * * @param string $queryStr sql query - * @param boolean $silent not used anymore. This was used when this method - * still issued an error message + * @param boolean $retick replace all '`' by '"' * @return boolean true if query could be executed otherwise false */ - function getResult($queryStr, $silent=false) { /* {{{ */ + function getResult($queryStr, $retick=true) { /* {{{ */ + if($retick && $this->_driver == 'pgsql') { + $queryStr = $this->rbt($queryStr); + } $res = $this->_conn->exec($queryStr); if($res === false) { if($this->_debug) @@ -307,8 +313,11 @@ class SeedDMS_Core_DatabaseAccess { * * @return integer id used in last autoincrement */ - function getInsertID() { /* {{{ */ - return $this->_conn->lastInsertId(); + function getInsertID($tablename='', $fieldname='id') { /* {{{ */ + if($this->_driver == 'pgsql') + return $this->_conn->lastInsertId($tablename.'_'.$fieldname.'_seq'); + else + return $this->_conn->lastInsertId(); } /* }}} */ function getErrorMsg() { /* {{{ */ From 0239edd4eef297a1956caa244e3857d5fd8a9214 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Feb 2017 09:23:12 +0100 Subject: [PATCH 02/15] adjust date function to postgresql --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 213199927..d12e723ad 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -549,6 +549,16 @@ class SeedDMS_Core_DatabaseAccess { case 'sqlite': return "strftime(".$this->qstr($format).", `".$fieldname."`, 'unixepoch')"; break; + case 'pgsql': + switch($format) { + case '%Y-%m': + return "to_char(to_timestamp(`".$fieldname."`), 'YYYY-MM')"; + break; + default: + return "to_char(to_timestamp(`".$fieldname."`), 'YYYY-MM-DD')"; + break; + } + break; } return ''; } /* }}} */ @@ -567,6 +577,9 @@ class SeedDMS_Core_DatabaseAccess { case 'sqlite': return "datetime('now', 'localtime')"; break; + case 'pgsql': + return "now()"; + break; } return ''; } /* }}} */ @@ -584,6 +597,9 @@ class SeedDMS_Core_DatabaseAccess { case 'sqlite': return "strftime('%s', 'now')"; break; + case 'pgsql': + return "date_part('epoch',CURRENT_TIMESTAMP)::int"; + break; } return ''; } /* }}} */ From cafdd457c86669273dfcc42acb0347301528d298 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Feb 2017 15:43:25 +0100 Subject: [PATCH 03/15] pass tablename to getInsertID() --- SeedDMS_Core/Core/inc.ClassDocument.php | 12 ++++++------ SeedDMS_Core/Core/inc.ClassTransmittal.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index f2aa93a91..fdcb37135 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -4100,7 +4100,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $receiptID = $db->getInsertID(); + $receiptID = $db->getInsertID('tblDocumentRecipients', 'receiptID'); } else { $receiptID = isset($indstatus["receiptID"]) ? $indstatus["receiptID"] : NULL; @@ -4162,7 +4162,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $receiptID = $db->getInsertID(); + $receiptID = $db->getInsertID('tblDocumentRecipients', 'receiptID'); } else { $receiptID = isset($status["receiptID"]) ? $status["receiptID"] : NULL; @@ -4250,7 +4250,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) { return -1; } - $revisionID = $db->getInsertID(); + $revisionID = $db->getInsertID('tblDocumentRevisors', 'revisionID'); } else { $revisionID = isset($indstatus["revisionID"]) ? $indstatus["revisionID"] : NULL; } @@ -4328,7 +4328,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; else { - $receiptLogID = $db->getInsertID(); + $receiptLogID = $db->getInsertID('tblDocumentReceiptLog', 'receiptLogID'); return $receiptLogID; } } /* }}} */ @@ -4377,7 +4377,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; else { - $receiptLogID = $db->getInsertID(); + $receiptLogID = $db->getInsertID('tblDocumentReceiptLog', 'receiptLogID'); return $receiptLogID; } } /* }}} */ @@ -4459,7 +4459,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($res) && !$res) return -1; else { - $revisionLogID = $db->getInsertID(); + $revisionLogID = $db->getInsertID('tblDocumentRevisionLog', 'revisionLogID'); return $revisionLogID; } } /* }}} */ diff --git a/SeedDMS_Core/Core/inc.ClassTransmittal.php b/SeedDMS_Core/Core/inc.ClassTransmittal.php index e0bb86674..cd63cfbe0 100644 --- a/SeedDMS_Core/Core/inc.ClassTransmittal.php +++ b/SeedDMS_Core/Core/inc.ClassTransmittal.php @@ -255,7 +255,7 @@ class SeedDMS_Core_Transmittal { if(!$res) { return false; } - $itemID = $db->getInsertID(); + $itemID = $db->getInsertID('tblTransmittalItems'); return SeedDMS_Core_TransmittalItem::getInstance($itemID, $this->_dms); } /* }}} */ From 7467df155dc4a3a3d1096224e1eef55df7554ed5 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Feb 2017 17:30:25 +0100 Subject: [PATCH 04/15] fix getInsertID() for identifier in upper/lower case --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index d12e723ad..dbd28de73 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -314,9 +314,9 @@ class SeedDMS_Core_DatabaseAccess { * @return integer id used in last autoincrement */ function getInsertID($tablename='', $fieldname='id') { /* {{{ */ - if($this->_driver == 'pgsql') - return $this->_conn->lastInsertId($tablename.'_'.$fieldname.'_seq'); - else + if($this->_driver == 'pgsql') { + return $this->_conn->lastInsertId('"'.$tablename.'_'.$fieldname.'_seq"'); + } else return $this->_conn->lastInsertId(); } /* }}} */ From e0f7c16a1075180082a4adefe98c1f61511c21af Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Feb 2017 20:09:43 +0100 Subject: [PATCH 05/15] add database layout for postgres --- install/create_tables-postgres.sql | 624 +++++++++++++++++++++++++++++ 1 file changed, 624 insertions(+) create mode 100644 install/create_tables-postgres.sql diff --git a/install/create_tables-postgres.sql b/install/create_tables-postgres.sql new file mode 100644 index 000000000..467f62f8e --- /dev/null +++ b/install/create_tables-postgres.sql @@ -0,0 +1,624 @@ +-- +-- Table structure for table "tblACLs" +-- + +CREATE TABLE "tblACLs" ( + "id" SERIAL UNIQUE, + "target" INTEGER NOT NULL default '0', + "targetType" INTEGER NOT NULL default '0', + "userID" INTEGER NOT NULL default '-1', + "groupID" INTEGER NOT NULL default '-1', + "mode" INTEGER NOT NULL default '0' +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblCategory" +-- + +CREATE TABLE "tblCategory" ( + "id" SERIAL UNIQUE, + "name" text NOT NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblAttributeDefinitions" +-- + +CREATE TABLE "tblAttributeDefinitions" ( + "id" SERIAL UNIQUE, + "name" varchar(100) default NULL, + "objtype" INTEGER NOT NULL default '0', + "type" INTEGER NOT NULL default '0', + "multiple" INTEGER NOT NULL default '0', + "minvalues" INTEGER NOT NULL default '0', + "maxvalues" INTEGER NOT NULL default '0', + "valueset" TEXT default NULL, + "regex" TEXT DEFAULT NULL, + UNIQUE("name") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblUsers" +-- + +CREATE TABLE "tblUsers" ( + "id" SERIAL UNIQUE, + "login" varchar(50) default NULL, + "pwd" varchar(50) default NULL, + "fullName" varchar(100) default NULL, + "email" varchar(70) default NULL, + "language" varchar(32) NOT NULL, + "theme" varchar(32) NOT NULL, + "comment" text NOT NULL, + "role" INTEGER NOT NULL default '0', + "hidden" INTEGER NOT NULL default '0', + "pwdExpiration" TIMESTAMP default NULL, + "loginfailures" INTEGER NOT NULL default '0', + "disabled" INTEGER NOT NULL default '0', + "quota" INTEGER, + "homefolder" INTEGER default NULL, + UNIQUE ("login") +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblUserPasswordRequest" +-- + +CREATE TABLE "tblUserPasswordRequest" ( + "id" SERIAL UNIQUE, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" (id) ON DELETE CASCADE, + "hash" varchar(50) default NULL, + "date" TIMESTAMP default NULL +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblUserPasswordHistory" +-- + +CREATE TABLE "tblUserPasswordHistory" ( + "id" SERIAL UNIQUE, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "pwd" varchar(50) default NULL, + "date" TIMESTAMP default NULL +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblUserImages" +-- + +CREATE TABLE "tblUserImages" ( + "id" SERIAL UNIQUE, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "image" TEXT NOT NULL, + "mimeType" varchar(10) NOT NULL default '' +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblFolders" +-- + +CREATE TABLE "tblFolders" ( + "id" SERIAL UNIQUE, + "name" varchar(70) default NULL, + "parent" INTEGER default NULL, + "folderList" text NOT NULL, + "comment" text, + "date" INTEGER default NULL, + "owner" INTEGER default NULL REFERENCES "tblUsers" ("id"), + "inheritAccess" INTEGER NOT NULL default '1', + "defaultAccess" INTEGER NOT NULL default '0', + "sequence" REAL NOT NULL default '0' +) ; + +ALTER TABLE "tblUsers" ADD FOREIGN KEY("homefolder") REFERENCES "tblFolders"("id"); + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblFolderAttributes" +-- + +CREATE TABLE "tblFolderAttributes" ( + "id" SERIAL UNIQUE, + "folder" INTEGER default NULL REFERENCES "tblFolders" ("id") ON DELETE CASCADE, + "attrdef" INTEGER default NULL REFERENCES "tblAttributeDefinitions" ("id"), + "value" text default NULL, + UNIQUE (folder, attrdef) +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocuments" +-- + +CREATE TABLE "tblDocuments" ( + "id" SERIAL UNIQUE, + "name" varchar(150) default NULL, + "comment" text, + "date" INTEGER default NULL, + "expires" INTEGER default NULL, + "owner" INTEGER default NULL REFERENCES "tblUsers" ("id"), + "folder" INTEGER default NULL REFERENCES "tblFolders" ("id"), + "folderList" text NOT NULL, + "inheritAccess" INTEGER NOT NULL default '1', + "defaultAccess" INTEGER NOT NULL default '0', + "locked" INTEGER NOT NULL default '-1', + "keywords" text NOT NULL, + "sequence" REAL NOT NULL default '0' +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentAttributes" +-- + +CREATE TABLE "tblDocumentAttributes" ( + "id" SERIAL UNIQUE, + "document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "attrdef" INTEGER default NULL REFERENCES "tblAttributeDefinitions" ("id"), + "value" text default NULL, + UNIQUE (document, attrdef) +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentApprovers" +-- + +CREATE TABLE "tblDocumentApprovers" ( + "approveID" SERIAL UNIQUE, + "documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + "type" INTEGER NOT NULL default '0', + "required" INTEGER NOT NULL default '0', + UNIQUE ("documentID","version","type","required") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentApproveLog" +-- + +CREATE TABLE "tblDocumentApproveLog" ( + "approveLogID" SERIAL UNIQUE, + "approveID" INTEGER NOT NULL default '0' REFERENCES "tblDocumentApprovers" ("approveID") ON DELETE CASCADE, + "status" INTEGER NOT NULL default '0', + "comment" TEXT NOT NULL, + "date" TIMESTAMP default NULL, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentContent" +-- + +CREATE TABLE "tblDocumentContent" ( + "id" SERIAL UNIQUE, + "document" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id"), + "version" INTEGER NOT NULL, + "comment" text, + "date" INTEGER default NULL, + "createdBy" INTEGER default NULL, + "dir" varchar(255) NOT NULL default '', + "orgFileName" varchar(150) NOT NULL default '', + "fileType" varchar(10) NOT NULL default '', + "mimeType" varchar(70) NOT NULL default '', + "fileSize" INTEGER, + "checksum" char(32), + UNIQUE ("document","version") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentContentAttributes" +-- + +CREATE TABLE "tblDocumentContentAttributes" ( + "id" SERIAL UNIQUE, + "content" INTEGER default NULL REFERENCES "tblDocumentContent" ("id") ON DELETE CASCADE, + "attrdef" INTEGER default NULL REFERENCES "tblAttributeDefinitions" ("id"), + "value" text default NULL, + UNIQUE (content, attrdef) +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentLinks" +-- + +CREATE TABLE "tblDocumentLinks" ( + "id" SERIAL UNIQUE, + "document" INTEGER NOT NULL default 0 REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "target" INTEGER NOT NULL default 0 REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id"), + "public" INTEGER NOT NULL default 0 +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentFiles" +-- + +CREATE TABLE "tblDocumentFiles" ( + "id" SERIAL UNIQUE, + "document" INTEGER NOT NULL default 0 REFERENCES "tblDocuments" ("id"), + "userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id"), + "comment" text, + "name" varchar(150) default NULL, + "date" INTEGER default NULL, + "dir" varchar(255) NOT NULL default '', + "orgFileName" varchar(150) NOT NULL default '', + "fileType" varchar(10) NOT NULL default '', + "mimeType" varchar(70) NOT NULL default '' +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentLocks" +-- + +CREATE TABLE "tblDocumentLocks" ( + "document" INTEGER REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentReviewers" +-- + +CREATE TABLE "tblDocumentReviewers" ( + "reviewID" SERIAL UNIQUE, + "documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + "type" INTEGER NOT NULL default '0', + "required" INTEGER NOT NULL default '0', + UNIQUE ("documentID","version","type","required") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentReviewLog" +-- + +CREATE TABLE "tblDocumentReviewLog" ( + "reviewLogID" SERIAL UNIQUE, + "reviewID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentReviewers" ("reviewID") ON DELETE CASCADE, + "status" INTEGER NOT NULL default 0, + "comment" TEXT NOT NULL, + "date" TIMESTAMP NOT NULL, + "userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentStatus" +-- + +CREATE TABLE "tblDocumentStatus" ( + "statusID" SERIAL UNIQUE, + "documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + UNIQUE ("documentID","version") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentStatusLog" +-- + +CREATE TABLE "tblDocumentStatusLog" ( + "statusLogID" SERIAL UNIQUE, + "statusID" INTEGER NOT NULL default '0' REFERENCES "tblDocumentStatus" ("statusID") ON DELETE CASCADE, + "status" INTEGER NOT NULL default '0', + "comment" text NOT NULL, + "date" TIMESTAMP default NULL, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblGroups" +-- + +CREATE TABLE "tblGroups" ( + "id" SERIAL UNIQUE, + "name" varchar(50) default NULL, + "comment" text NOT NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblGroupMembers" +-- + +CREATE TABLE "tblGroupMembers" ( + "groupID" INTEGER NOT NULL default '0' REFERENCES "tblGroups" ("id") ON DELETE CASCADE, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "manager" INTEGER NOT NULL default '0', + UNIQUE ("groupID","userID") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblKeywordCategories" +-- + +CREATE TABLE "tblKeywordCategories" ( + "id" SERIAL UNIQUE, + "name" varchar(255) NOT NULL default '', + "owner" INTEGER NOT NULL default '0' +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblKeywords" +-- + +CREATE TABLE "tblKeywords" ( + "id" SERIAL UNIQUE, + "category" INTEGER NOT NULL default '0' REFERENCES "tblKeywordCategories" ("id") ON DELETE CASCADE, + "keywords" text NOT NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentCategory" +-- + +CREATE TABLE "tblDocumentCategory" ( + "categoryID" INTEGER NOT NULL default '0' REFERENCES "tblCategory" ("id") ON DELETE CASCADE, + "documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblNotify" +-- + +CREATE TABLE "tblNotify" ( + "target" INTEGER NOT NULL default '0', + "targetType" INTEGER NOT NULL default '0', + "userID" INTEGER NOT NULL default '-1', + "groupID" INTEGER NOT NULL default '-1', + UNIQUE ("target","targetType","userID","groupID") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblSessions" +-- + +CREATE TABLE "tblSessions" ( + "id" varchar(50) PRIMARY KEY, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "lastAccess" INTEGER NOT NULL default '0', + "theme" varchar(30) NOT NULL default '', + "language" varchar(30) NOT NULL default '', + "clipboard" text default NULL, + "su" INTEGER DEFAULT NULL, + "splashmsg" text default NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for mandatory reviewers +-- + +CREATE TABLE "tblMandatoryReviewers" ( + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "reviewerUserID" INTEGER NOT NULL default '0', + "reviewerGroupID" INTEGER NOT NULL default '0', + UNIQUE ("userID","reviewerUserID","reviewerGroupID") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for mandatory approvers +-- + +CREATE TABLE "tblMandatoryApprovers" ( + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "approverUserID" INTEGER NOT NULL default '0', + "approverGroupID" INTEGER NOT NULL default '0', + UNIQUE ("userID","approverUserID","approverGroupID") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for events (calendar) +-- + +CREATE TABLE "tblEvents" ( + "id" SERIAL UNIQUE, + "name" varchar(150) default NULL, + "comment" text, + "start" INTEGER default NULL, + "stop" INTEGER default NULL, + "date" INTEGER default NULL, + "userID" INTEGER NOT NULL default '0' +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow states +-- + +CREATE TABLE "tblWorkflowStates" ( + "id" SERIAL UNIQUE, + "name" text NOT NULL, + "visibility" INTEGER DEFAULT 0, + "maxtime" INTEGER DEFAULT 0, + "precondfunc" text DEFAULT NULL, + "documentstatus" INTEGER DEFAULT NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow actions +-- + +CREATE TABLE "tblWorkflowActions" ( + "id" SERIAL UNIQUE, + "name" text NOT NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflows +-- + +CREATE TABLE "tblWorkflows" ( + "id" SERIAL UNIQUE, + "name" text NOT NULL, + "initstate" INTEGER NOT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow transitions +-- + +CREATE TABLE "tblWorkflowTransitions" ( + "id" SERIAL UNIQUE, + "workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE, + "state" INTEGER default NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE, + "action" INTEGER default NULL REFERENCES "tblWorkflowActions" ("id") ON DELETE CASCADE, + "nextstate" INTEGER default NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE, + "maxtime" INTEGER DEFAULT 0 +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow transition users +-- + +CREATE TABLE "tblWorkflowTransitionUsers" ( + "id" SERIAL UNIQUE, + "transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE, + "userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow transition groups +-- + +CREATE TABLE "tblWorkflowTransitionGroups" ( + "id" SERIAL UNIQUE, + "transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE, + "groupid" INTEGER default NULL REFERENCES "tblGroups" ("id") ON DELETE CASCADE, + "minusers" INTEGER default NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow log +-- + +CREATE TABLE "tblWorkflowLog" ( + "id" SERIAL UNIQUE, + "document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER default NULL, + "workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE, + "userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE, + "date" TIMESTAMP default NULL, + "comment" text +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for workflow document relation +-- + +CREATE TABLE "tblWorkflowDocumentContent" ( + "parentworkflow" INTEGER DEFAULT 0, + "workflow" INTEGER DEFAULT NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE, + "document" INTEGER DEFAULT NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER DEFAULT NULL, + "state" INTEGER DEFAULT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE, + "date" TIMESTAMP default NULL +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for mandatory workflows +-- + +CREATE TABLE "tblWorkflowMandatoryWorkflow" ( + "userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE, + UNIQUE(userid, workflow) +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for version +-- + +CREATE TABLE "tblVersion" ( + "date" TIMESTAMP default NULL, + "major" INTEGER, + "minor" INTEGER, + "subminor" INTEGER +) ; + +-- -------------------------------------------------------- + +-- +-- Initial content for database +-- + +INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, NULL, 0, 0, 0, NULL); +INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL); +INSERT INTO "tblFolders" VALUES (1, 'DMS', 0, '', 'DMS root', extract(epoch from now()), 1, 0, 2, 0); +INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 5, 0, 0); From b1bd6663865435bc25fa7499e22b6f4214c35204 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Feb 2017 22:05:15 +0100 Subject: [PATCH 06/15] update to 5.1.x --- install/create_tables-postgres.sql | 191 ++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 4 deletions(-) diff --git a/install/create_tables-postgres.sql b/install/create_tables-postgres.sql index 467f62f8e..347c60ae2 100644 --- a/install/create_tables-postgres.sql +++ b/install/create_tables-postgres.sql @@ -43,6 +43,19 @@ CREATE TABLE "tblAttributeDefinitions" ( -- -------------------------------------------------------- +-- +-- Table structure for table `tblUsers` +-- + +CREATE TABLE "tblRoles" ( + "id" SERIAL UNIQUE, + "name" varchar(50) default NULL, + "role" INTEGER NOT NULL default '0', + "noaccess" varchar(30) NOT NULL default '' +) ; + +-- -------------------------------------------------------- + -- -- Table structure for table "tblUsers" -- @@ -51,6 +64,7 @@ CREATE TABLE "tblUsers" ( "id" SERIAL UNIQUE, "login" varchar(50) default NULL, "pwd" varchar(50) default NULL, + "secret" varchar(50) default NULL, "fullName" varchar(100) default NULL, "email" varchar(70) default NULL, "language" varchar(32) NOT NULL, @@ -68,6 +82,18 @@ CREATE TABLE "tblUsers" ( -- -------------------------------------------------------- +-- +-- Table structure for table `tblUserSubstitutes` +-- + +CREATE TABLE "tblUserSubstitutes" ( + "id" SERIAL UNIQUE, + "user" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "substitute" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE +); + +-- -------------------------------------------------------- + -- -- Table structure for table "tblUserPasswordRequest" -- @@ -225,6 +251,7 @@ CREATE TABLE "tblDocumentContent" ( "mimeType" varchar(70) NOT NULL default '', "fileSize" INTEGER, "checksum" char(32), + "revisiondate" TIMESTAMP default NULL, UNIQUE ("document","version") ) ; @@ -288,6 +315,21 @@ CREATE TABLE "tblDocumentLocks" ( -- -------------------------------------------------------- +-- +-- Table structure for table `tblDocumentCheckOuts` +-- + +CREATE TABLE "tblDocumentCheckOuts" ( + "document" INTEGER REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id"), + "date" TEXT NOT NULL, + "filename" varchar(255) NOT NULL default '', + UNIQUE ("document") +) ; + +-- -------------------------------------------------------- + -- -- Table structure for table "tblDocumentReviewers" -- @@ -318,6 +360,67 @@ CREATE TABLE "tblDocumentReviewLog" ( -- -------------------------------------------------------- +-- +-- Table structure for table `tblDocumentRecipients` +-- + +CREATE TABLE "tblDocumentRecipients" ( + "receiptID" SERIAL UNIQUE, + "documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + "type" INTEGER NOT NULL default '0', + "required" INTEGER NOT NULL default '0', + UNIQUE ("documentID","version","type","required") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentReceiptLog" +-- + +CREATE TABLE "tblDocumentReceiptLog" ( + "receiptLogID" SERIAL UNIQUE, + "receiptID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentRecipients" ("receiptID") ON DELETE CASCADE, + "status" INTEGER NOT NULL default 0, + "comment" TEXT NOT NULL, + "date" TEXT NOT NULL, + "userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `tblDocumentRevisors` +-- + +CREATE TABLE "tblDocumentRevisors" ( + "revisionID" SERIAL UNIQUE, + "documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + "type" INTEGER NOT NULL default '0', + "required" INTEGER NOT NULL default '0', + "startdate" TIMESTAMP default NULL, + UNIQUE ("documentID","version","type","required") +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table "tblDocumentRevisionLog" +-- + +CREATE TABLE "tblDocumentRevisionLog" ( + "revisionLogID" SERIAL UNIQUE, + "revisionID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentRevisors" ("revisionID") ON DELETE CASCADE, + "status" INTEGER NOT NULL default 0, + "comment" TEXT NOT NULL, + "date" TIMESTAMP default NULL, + "userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE +) ; + +-- -------------------------------------------------------- + -- -- Table structure for table "tblDocumentStatus" -- @@ -512,7 +615,8 @@ CREATE TABLE "tblWorkflowActions" ( CREATE TABLE "tblWorkflows" ( "id" SERIAL UNIQUE, "name" text NOT NULL, - "initstate" INTEGER NOT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE + "initstate" INTEGER NOT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE, + "layoutdata" text default NULL ) ; -- -------------------------------------------------------- @@ -601,6 +705,82 @@ CREATE TABLE "tblWorkflowMandatoryWorkflow" ( -- -------------------------------------------------------- +-- +-- Table structure for transmittal +-- + +CREATE TABLE "tblTransmittals" ( + "id" SERIAL UNIQUE, + "name" text NOT NULL, + "comment" text NOT NULL, + "userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE, + "date" TIMESTAMP default NULL, + "public" INTEGER NOT NULL default '0' +); + +-- -------------------------------------------------------- + +-- +-- Table structure for transmittal item +-- + +CREATE TABLE "tblTransmittalItems" ( + "id" SERIAL UNIQUE, + "transmittal" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblTransmittals" ("id") ON DELETE CASCADE, + "document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, + "version" INTEGER NOT NULL default '0', + "date" TIMESTAMP default NULL, + UNIQUE (transmittal, document, version) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for access request objects +-- + +CREATE TABLE "tblAros" ( + "id" SERIAL UNIQUE, + "parent" INTEGER, + "model" TEXT NOT NULL, + "foreignid" INTEGER NOT NULL DEFAULT '0', + "alias" TEXT +) ; + + +-- -------------------------------------------------------- + +-- +-- Table structure for access control objects +-- + +CREATE TABLE "tblAcos" ( + "id" SERIAL UNIQUE, + "parent" INTEGER, + "model" TEXT NOT NULL, + "foreignid" INTEGER NOT NULL DEFAULT '0', + "alias" TEXT +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for acos/aros relation +-- + +CREATE TABLE "tblArosAcos" ( + "id" SERIAL UNIQUE, + "aro" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblAros" ("id") ON DELETE CASCADE, + "aco" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblAcos" ("id") ON DELETE CASCADE, + "create" INTEGER NOT NULL DEFAULT '-1', + "read" INTEGER NOT NULL DEFAULT '-1', + "update" INTEGER NOT NULL DEFAULT '-1', + "delete" INTEGER NOT NULL DEFAULT '-1', + UNIQUE (aco, aro) +) ; + +-- -------------------------------------------------------- + -- -- Table structure for version -- @@ -618,7 +798,10 @@ CREATE TABLE "tblVersion" ( -- Initial content for database -- -INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, NULL, 0, 0, 0, NULL); -INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL); +INSERT INTO "tblRoles" ("id", "name", "role") VALUES (1, 'Admin', 1); +INSERT INTO "tblRoles" ("id", "name", "role") VALUES (2, 'Guest', 2); +INSERT INTO "tblRoles" ("id", "name", "role") VALUES (3, 'User', 0); +INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 'Administrator', 'address@server.com', '', '', '', 1, 0, NULL, 0, 0, 0, NULL); +INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, '', 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL); INSERT INTO "tblFolders" VALUES (1, 'DMS', 0, '', 'DMS root', extract(epoch from now()), 1, 0, 2, 0); -INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 5, 0, 0); +INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 5, 1, 0); From 2c775b560fabdb2be2c99ab91862760258786c8b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 07:12:34 +0100 Subject: [PATCH 07/15] add creation of temp table ttcontentid --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index dbd28de73..bdbc73b20 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -442,6 +442,14 @@ class SeedDMS_Core_DatabaseAccess { "GROUP BY `tblDocumentContent`.`document` ". "ORDER BY `tblDocumentContent`.`document`"; break; + case 'pgsql': + $queryStr = "CREATE TEMPORARY TABLE `ttcontentid` (`document` INTEGER, `maxVersion` INTEGER, PRIMARY KEY (`document`)); ". + "INSERT INTO `ttcontentid` SELECT `tblDocumentContent`.`document` AS `document`, ". + "MAX(`tblDocumentContent`.`version`) AS `maxVersion` ". + "FROM `tblDocumentContent` ". + "GROUP BY `tblDocumentContent`.`document` ". + "ORDER BY `tblDocumentContent`.`document`"; + break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttcontentid` (PRIMARY KEY (`document`), INDEX (`maxVersion`)) ". "SELECT `tblDocumentContent`.`document`, ". From 1a03adebbdedd4844d0e020d313abdd9308e3fa8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 08:18:06 +0100 Subject: [PATCH 08/15] add create of temp table ttstatid --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index bdbc73b20..92a3e7c4a 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -409,6 +409,14 @@ class SeedDMS_Core_DatabaseAccess { "GROUP BY `tblDocumentStatusLog`.`statusID` ". "ORDER BY `maxLogID`"; break; + case 'pgsql': + $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (`statusID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`statusID`));". + "INSERT INTO `ttstatid` SELECT `tblDocumentStatusLog`.`statusID`, ". + "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". + "FROM `tblDocumentStatusLog` ". + "GROUP BY `tblDocumentStatusLog`.`statusID` ". + "ORDER BY `maxLogID`"; + break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (PRIMARY KEY (`statusID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentStatusLog`.`statusID`, ". @@ -443,7 +451,7 @@ class SeedDMS_Core_DatabaseAccess { "ORDER BY `tblDocumentContent`.`document`"; break; case 'pgsql': - $queryStr = "CREATE TEMPORARY TABLE `ttcontentid` (`document` INTEGER, `maxVersion` INTEGER, PRIMARY KEY (`document`)); ". + $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttcontentid` (`document` INTEGER, `maxVersion` INTEGER, PRIMARY KEY (`document`)); ". "INSERT INTO `ttcontentid` SELECT `tblDocumentContent`.`document` AS `document`, ". "MAX(`tblDocumentContent`.`version`) AS `maxVersion` ". "FROM `tblDocumentContent` ". From 50919f40c162e4302bec827566995e022c4f9238 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 10:38:52 +0100 Subject: [PATCH 09/15] add sql for creating temp tables ttreviewid and ttapproveid --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 92a3e7c4a..20d6a5474 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -343,6 +343,14 @@ class SeedDMS_Core_DatabaseAccess { "GROUP BY `tblDocumentReviewLog`.`reviewID` ". "ORDER BY `maxLogID`"; break; + case 'pgsql': + $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (`reviewID` INTEGER, `maxLogID` INTEGER, PRIMARY INDEX (`reviewID`));". + "INSERT INTO `ttreviewid` SELECT `tblDocumentReviewLog`.`reviewID`, ". + "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". + "FROM `tblDocumentReviewLog` ". + "GROUP BY `tblDocumentReviewLog`.`reviewID` ". + "ORDER BY `maxLogID`"; + break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentReviewLog`.`reviewID`, ". @@ -376,6 +384,14 @@ class SeedDMS_Core_DatabaseAccess { "GROUP BY `tblDocumentApproveLog`.`approveID` ". "ORDER BY `maxLogID`"; break; + case 'pgsql': + $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (`approveID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`approveID`));". + "INSERT INTO `ttapproveid` SELECT `tblDocumentApproveLog`.`approveID`, ". + "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". + "FROM `tblDocumentApproveLog` ". + "GROUP BY `tblDocumentApproveLog`.`approveID` ". + "ORDER BY `maxLogID`"; + break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (PRIMARY KEY (`approveID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentApproveLog`.`approveID`, ". From bfbd845bab885ca831d8dce5849a81c847c23e6a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 10:44:27 +0100 Subject: [PATCH 10/15] add sql code for creating temp tables ttreceiptid and ttrevisionid --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 20d6a5474..00e5ecfc3 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -507,6 +507,14 @@ class SeedDMS_Core_DatabaseAccess { "GROUP BY `tblDocumentReceiptLog`.`receiptID` ". "ORDER BY `maxLogID`"; break; + case 'pgsql': + $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreceiptid` (`receiptID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`receiptID`);". + "INSERT INTO `ttreceiptid` SELECT `tblDocumentReceiptLog`.`receiptID`, ". + "MAX(`tblDocumentReceiptLog`.`receiptLogID`) AS `maxLogID` ". + "FROM `tblDocumentReceiptLog` ". + "GROUP BY `tblDocumentReceiptLog`.`receiptID` ". + "ORDER BY `maxLogID`"; + break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreceiptid` (PRIMARY KEY (`receiptID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentReceiptLog`.`receiptID`, ". @@ -540,6 +548,14 @@ class SeedDMS_Core_DatabaseAccess { "GROUP BY `tblDocumentRevisionLog`.`revisionID` ". "ORDER BY `maxLogID`"; break; + case 'pgsql': + $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttrevisionid` (`revisionID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`revisionID`));". + "INSERT INTO `ttrevisionid` 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`, ". From a18b3c68790f4a230836a35f69759ebcc2197040 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 17:27:38 +0100 Subject: [PATCH 11/15] add sql statement for pgsql in TableList() --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 00e5ecfc3..bd9257b48 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -117,6 +117,9 @@ class SeedDMS_Core_DatabaseAccess { case 'sqlite': $sql = "select tbl_name as name from sqlite_master where type='table'"; break; + case 'pgsql': + $sql = "select tablename as name from pg_catalog.pg_tables where schemaname='public'"; + break; default: return false; } From 8988bc0098019a7be7355e972f8d50d71144033b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 17:54:22 +0100 Subject: [PATCH 12/15] make mimeType varchar(100) in tblDocumentContents and tblDocumentFiles --- install/create_tables-postgres.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/create_tables-postgres.sql b/install/create_tables-postgres.sql index 347c60ae2..7a9592479 100644 --- a/install/create_tables-postgres.sql +++ b/install/create_tables-postgres.sql @@ -248,7 +248,7 @@ CREATE TABLE "tblDocumentContent" ( "dir" varchar(255) NOT NULL default '', "orgFileName" varchar(150) NOT NULL default '', "fileType" varchar(10) NOT NULL default '', - "mimeType" varchar(70) NOT NULL default '', + "mimeType" varchar(100) NOT NULL default '', "fileSize" INTEGER, "checksum" char(32), "revisiondate" TIMESTAMP default NULL, @@ -299,7 +299,7 @@ CREATE TABLE "tblDocumentFiles" ( "dir" varchar(255) NOT NULL default '', "orgFileName" varchar(150) NOT NULL default '', "fileType" varchar(10) NOT NULL default '', - "mimeType" varchar(70) NOT NULL default '' + "mimeType" varchar(100) NOT NULL default '' ) ; -- -------------------------------------------------------- From a761b0b41791e8b68960f7761f2fce7f59d93e54 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 21:05:29 +0100 Subject: [PATCH 13/15] set pwdexpiration to '' if it is '0000-00-00' --- utils/xmlimport.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/xmlimport.php b/utils/xmlimport.php index 510284121..261bf279c 100644 --- a/utils/xmlimport.php +++ b/utils/xmlimport.php @@ -114,6 +114,8 @@ function insert_user($user) { /* {{{ */ $logger->info("User '".$user['attributes']['login']."' already exists"); } else { if(in_array('users', $sections)) { + if(substr($user['attributes']['pwdexpiration'], 0, 10) == '0000-00-00') + $user['attributes']['pwdexpiration'] = ''; $newUser = $dms->addUser( $user['attributes']['login'], $user['attributes']['pwd'], @@ -230,6 +232,7 @@ function insert_role($role) { /* {{{ */ $logger->err("Could not add role"); return false; } + /* if($aro = SeedDMS_Aro::getInstance($newRole, $dms)) { $logger->info("Added aro"); if($role['acos']) { @@ -251,6 +254,7 @@ function insert_role($role) { /* {{{ */ $logger->err("Could not add Aro"); return false; } + */ } else { $newRole = null; } @@ -1852,6 +1856,7 @@ require_once("SeedDMS/Core.php"); $db = new SeedDMS_Core_DatabaseAccess($settings->_dbDriver, $settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase); $db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostname . "\""); +$db->_debug = 1; $dms = new SeedDMS_Core_DMS($db, $settings->_contentDir.$settings->_contentOffsetDir); if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) { From d7403d3745359081ce1c87039062ccdd7b17975a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 21:06:06 +0100 Subject: [PATCH 14/15] set sequence after insert --- install/create_tables-postgres.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install/create_tables-postgres.sql b/install/create_tables-postgres.sql index 7a9592479..d2d0f10c0 100644 --- a/install/create_tables-postgres.sql +++ b/install/create_tables-postgres.sql @@ -799,9 +799,15 @@ CREATE TABLE "tblVersion" ( -- INSERT INTO "tblRoles" ("id", "name", "role") VALUES (1, 'Admin', 1); +SELECT nextval('"tblRoles_id_seq"'); INSERT INTO "tblRoles" ("id", "name", "role") VALUES (2, 'Guest', 2); +SELECT nextval('"tblRoles_id_seq"'); INSERT INTO "tblRoles" ("id", "name", "role") VALUES (3, 'User', 0); +SELECT nextval('"tblRoles_id_seq"'); INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 'Administrator', 'address@server.com', '', '', '', 1, 0, NULL, 0, 0, 0, NULL); +SELECT nextval('"tblUsers_id_seq"'); INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, '', 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL); +SELECT nextval('"tblUsers_id_seq"'); INSERT INTO "tblFolders" VALUES (1, 'DMS', 0, '', 'DMS root', extract(epoch from now()), 1, 0, 2, 0); +SELECT nextval('"tblFolders_id_seq"'); INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 5, 1, 0); From 283c51b19354b3822c71aa28be1640b84aa5e5af Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Feb 2017 21:06:36 +0100 Subject: [PATCH 15/15] print_r detailed error msg --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index bd9257b48..d339d40fb 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -257,8 +257,10 @@ class SeedDMS_Core_DatabaseAccess { } $res = $this->_conn->query($queryStr); if ($res === false) { - if($this->_debug) + if($this->_debug) { echo "error: ".$queryStr."
"; + print_r($this->_conn->errorInfo()); + } return false; } $resArr = $res->fetchAll(PDO::FETCH_ASSOC); @@ -281,8 +283,10 @@ class SeedDMS_Core_DatabaseAccess { } $res = $this->_conn->exec($queryStr); if($res === false) { - if($this->_debug) + if($this->_debug) { echo "error: ".$queryStr."
"; + print_r($this->_conn->errorInfo()); + } return false; } else return true;