incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r453115 - /incubator/xap/trunk/src/xap/data/datasource/JsonDataSource.js
Date Thu, 05 Oct 2006 06:43:49 GMT
Author: mturyn
Date: Wed Oct  4 23:43:49 2006
New Revision: 453115

URL: http://svn.apache.org/viewvc?view=rev&rev=453115
Log:
Fixed behaviour for empty select statement, which should give the whole object.

Modified:
    incubator/xap/trunk/src/xap/data/datasource/JsonDataSource.js

Modified: incubator/xap/trunk/src/xap/data/datasource/JsonDataSource.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/datasource/JsonDataSource.js?view=diff&rev=453115&r1=453114&r2=453115
==============================================================================
--- incubator/xap/trunk/src/xap/data/datasource/JsonDataSource.js (original)
+++ incubator/xap/trunk/src/xap/data/datasource/JsonDataSource.js Wed Oct  4 23:43:49 2006
@@ -52,7 +52,7 @@
 		// a file of JSON code, an object will be left on the stack:
 		try {
 			eval(sourceString);
-			contextObject = eval(this.getSource) ;
+			contextObject = eval(this.getSource()) ;
 		}
 		catch (eO) {
 			throw new xap.util.Exception("Problem evaluating:" + eO + " \n" + sourceString);
@@ -80,12 +80,17 @@
 	// Because this is a JSON data source, the
 	// source object is the base of all queries:
 	// 		<src_obj>.a_0()...a_n()
-	theScript = "contextObject." + theScript;
-	try {
-		theData = eval(theScript);
-	}
-	catch (anException) {
-		throw new xap.util.Exception("JsonDataSource.handleDataQuery::source and query: '" + theScript
+ "'\n" + anException);
+	if( theScript.length>0){
+		theScript = "contextObject." + theScript;
+		try {
+			theData = eval(theScript);
+		}
+		catch (anException) {
+			throw new xap.util.Exception("JsonDataSource.handleDataQuery::source and query: '" + theScript
+ "'\n" + anException);
+		}
+	} else {
+		//Empty "select"
+		theData = contextObject ;
 	}
 	listener.dataRetrieved(query, theData, context);
 };
@@ -122,12 +127,16 @@
 	var theScript = this.constructor.resolveIteratorMacros(query);
 	// This is a JSON bridge, the source object
 	// is the base of all queries:  <src_obj>.a_0()...a_n()
-	theScript = "contextObject." + theScript;
-	try {
-		theData = eval(theScript);
-	}
-	catch (anException) {
-		throw new xap.util.Exception("JsonDataSource.handleDataSetQuery:Could not evaluate: '"
+ theScript + "'");
+	if(theScript.length>0){
+		theScript = "contextObject." + theScript;
+		try {
+			theData = eval(theScript);
+		}
+		catch (anException) {
+			throw new xap.util.Exception("JsonDataSource.handleDataSetQuery:Could not evaluate: '"
+ theScript + "'");
+		}
+	} else {
+		theData = contextObject ;
 	}
 	/*DataSet*/
 	var dataset = xap.data.datasource.AbstractDataSet.getDataSet(query, this, theData);



Mime
View raw message