mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 05:31:42 +00:00
pass tablename to getInsertID(), add pgsql as new db driver
This commit is contained in:
parent
502b5c5414
commit
307abdf493
|
@ -1288,7 +1288,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$res)
|
if (!$res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$user = $this->getUser($this->db->getInsertID());
|
$user = $this->getUser($this->db->getInsertID('tblUsers'));
|
||||||
|
|
||||||
/* Check if 'onPostAddUser' callback is set */
|
/* Check if 'onPostAddUser' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddUser'])) {
|
if(isset($this->_dms->callbacks['onPostAddUser'])) {
|
||||||
|
@ -1350,7 +1350,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$this->db->getResult($queryStr))
|
if (!$this->db->getResult($queryStr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$group = $this->getGroup($this->db->getInsertID());
|
$group = $this->getGroup($this->db->getInsertID('tblGroups'));
|
||||||
|
|
||||||
/* Check if 'onPostAddGroup' callback is set */
|
/* Check if 'onPostAddGroup' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddGroup'])) {
|
if(isset($this->_dms->callbacks['onPostAddGroup'])) {
|
||||||
|
@ -1439,7 +1439,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$this->db->getResult($queryStr))
|
if (!$this->db->getResult($queryStr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$category = $this->getKeywordCategory($this->db->getInsertID());
|
$category = $this->getKeywordCategory($this->db->getInsertID('tblKeywordCategories'));
|
||||||
|
|
||||||
/* Check if 'onPostAddKeywordCategory' callback is set */
|
/* Check if 'onPostAddKeywordCategory' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) {
|
if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) {
|
||||||
|
@ -1515,7 +1515,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$this->db->getResult($queryStr))
|
if (!$this->db->getResult($queryStr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$category = $this->getDocumentCategory($this->db->getInsertID());
|
$category = $this->getDocumentCategory($this->db->getInsertID('tblCategory'));
|
||||||
|
|
||||||
/* Check if 'onPostAddDocumentCategory' callback is set */
|
/* Check if 'onPostAddDocumentCategory' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) {
|
if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) {
|
||||||
|
@ -1714,7 +1714,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$res)
|
if (!$res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return $this->getAttributeDefinition($this->db->getInsertID());
|
return $this->getAttributeDefinition($this->db->getInsertID('tblAttributeDefinitions'));
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1815,7 +1815,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$res)
|
if (!$res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return $this->getWorkflow($db->getInsertID());
|
return $this->getWorkflow($db->getInsertID('tblWorkflows'));
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1908,7 +1908,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$res)
|
if (!$res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return $this->getWorkflowState($db->getInsertID());
|
return $this->getWorkflowState($db->getInsertID('tblWorkflowStates'));
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1998,7 +1998,7 @@ class SeedDMS_Core_DMS {
|
||||||
if (!$res)
|
if (!$res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return $this->getWorkflowAction($db->getInsertID());
|
return $this->getWorkflowAction($db->getInsertID('tblWorkflowActions'));
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1242,7 +1242,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contentID = $db->getInsertID();
|
$contentID = $db->getInsertID('tblDocumentContent');
|
||||||
|
|
||||||
// copy file
|
// copy file
|
||||||
if (!SeedDMS_Core_File::makeDir($this->_dms->contentDir . $dir)) {
|
if (!SeedDMS_Core_File::makeDir($this->_dms->contentDir . $dir)) {
|
||||||
|
@ -1288,7 +1288,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusID = $db->getInsertID();
|
$statusID = $db->getInsertID('tblDocumentStatus', 'statusID');
|
||||||
|
|
||||||
if($workflow)
|
if($workflow)
|
||||||
$content->setWorkflow($workflow, $user);
|
$content->setWorkflow($workflow, $user);
|
||||||
|
@ -1791,7 +1791,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).")";
|
"(".$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;
|
if (!$db->getResult($queryStr)) return false;
|
||||||
|
|
||||||
$id = $db->getInsertID();
|
$id = $db->getInsertID('tblDocumentFiles');
|
||||||
|
|
||||||
$file = $this->getDocumentFile($id);
|
$file = $this->getDocumentFile($id);
|
||||||
if (is_bool($file) && !$file) return false;
|
if (is_bool($file) && !$file) return false;
|
||||||
|
@ -2788,7 +2788,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$reviewID = $db->getInsertID();
|
$reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID');
|
||||||
$reviewlog = array_reverse($review['logs']);
|
$reviewlog = array_reverse($review['logs']);
|
||||||
foreach($reviewlog as $log) {
|
foreach($reviewlog as $log) {
|
||||||
if(!SeedDMS_Core_DMS::checkDate($log['date'], 'Y-m-d H:i:s')) {
|
if(!SeedDMS_Core_DMS::checkDate($log['date'], 'Y-m-d H:i:s')) {
|
||||||
|
@ -2801,7 +2801,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$reviewLogID = $db->getInsertID();
|
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
|
||||||
if(!empty($log['file'])) {
|
if(!empty($log['file'])) {
|
||||||
SeedDMS_Core_File::copyFile($log['file'], $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
|
SeedDMS_Core_File::copyFile($log['file'], $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
|
||||||
}
|
}
|
||||||
|
@ -2916,7 +2916,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$reviewID = $db->getInsertID();
|
$reviewID = $db->getInsertID('tblDocumentApprovers', 'approveID');
|
||||||
$reviewlog = array_reverse($review['logs']);
|
$reviewlog = array_reverse($review['logs']);
|
||||||
foreach($reviewlog as $log) {
|
foreach($reviewlog as $log) {
|
||||||
if(!SeedDMS_Core_DMS::checkDate($log['date'], 'Y-m-d H:i:s')) {
|
if(!SeedDMS_Core_DMS::checkDate($log['date'], 'Y-m-d H:i:s')) {
|
||||||
|
@ -2929,7 +2929,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$approveLogID = $db->getInsertID();
|
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
|
||||||
if(!empty($log['file'])) {
|
if(!empty($log['file'])) {
|
||||||
SeedDMS_Core_File::copyFile($log['file'], $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
|
SeedDMS_Core_File::copyFile($log['file'], $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
|
||||||
}
|
}
|
||||||
|
@ -2987,7 +2987,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
$reviewID = $db->getInsertID();
|
$reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$reviewID = isset($indstatus["reviewID"]) ? $indstatus["reviewID"] : NULL;
|
$reviewID = isset($indstatus["reviewID"]) ? $indstatus["reviewID"] : NULL;
|
||||||
|
@ -3045,7 +3045,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
$reviewID = $db->getInsertID();
|
$reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$reviewID = isset($reviewStatus[0]["reviewID"])?$reviewStatus[0]["reviewID"]:NULL;
|
$reviewID = isset($reviewStatus[0]["reviewID"])?$reviewStatus[0]["reviewID"]:NULL;
|
||||||
|
@ -3115,7 +3115,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res)
|
if (is_bool($res) && !$res)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
$reviewLogID = $db->getInsertID();
|
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
|
||||||
if($file) {
|
if($file) {
|
||||||
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
|
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
|
||||||
}
|
}
|
||||||
|
@ -3167,7 +3167,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res)
|
if (is_bool($res) && !$res)
|
||||||
return -1;
|
return -1;
|
||||||
else {
|
else {
|
||||||
$reviewLogID = $db->getInsertID();
|
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
|
||||||
if($file) {
|
if($file) {
|
||||||
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
|
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
|
||||||
}
|
}
|
||||||
|
@ -3220,7 +3220,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
$approveID = $db->getInsertID();
|
$approveID = $db->getInsertID('tblDocumentApprovers', 'approveID');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$approveID = isset($indstatus["approveID"]) ? $indstatus["approveID"] : NULL;
|
$approveID = isset($indstatus["approveID"]) ? $indstatus["approveID"] : NULL;
|
||||||
|
@ -3233,7 +3233,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$approveLogID = $db->getInsertID();
|
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
|
||||||
return $approveLogID;
|
return $approveLogID;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -3276,7 +3276,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
$approveID = $db->getInsertID();
|
$approveID = $db->getInsertID('tblDocumentApprovers', 'approveID');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$approveID = isset($approvalStatus[0]["approveID"])?$approvalStatus[0]["approveID"]:NULL;
|
$approveID = isset($approvalStatus[0]["approveID"])?$approvalStatus[0]["approveID"]:NULL;
|
||||||
|
@ -3292,7 +3292,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
// Add approver to event notification table.
|
// Add approver to event notification table.
|
||||||
//$this->_document->addNotify($groupID, false);
|
//$this->_document->addNotify($groupID, false);
|
||||||
|
|
||||||
$approveLogID = $db->getInsertID();
|
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
|
||||||
return $approveLogID;
|
return $approveLogID;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -3350,7 +3350,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res)
|
if (is_bool($res) && !$res)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
$approveLogID = $db->getInsertID();
|
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
|
||||||
if($file) {
|
if($file) {
|
||||||
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
|
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
|
||||||
}
|
}
|
||||||
|
@ -3394,7 +3394,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (is_bool($res) && !$res)
|
if (is_bool($res) && !$res)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
$approveLogID = $db->getInsertID();
|
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
|
||||||
if($file) {
|
if($file) {
|
||||||
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
|
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,7 +520,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$newFolder = $this->_dms->getFolder($db->getInsertID());
|
$newFolder = $this->_dms->getFolder($db->getInsertID('tblFolders'));
|
||||||
unset($this->_subFolders);
|
unset($this->_subFolders);
|
||||||
|
|
||||||
if($attributes) {
|
if($attributes) {
|
||||||
|
@ -825,7 +825,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$document = $this->_dms->getDocument($db->getInsertID());
|
$document = $this->_dms->getDocument($db->getInsertID('tblDocuments'));
|
||||||
|
|
||||||
// if ($version_comment!="")
|
// if ($version_comment!="")
|
||||||
$res = $document->addContent($version_comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers, $reqversion, $version_attributes, $workflow);
|
$res = $document->addContent($version_comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers, $reqversion, $version_attributes, $workflow);
|
||||||
|
|
|
@ -223,12 +223,15 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
if(!isset($this->_attributes[$attrdef->getId()])) {
|
if(!isset($this->_attributes[$attrdef->getId()])) {
|
||||||
switch(get_class($this)) {
|
switch(get_class($this)) {
|
||||||
case $this->_dms->getClassname('document'):
|
case $this->_dms->getClassname('document'):
|
||||||
|
$tablename = 'tblDocumentAttributes';
|
||||||
$queryStr = "INSERT INTO `tblDocumentAttributes` (`document`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")";
|
$queryStr = "INSERT INTO `tblDocumentAttributes` (`document`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")";
|
||||||
break;
|
break;
|
||||||
case $this->_dms->getClassname('documentcontent'):
|
case $this->_dms->getClassname('documentcontent'):
|
||||||
|
$tablename = 'tblDocumentContentAttributes';
|
||||||
$queryStr = "INSERT INTO `tblDocumentContentAttributes` (`content`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")";
|
$queryStr = "INSERT INTO `tblDocumentContentAttributes` (`content`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")";
|
||||||
break;
|
break;
|
||||||
case $this->_dms->getClassname('folder'):
|
case $this->_dms->getClassname('folder'):
|
||||||
|
$tablename = 'tblFolderAttributes';
|
||||||
$queryStr = "INSERT INTO `tblFolderAttributes` (`folder`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")";
|
$queryStr = "INSERT INTO `tblFolderAttributes` (`folder`, `attrdef`, `value`) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -238,7 +241,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
if (!$res)
|
if (!$res)
|
||||||
return false;
|
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);
|
$attr->setDMS($this->_dms);
|
||||||
$this->_attributes[$attrdef->getId()] = $attr;
|
$this->_attributes[$attrdef->getId()] = $attr;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -264,7 +264,7 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
||||||
* transitions are added in a row, without reloading the workflow
|
* transitions are added in a row, without reloading the workflow
|
||||||
*/
|
*/
|
||||||
$this->_transitions = array();
|
$this->_transitions = array();
|
||||||
$transition = $this->getTransition($db->getInsertID());
|
$transition = $this->getTransition($db->getInsertID('tblWorkflowTransitions'));
|
||||||
|
|
||||||
foreach($users as $user) {
|
foreach($users as $user) {
|
||||||
$queryStr = "INSERT INTO `tblWorkflowTransitionUsers` (`transition`, `userid`) VALUES (".$transition->getID().", ".$user->getID().")";
|
$queryStr = "INSERT INTO `tblWorkflowTransitionUsers` (`transition`, `userid`) VALUES (".$transition->getID().", ".$user->getID().")";
|
||||||
|
|
|
@ -164,6 +164,7 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'mysqli':
|
case 'mysqli':
|
||||||
case 'mysqlnd':
|
case 'mysqlnd':
|
||||||
|
case 'pgsql':
|
||||||
$dsn = $this->_driver.":dbname=".$this->_database.";host=".$this->_hostname;
|
$dsn = $this->_driver.":dbname=".$this->_database.";host=".$this->_hostname;
|
||||||
if($this->_port)
|
if($this->_port)
|
||||||
$dsn .= ";port=".$this->_port;
|
$dsn .= ";port=".$this->_port;
|
||||||
|
@ -220,7 +221,7 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
* @return string sanitized string
|
* @return string sanitized string
|
||||||
*/
|
*/
|
||||||
function rbt($text) { /* {{{ */
|
function rbt($text) { /* {{{ */
|
||||||
return str_replace('`', '"');
|
return str_replace('`', '"', $text);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,9 +232,12 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
* @param string $queryStr sql query
|
* @param string $queryStr sql query
|
||||||
* @return array/boolean data if query could be executed otherwise false
|
* @return array/boolean data if query could be executed otherwise false
|
||||||
*/
|
*/
|
||||||
function getResultArray($queryStr) { /* {{{ */
|
function getResultArray($queryStr, $retick=true) { /* {{{ */
|
||||||
$resArr = array();
|
$resArr = array();
|
||||||
|
|
||||||
|
if($retick && $this->_driver == 'pgsql') {
|
||||||
|
$queryStr = $this->rbt($queryStr);
|
||||||
|
}
|
||||||
$res = $this->_conn->query($queryStr);
|
$res = $this->_conn->query($queryStr);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
if($this->_debug)
|
if($this->_debug)
|
||||||
|
@ -251,11 +255,13 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
* Call this function only with sql query which do not return data records.
|
* Call this function only with sql query which do not return data records.
|
||||||
*
|
*
|
||||||
* @param string $queryStr sql query
|
* @param string $queryStr sql query
|
||||||
* @param boolean $silent not used anymore. This was used when this method
|
* @param boolean $retick replace all '`' by '"'
|
||||||
* still issued an error message
|
|
||||||
* @return boolean true if query could be executed otherwise false
|
* @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);
|
$res = $this->_conn->exec($queryStr);
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
if($this->_debug)
|
if($this->_debug)
|
||||||
|
@ -293,8 +299,11 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
*
|
*
|
||||||
* @return integer id used in last autoincrement
|
* @return integer id used in last autoincrement
|
||||||
*/
|
*/
|
||||||
function getInsertID() { /* {{{ */
|
function getInsertID($tablename='', $fieldname='id') { /* {{{ */
|
||||||
return $this->_conn->lastInsertId();
|
if($this->_driver == 'pgsql')
|
||||||
|
return $this->_conn->lastInsertId($tablename.'_'.$fieldname.'_seq');
|
||||||
|
else
|
||||||
|
return $this->_conn->lastInsertId();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getErrorMsg() { /* {{{ */
|
function getErrorMsg() { /* {{{ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user