summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SemanticScuttle/Service/CommonDescription.php15
-rw-r--r--src/SemanticScuttle/Service/Tag.php12
-rw-r--r--src/SemanticScuttle/Service/Tag2Tag.php12
-rw-r--r--src/SemanticScuttle/Service/TagCache.php18
-rw-r--r--src/SemanticScuttle/Service/TagStat.php16
5 files changed, 53 insertions, 20 deletions
diff --git a/src/SemanticScuttle/Service/CommonDescription.php b/src/SemanticScuttle/Service/CommonDescription.php
index 75a67c0..c17e7e4 100644
--- a/src/SemanticScuttle/Service/CommonDescription.php
+++ b/src/SemanticScuttle/Service/CommonDescription.php
@@ -55,8 +55,9 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
return false;
}
- if ($row =& $this->db->sql_fetchrow($dbresult)) {
- $this->db->sql_freeresult($dbresult);
+ $row = $this->db->sql_fetchrow($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ if ($row) {
return $row;
} else {
return false;
@@ -129,8 +130,9 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
return false;
}
- if ($row =& $this->db->sql_fetchrow($dbresult)) {
- $this->db->sql_freeresult($dbresult);
+ $row = $this->db->sql_fetchrow($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ if ($row) {
return $row;
} else {
return false;
@@ -148,8 +150,9 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
return false;
}
- return $this->db->sql_fetchrowset($dbresult);
-
+ $rowset = $this->db->sql_fetchrowset($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ return $rowset;
}
function deleteDescriptionsForUser($uId){
diff --git a/src/SemanticScuttle/Service/Tag.php b/src/SemanticScuttle/Service/Tag.php
index 93cfd45..e5393a1 100644
--- a/src/SemanticScuttle/Service/Tag.php
+++ b/src/SemanticScuttle/Service/Tag.php
@@ -34,7 +34,9 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
return false;
}
- if ($row =& $this->db->sql_fetchrow($dbresult)) {
+ $row = $this->db->sql_fetchrow($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ if ($row) {
return $row;
} else {
return array('tDescription'=>'');
@@ -52,7 +54,9 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
return false;
}
- if ($row =& $this->db->sql_fetchrow($dbresult)) {
+ $row = $this->db->sql_fetchrow($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ if ($row) {
return true;
} else {
return false;
@@ -69,7 +73,9 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
return false;
}
- return $this->db->sql_fetchrowset($dbresult);
+ $rowset = $this->db->sql_fetchrowset($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ return $rowset;
}
function updateDescription($tag, $uId, $desc) {
diff --git a/src/SemanticScuttle/Service/Tag2Tag.php b/src/SemanticScuttle/Service/Tag2Tag.php
index cc8abb8..dcbcf2e 100644
--- a/src/SemanticScuttle/Service/Tag2Tag.php
+++ b/src/SemanticScuttle/Service/Tag2Tag.php
@@ -39,7 +39,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
$values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId);
$query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
//die($query);
- if (!($dbresult =& $this->db->sql_query($query))) {
+ if (!($dbresult = $this->db->sql_query($query))) {
$this->db->sql_transaction('rollback');
message_die(GENERAL_ERROR, 'Could not attach tag to tag', '', __LINE__, __FILE__, $query, $this->db);
return false;
@@ -280,7 +280,10 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
//echo($query."<br>\n");
- return $this->db->sql_numrows($this->db->sql_query($query)) > 0;
+ $dbres = $this->db->sql_query($query);
+ $hasTags = $this->db->sql_numrows($dbres) > 0;
+ $this->db->sql_freeresult($dbres);
+ return $hasTags;
}
function getLinks($uId) {
@@ -290,7 +293,10 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
$query.= " AND uId = '".$uId."'";
}
- return $this->db->sql_fetchrowset($this->db->sql_query($query));
+ $dbres = $this->db->sql_query($query);
+ $rowset = $this->db->sql_fetchrowset($dbres);
+ $this->db->sql_freeresult($dbres);
+ return $rowset;
}
function removeLinkedTags($tag1, $tag2, $relationType, $uId) {
diff --git a/src/SemanticScuttle/Service/TagCache.php b/src/SemanticScuttle/Service/TagCache.php
index 9e8b298..7908ae3 100644
--- a/src/SemanticScuttle/Service/TagCache.php
+++ b/src/SemanticScuttle/Service/TagCache.php
@@ -121,8 +121,10 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
//echo($query."<br>\n");
- return $this->db->sql_numrows($this->db->sql_query($query)) > 0;
-
+ $dbres = $this->db->sql_query($query);
+ $rows = $this->db->sql_numrows($dbres);
+ $this->db->sql_freeresult($dbres);
+ return $rows > 0;
}
/*
@@ -221,7 +223,10 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
$query.= " AND relationType = '='";
$query.= " AND uId = '".$uId."'";
- return $this->db->sql_numrows($this->db->sql_query($query)) > 0;
+ $dbres = $this->db->sql_query($query);
+ $rows = $this->db->sql_numrows($dbres);
+ $this->db->sql_freeresult($dbres);
+ return $rows > 0;
}
function _isSynonymValue($tag2, $uId) {
@@ -233,7 +238,10 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
$query.= " AND relationType = '='";
$query.= " AND uId = '".$uId."'";
- return $this->db->sql_numrows($this->db->sql_query($query)) > 0;
+ $dbres = $this->db->sql_query($query);
+ $rows = $this->db->sql_numrows($dbres);
+ $this->db->sql_freeresult($dbres);
+ return $rows > 0;
}
function getSynonyms($tag1, $uId) {
@@ -252,7 +260,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
$tagservice =SemanticScuttle_Service_Factory::get('Tag');
$tag2 = $tagservice->normalize($tag2);
- if($this->_isSynonymKey($tag2)) return $tag2;
+ if($this->_isSynonymKey($tag2, $uId)) return $tag2;
if($tag2 == '') return false;
diff --git a/src/SemanticScuttle/Service/TagStat.php b/src/SemanticScuttle/Service/TagStat.php
index f925bfc..642a83c 100644
--- a/src/SemanticScuttle/Service/TagStat.php
+++ b/src/SemanticScuttle/Service/TagStat.php
@@ -30,7 +30,10 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
- return $this->db->sql_numrows($this->db->sql_query($query));
+ $dbres = $this->db->sql_query($query);
+ $rows = $this->db->sql_numrows($dbres);
+ $this->db->sql_freeresult($dbres);
+ return $rows;
}
function getNbDescendants($tag1, $relationType, $uId) {
@@ -41,6 +44,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
+ $this->db->sql_freeresult($dbresults);
if($row['nb'] == null) {
return 0;
} else {
@@ -56,6 +60,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
+ $this->db->sql_freeresult($dbresults);
if($row['depth'] == null) {
return 0;
} else {
@@ -71,6 +76,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
+ $this->db->sql_freeresult($dbresults);
if($row['nbupdate'] == null) {
return 0;
} else {
@@ -84,7 +90,10 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
- return $this->db->sql_numrows($this->db->sql_query($query))>0;
+ $dbres = $this->db->sql_query($query);
+ $rows = $this->db->sql_numrows($dbres);
+ $this->db->sql_freeresult($dbres);
+ return $rows > 0;
}
function createStat($tag1, $relationType, $uId) {
@@ -136,6 +145,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
foreach($rowset as $row) {
$this->updateStat($row['tag1'], '>', $row['uId']);
}
+ $this->db->sql_freeresult($dbresult);
}
function setNbDescendants($tag1, $relationType, $uId, $nb) {
@@ -147,7 +157,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
- $this->db->sql_query($query);
+ $this->db->sql_freeresult($this->db->sql_query($query));
}
function setMaxDepth($tag1, $relationType, $uId, $depth) {