svn commit: r68 - trunk/mapbender/http/php/database-pgsql.php

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


Author: uli
Date: 2006-04-18 10:17:38+0000
New Revision: 68

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

Log:
provisional function for preparedStatements included

Modified: trunk/mapbender/http/php/database-pgsql.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/database-pgsql.php?view=diff&rev=68&p1=trunk/mapbender/http/php/database-pgsql.php&p2=trunk/mapbender/http/php/database-pgsql.php&r1=67&r2=68
==============================================================================
--- trunk/mapbender/http/php/database-pgsql.php	(original)
+++ trunk/mapbender/http/php/database-pgsql.php	2006-04-18 10:17:38+0000
@@ -132,7 +132,25 @@
 		}
 	return $ret;	
 }
-
+/**
+ *  prepare and query the database
+ *
+ *  @param		$qstring (string)	SQL statement
+ *  @param		$params (array params as strings)		
+ *  @param		$types (array types as strings)		
+ */
+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