static String test(String query) { MyDiagnosticHandler diagnosticHandler = new MyDiagnosticHandler(); InMemoryStore store = InMemoryStore.getInstance(); Zorba zorba = Zorba.getInstance(store); XQuery xquery = zorba.compileQuery(query, diagnosticHandler); StringBuilder sbuilder = new StringBuilder(); Iterator iter = xquery.iterator(); iter.open(); Item item = new Item(); while (iter.next(item)) { sbuilder.Append(item.getStringValue()); } iter.close(); iter.Dispose(); xquery.destroy(); xquery.Dispose(); zorba.shutdown(); InMemoryStore.shutdown(store); return(sbuilder.ToString()); }
static string test(string query, string xml, string doc) { InMemoryStore store = InMemoryStore.getInstance(); Zorba zorba = Zorba.getInstance(store); XmlDataManager dataManager = zorba.getXmlDataManager(); Iterator docIter = dataManager.parseXML(xml); docIter.open(); Item idoc = new Item(); docIter.next(idoc); docIter.close(); docIter.Dispose(); DocumentManager docManager = dataManager.getDocumentManager(); docManager.put(doc, idoc); XQuery xquery = zorba.compileQuery(query); string result = xquery.execute(); xquery.destroy(); xquery.Dispose(); zorba.shutdown(); InMemoryStore.shutdown(store); return(result); }
static void Main(string[] args) { System.Console.WriteLine("Running: Get zorba instance and shutdown"); InMemoryStore store = InMemoryStore.getInstance(); Zorba zorba = Zorba.getInstance(store); zorba.shutdown(); InMemoryStore.shutdown(store); System.Console.WriteLine("Success"); }
static String test(String query) { InMemoryStore store = InMemoryStore.getInstance(); Zorba zorba = Zorba.getInstance(store); XQuery xquery = zorba.compileQuery(query); String result = xquery.printPlanAsDOT(); xquery.destroy(); xquery.Dispose(); zorba.shutdown(); InMemoryStore.shutdown(store); return(result); }
static void test(String query) { InMemoryStore store = InMemoryStore.getInstance(); Zorba zorba = Zorba.getInstance(store); XQuery xquery = zorba.compileQuery(query); Iterator iterator = xquery.iterator(); printIterator(iterator, ""); xquery.destroy(); xquery.Dispose(); zorba.shutdown(); InMemoryStore.shutdown(store); return; }
static String test(String query) { MyDiagnosticHandler diagnosticHandler = new MyDiagnosticHandler(); InMemoryStore store = InMemoryStore.getInstance(); Zorba zorba = Zorba.getInstance(store); XQuery xquery = zorba.compileQuery(query, diagnosticHandler); StringBuilder sbuilder = new StringBuilder(); sbuilder.Append(xquery.execute()); xquery.destroy(); xquery.Dispose(); zorba.shutdown(); InMemoryStore.shutdown(store); return(sbuilder.ToString()); }