[Fusionforge-commits] r8511 - trunk/gforge/common/tracker

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Dec 10 14:37:04 CET 2009


Author: lolando
Date: 2009-12-10 14:37:03 +0100 (Thu, 10 Dec 2009)
New Revision: 8511

Modified:
   trunk/gforge/common/tracker/Artifact.class.php
   trunk/gforge/common/tracker/ArtifactExtraFieldElement.class.php
Log:
A few db_query_params() transitions

Modified: trunk/gforge/common/tracker/Artifact.class.php
===================================================================
--- trunk/gforge/common/tracker/Artifact.class.php	2009-12-10 13:27:29 UTC (rev 8510)
+++ trunk/gforge/common/tracker/Artifact.class.php	2009-12-10 13:37:03 UTC (rev 8511)
@@ -956,7 +956,8 @@
 			}
 			$extra_fields = $new_extra_fields;
 
-			$res=db_query("DELETE FROM artifact_extra_field_data WHERE artifact_id='".$this->getID()."'");
+			$res = db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1',
+						array ($this->getID()));
 			if (!$res) {
 				$this->setError('Removal of old artifact_extra_field_data failed: '.db_error());
 				db_rollback();

Modified: trunk/gforge/common/tracker/ArtifactExtraFieldElement.class.php
===================================================================
--- trunk/gforge/common/tracker/ArtifactExtraFieldElement.class.php	2009-12-10 13:27:29 UTC (rev 8510)
+++ trunk/gforge/common/tracker/ArtifactExtraFieldElement.class.php	2009-12-10 13:37:03 UTC (rev 8511)
@@ -291,8 +291,8 @@
 			$this->setPermissionDeniedError();
 			return false;
 		}
-		$sql = "SELECT element_id FROM artifact_extra_field_elements WHERE element_id=".$this->getID();
-		$res = db_query($sql);
+		$res = db_query_params ('SELECT element_id FROM artifact_extra_field_elements WHERE element_id=$1',
+					array ($this->getID()));
 		if (db_numrows($res) != 1) {
 			$this->setError('ArtifactExtraField: Invalid ArtifactExtraFieldElement ID');
 			return false;
@@ -300,12 +300,12 @@
 
 		// Reset all artifacts to 100 before removing the value.
 		$ef=$this->getArtifactExtraField();
-		$sql = "UPDATE artifact_extra_field_data SET field_data=100 WHERE field_data=".$this->getID().
-			" AND extra_field_id=".$ef->getID();
-		db_query($sql);
+		db_query_params ('UPDATE artifact_extra_field_data SET field_data=100 WHERE field_data=$1 AND extra_field_id=$2',
+				 array ($this->getID(),
+					$ef->getID())) ;
 
-		$sql="DELETE FROM artifact_extra_field_elements WHERE element_id='".$this->getID()."'";
-		$result=db_query($sql);
+		$result = db_query_params ('DELETE FROM artifact_extra_field_elements WHERE element_id=$1',
+				    array ($this->getID())) ;
 		if ($result && db_affected_rows($result) > 0) {
 			return true;
 		} else {




More information about the Fusionforge-commits mailing list