From: <tim...@us...> - 2011-05-31 12:53:52
|
Revision: 4378 http://mxquery.svn.sourceforge.net/mxquery/?rev=4378&view=rev Author: timchurch Date: 2011-05-31 12:53:45 +0000 (Tue, 31 May 2011) Log Message: ----------- Removed separate doUpdatingQuery() function - no longer needed Modified Paths: -------------- trunk/MXQuery_Android_App/src/ch/ethz/mxquery/android/MXQueryService.java Modified: trunk/MXQuery_Android_App/src/ch/ethz/mxquery/android/MXQueryService.java =================================================================== --- trunk/MXQuery_Android_App/src/ch/ethz/mxquery/android/MXQueryService.java 2011-05-31 10:39:22 UTC (rev 4377) +++ trunk/MXQuery_Android_App/src/ch/ethz/mxquery/android/MXQueryService.java 2011-05-31 12:53:45 UTC (rev 4378) @@ -1,23 +1,12 @@ package ch.ethz.mxquery.android; -import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.io.StringWriter; -import java.io.UnsupportedEncodingException; import android.app.Service; import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.util.Log; -import ch.ethz.mxquery.contextConfig.CompilerOptions; -import ch.ethz.mxquery.contextConfig.Context; -import ch.ethz.mxquery.exceptions.MXQueryException; -import ch.ethz.mxquery.model.XDMIterator; -import ch.ethz.mxquery.query.PreparedStatement; -import ch.ethz.mxquery.query.XQCompiler; -import ch.ethz.mxquery.query.impl.CompilerImpl; -import ch.ethz.mxquery.xdmio.XDMSerializer; import ch.ethz.mxquery.xqj.MXQueryXQDataSource; import ch.ethz.repackaged.xquery.XQConnection; import ch.ethz.repackaged.xquery.XQDataSource; @@ -61,17 +50,14 @@ private class QueryThread extends Thread { private String query; private XQueryListener listener; - private boolean updating; public QueryThread(String query, XQueryListener listener, boolean updating) { this.query = query; this.listener = listener; - this.updating = updating; } public void run() { - String result = updating ? doUpdatingQuery(this.query) - : doQuery(this.query); + String result = doQuery(this.query); lastResult = result; System.out.println("QueryThread - saving result: " + result); listener.queryResult(result); @@ -95,43 +81,5 @@ } return result.toString(); } - - protected String doUpdatingQuery(String query) { - Context ctx = new Context(); - CompilerOptions co = new CompilerOptions(); - XQCompiler comp = new CompilerImpl(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - String s = new String(); - - ctx.getStores().setSerializeStores(true); - co.setUpdate(true); - - try { - PreparedStatement statement = comp.compile(ctx, query, co, null, null); - XDMIterator result = statement.evaluate(); - XDMSerializer ser = new XDMSerializer(); - - ser.eventsToXML(out, result); - statement.applyPUL(); - statement.serializeStores(false); - result.close(false); - statement.close(); - } catch (MXQueryException err) { - MXQueryException.printErrorPosition(query, err.getLocation()); - err.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - ctx.getStores().freeRessources(); - - try { - s = out.toString("utf-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - - return s; - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |