svn commit: r67 - trunk/mapbender/http/php/database-mysql.php

uli at osgeo.org uli at osgeo.org
Tue Apr 18 06:17:25 EDT 2006


Author: uli
Date: 2006-04-18 10:17:24+0000
New Revision: 67

Modified:
   trunk/mapbender/http/php/database-mysql.php

Log:
provisional function for preparedStatements included

Modified: trunk/mapbender/http/php/database-mysql.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/database-mysql.php?view=diff&rev=67&p1=trunk/mapbender/http/php/database-mysql.php&p2=trunk/mapbender/http/php/database-mysql.php&r1=66&r2=67
==============================================================================
--- trunk/mapbender/http/php/database-mysql.php	(original)
+++ trunk/mapbender/http/php/database-mysql.php	2006-04-18 10:17:24+0000
@@ -149,7 +149,25 @@
 	}
 	//echo "SQL__".$qstring;
 }
-
+/**
+ *  prepare and query the database
+ *
+ *  @param		$qstring (string)	SQL statement
+ *  @param		$params (array string params)		
+ *  @param		$types (array string types)		
+ */
+function db_prep_query($qstring, $params, $types) {
+	for ($i=0; $i<count($params); $i++){
+		$needle = "$".strval($i+1);
+		$tmp = '';
+		if($types[$i] == 's'){ $tmp .= "'"; }
+		$tmp .= $params[$i];
+		if($types[$i] == 's'){ $tmp .= "'"; }	
+		$sql = str_replace($needle, $tmp, $qstring);	
+	}
+	$r = db_query($sql);
+	return $r;
+}
 /**
  *	Begin a transaction
  *




More information about the Mapbender_commits mailing list