climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boust...@apache.org
Subject svn commit: r1477470 - /incubator/climate/trunk/api/server/src/main/webapp/parameters.php
Date Tue, 30 Apr 2013 04:44:46 GMT
Author: boustani
Date: Tue Apr 30 04:44:45 2013
New Revision: 1477470

URL: http://svn.apache.org/r1477470
Log:
Postgres version of parameter.php

Modified:
    incubator/climate/trunk/api/server/src/main/webapp/parameters.php

Modified: incubator/climate/trunk/api/server/src/main/webapp/parameters.php
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/api/server/src/main/webapp/parameters.php?rev=1477470&r1=1477469&r2=1477470&view=diff
==============================================================================
--- incubator/climate/trunk/api/server/src/main/webapp/parameters.php (original)
+++ incubator/climate/trunk/api/server/src/main/webapp/parameters.php Tue Apr 30 04:44:45
2013
@@ -17,17 +17,19 @@
 require_once("./api-config.php");
 ini_set('display_errors',1);
 
-$master_link = mysql_connect(WRM_DB_HOST,WRM_DB_USER,WRM_DB_PASS) or die("Could not connect:
" . mysql_error());
-mysql_select_db(WRM_MASTER_DB_NAME) or die("Could not select db: " . mysql_error());
+$master_link = pg_connect("host=".WRM_DB_HOST
+                          ." dbname=".WRM_MASTER_DB_NAME
+                          ." user=".WRM_DB_USER
+                          ." password=".WRM_DB_PASS) or die("Could not connect: " . pg_last_error());
 
-function listParametersForDataset($shortName) {
-	$sql    = "SELECT parameter.parameter_id, parameter.shortName, dataset.shortName as datasetShortName,parameter.longName,parameter.units
"
-			. "FROM `parameter` "
-			. "LEFT JOIN `dataset` USING(dataset_id) WHERE dataset.shortName='"
-			. mysql_real_escape_string($shortName) . "' ";
-	$result = mysql_query($sql);
+function listParametersForDataset($shortname) {
+	$sql    = "SELECT parameter.parameter_id, parameter.shortname, dataset.shortname as datasetshortname,
parameter.longname, parameter.units "
+			. "FROM parameter "
+			. "LEFT JOIN dataset USING(dataset_id) WHERE dataset.shortname='"
+			. pg_escape_string($shortname) . "' ";
+	$result = pg_query($sql);
 	$resultArray = array();
-	while ($row = mysql_fetch_assoc($result)) {
+	while ($row = pg_fetch_assoc($result)) {
 		$resultArray[] = $row;
 	}
 	return $resultArray;
@@ -44,5 +46,5 @@ if ($dsLabel) {
 	header("HTTP/1.0 404 Not Found");
 }
 	
-mysql_close($master_link);
-exit();
\ No newline at end of file
+pg_close($master_link);
+exit();



Mime
View raw message