[Fusionforge-commits] r8187 - trunk/gforge/plugins/svntracker/www

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Sep 25 15:52:50 CEST 2009


Author: lolando
Date: 2009-09-25 15:52:50 +0200 (Fri, 25 Sep 2009)
New Revision: 8187

Modified:
   trunk/gforge/plugins/svntracker/www/newcommit.php
Log:
db_query_params() migration

Modified: trunk/gforge/plugins/svntracker/www/newcommit.php
===================================================================
--- trunk/gforge/plugins/svntracker/www/newcommit.php	2009-09-25 13:52:39 UTC (rev 8186)
+++ trunk/gforge/plugins/svntracker/www/newcommit.php	2009-09-25 13:52:50 UTC (rev 8187)
@@ -131,11 +131,11 @@
 {
 	global $file, $svn_tracker_debug;
 	$return = array();
-	$Query = "SELECT * from artifact,artifact_group_list WHERE ".
-		"artifact.group_artifact_id=artifact_group_list.group_artifact_id ".
-		"AND artifact_group_list.group_id=".
-		"'".$GroupId."' AND artifact.artifact_id='".$Num."'";
-	$Result = db_query($Query);
+	$Result = db_query_params ('SELECT * from artifact,artifact_group_list WHERE 
+artifact.group_artifact_id=artifact_group_list.group_artifact_id 
+AND artifact_group_list.group_id=$1 AND artifact.artifact_id=$2',
+				   array ($GroupId,
+					  $Num));
 	$Rows = db_numrows($Result);
 	if ($svn_tracker_debug) {
 		fwrite($file,"query : " . $Query ."\n");
@@ -147,29 +147,23 @@
 
 	if ($Rows == 1) {
 		db_begin();
-		$Query = "INSERT INTO plugin_svntracker_data_artifact ".
-		"(kind, group_artifact_id) VALUES ".
-		"('0', '".$Num."')";
-		if ($svn_tracker_debug) {
-			fwrite($file,"query 2: " . $Query ."\n");
-		}
-		$DBRes = db_query($Query);
+		$DBRes = db_query_params ('INSERT INTO plugin_svntracker_data_artifact 
+(kind, group_artifact_id) VALUES 
+(0, $1)',
+					  array ($Num));
 		$HolderID= db_insertid($DBRes,'plugin_svntracker_data_artifact','id');
 		if (!$DBRes || !$HolderID) {
 			$return['Error']='Problems with Artifact $Num: '.db_error($DBRes);
 			db_rollback();
 		} else {
-			$Query = "INSERT INTO plugin_svntracker_data_master ".
-				"(holder_id, svn_date, log_text, file, prev_version, ".
-				"actual_version, author)".
-				" VALUES ('".$HolderID."','".$Config['SvnDate']."','".$Config['Log'].
-				"','".$Config['FileName']."','".
-				$Config['PrevVersion']."','".
-				$Config['ActualVersion']."','".$Config['UserName']."')";
-			if ($svn_tracker_debug) {
-				fwrite($file,"query 3: " . $Query ."\n");
-			}
-			$DBRes = db_query($Query);
+			$DBRes = db_query_params ('INSERT INTO plugin_svntracker_data_master (holder_id, svn_date, log_text, file, prev_version, actual_version, author) VALUES ($1, $2, $3, $4, $5, $6, $7)',
+						  array ($HolderID,
+							 $Config['SvnDate'],
+							 $Config['Log'],
+							 $Config['FileName'],
+							 $Config['PrevVersion'],
+							 $Config['ActualVersion'],
+							 $Config['UserName'])) ;
 			if(!$DBRes) {
 				db_rollback();
 			} else {
@@ -196,36 +190,41 @@
 function addTaskLog($Config, $GroupId, $Num)
 {
 	$return = array();
-	$Query = "SELECT * from project_task,project_group_list WHERE ".
-		"project_task.group_project_id=".
-		"project_group_list.group_project_id ".
-		"AND project_task.project_task_id='".$Num."' AND ".
-		" project_group_list.group_id='".$GroupId."'";
-	var_dump($Query);
-	$Result = db_query($Query);
+	$Result = db_query_params ('SELECT * from project_task,project_group_list WHERE 
+project_task.group_project_id=
+project_group_list.group_project_id 
+AND project_task.project_task_id=$1 AND 
+ project_group_list.group_id=$2',
+			array ($Num,
+				$GroupId));
 	$Rows = db_numrows($Result);
 	if ($Rows == 0) {
 		$return['Error'] .= "Task:$Num Not Found.";
 	}
 	if ($Rows == 1) {
 		db_begin();
-		$Query = "INSERT INTO plugin_svntracker_data_artifact ".
-		"(kind, project_task_id) VALUES ".
-		"('1', '".$Num."')";
-		$DBRes = db_query($Query);
+		$DBRes = db_query_params ('INSERT INTO plugin_svntracker_data_artifact 
+(kind, project_task_id) VALUES 
+(1, $1)',
+			array ($Num));
 		$HolderID= db_insertid($DBRes,'plugin_svntracker_data_artifact','id');
 		if (!$DBRes || !$HolderID) {
 			$return['Error']='Problems with Task $Num: '.db_error($DBRes);
 			db_rollback();
 		} else {
-			$Query = "INSERT INTO plugin_svntracker_data_master ".
-				"(holder_id, svn_date, log_text, file, prev_version, ".
-				"actual_version, author)".
-				" VALUES ('".$HolderID."','".$Config['SvnDate']."','".$Config['Log'].
-				"','".$Config['FileName'].
-				"','".$Config['PrevVersion']."','".
-				$Config['ActualVersion']."','".$Config['UserName']."')";
-				$DBRes = db_query($Query);
+			$DBRes = db_query_params ('INSERT INTO plugin_svntracker_data_master 
+(holder_id, svn_date, log_text, file, prev_version, 
+actual_version, author)
+VALUES ($1, $2, $3, $4, $5, $6, $7)',
+
+
+						  array ($HolderID,
+							 $Config['SvnDate'],
+							 $Config['Log'],
+							 $Config['FileName'],
+							 $Config['PrevVersion'],
+							 $Config['ActualVersion'],
+							 $Config['UserName'])) ;
 			if(!$DBRes) {
 				db_rollback();
 			} else {




More information about the Fusionforge-commits mailing list