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;
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;
return false;
}
- return $this->db->sql_fetchrowset($dbresult);
-
+ $rowset = $this->db->sql_fetchrowset($dbresult);
+ $this->db->sql_freeresult($dbresult);
+ return $rowset;
}
function deleteDescriptionsForUser($uId){
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'=>'');
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;
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) {
$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;
//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) {
$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) {
//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;
}
/*
$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) {
$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) {
$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;
$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) {
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
+ $this->db->sql_freeresult($dbresults);
if($row['nb'] == null) {
return 0;
} else {
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
+ $this->db->sql_freeresult($dbresults);
if($row['depth'] == null) {
return 0;
} else {
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
+ $this->db->sql_freeresult($dbresults);
if($row['nbupdate'] == null) {
return 0;
} else {
$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) {
foreach($rowset as $row) {
$this->updateStat($row['tag1'], '>', $row['uId']);
}
+ $this->db->sql_freeresult($dbresult);
}
function setNbDescendants($tag1, $relationType, $uId, $nb) {
$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) {